Find a database backup class on the net, but do not know how to use, seek answers

Source: Internet
Author: User
On the Internet to find a database backup class, but do not know how to use, ask for answers
Original article Address: http://blog.csdn.net/j_bing/article/details/23124475
Can you tell me how to quote this class? Do not know how to swallow Ah!
 /**
file:dbbackup.class.php
Database backup class file, the backup file is placed in the/backup directory
Package:sql
*/
Date_default_timezone_set (' PRC '); Setting the time zone

Class Dbbackup {
Private $path = "sql/backup/"; SQL file save path, default is/backup
Private $database; The name of the database that you want to back up
Private $size; Sub-volume sub-parts size
Private $fileName; SQL file name

Private $ds = "\ n"; Line break
Private $sqlEnd = ";"; End symbol for each SQL statement


/**
* Constructor method, used to instantiate the Backup class object
[email protected] string $database database name, the default value is ' Lighting '
[email protected] int $size the size of the volume file, the default value is 2048
*/
function __construct ($size = 2048, $database = ' lighting ') {
$this->database = $database; Set the database to be backed up, default to lighting
$this->size = $size; Sub-volume file size, default is 2MB
$this->filename = Date (' Ymdhis '). " _all ";

Ob_end_flush (); Clear all Caches
}

/**
* Common method for database backup
[EMAIL protected] BOOL whether the backup was successful
*/
Public Function Backup () {
$sqlFile = "; Preparing information for writing to the database

$this->showmess ("Backing Up");
/* Back up all data tables in the specified database */
if ($tables = mysql_query ("SHOW TABLE STATUS from". $this->database)) {
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.