Skip to content

Commit 99168e0

Browse files
committed
improve constructor help
1 parent 3352414 commit 99168e0

File tree

1 file changed

+27
-29
lines changed

1 file changed

+27
-29
lines changed

README.md

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -29,35 +29,7 @@ Without autoloading/Composer:
2929
$dump->start('storage/work/dump.sql');
3030
?>
3131

32-
## Default Parameters
33-
34-
$host = 'localhost';
35-
36-
$type = 'mysql';
37-
38-
$dumpSettings = array(
39-
'include-tables' => array('table1', 'table2'),
40-
'exclude-tables' => array('table3', 'table4'),
41-
'compress' => 'GZIP',
42-
'no-data' => false,
43-
'add-drop-database' => false,
44-
'add-drop-table' => false,
45-
'single-transaction' => true,
46-
'lock-tables' => false,
47-
'add-locks' => true,
48-
'extended-insert' => true,
49-
'disable-foreign-keys-check' => false,
50-
'where' => '',
51-
'no-create-info' => false
52-
);
53-
54-
$pdoSettings = array(PDO::ATTR_PERSISTENT => true,
55-
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
56-
PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8",
57-
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => false
58-
);
59-
60-
## API
32+
## Constructor and default parameters
6133

6234
/**
6335
* Constructor of Mysqldump. Note that in the case of an SQLite database
@@ -83,6 +55,32 @@ Without autoloading/Composer:
8355
$pdoSettings = array()
8456
)
8557

58+
$dumpSettingsDefault = array(
59+
'include-tables' => array('table1', 'table2'),
60+
'exclude-tables' => array('table3', 'table4'),
61+
'compress' => 'GZIP',
62+
'no-data' => false,
63+
'add-drop-database' => false,
64+
'add-drop-table' => false,
65+
'single-transaction' => true,
66+
'lock-tables' => false,
67+
'add-locks' => true,
68+
'extended-insert' => true,
69+
'disable-foreign-keys-check' => false,
70+
'where' => '',
71+
'no-create-info' => false
72+
);
73+
74+
$pdoSettingsDefaults = array(PDO::ATTR_PERSISTENT => true,
75+
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
76+
PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8",
77+
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => false
78+
);
79+
80+
// missing settings in constructor will be replaced by default options
81+
$this->_pdoSettings = self::array_replace_recursive($pdoSettingsDefault, $pdoSettings);
82+
$this->_dumpSettings = self::array_replace_recursive($dumpSettingsDefault, $dumpSettings);
83+
8684
## Dump Settings
8785

8886
- **include-tables**

0 commit comments

Comments
 (0)