本文整理汇总了PHP中BigTree::tableContents方法的典型用法代码示例。如果您正苦于以下问题:PHP BigTree::tableContents方法的具体用法?PHP BigTree::tableContents怎么用?PHP BigTree::tableContents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BigTree
的用法示例。
在下文中一共展示了BigTree::tableContents方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: backupDatabase
static function backupDatabase($file)
{
if (!BigTree::isDirectoryWritable($file)) {
return false;
}
$pointer = fopen($file, "w");
fwrite($pointer, "SET SESSION sql_mode = 'NO_AUTO_VALUE_ON_ZERO';\n");
fwrite($pointer, "SET foreign_key_checks = 0;\n\n");
// We need to dump the bigtree tables in the proper order or they will not properly be recreated with the right foreign keys
$q = sqlquery("SHOW TABLES");
while ($f = sqlfetch($q)) {
$table = current($f);
// Write the drop / create statements
fwrite($pointer, "DROP TABLE IF EXISTS `{$table}`;\n");
$definition = sqlfetch(sqlquery("SHOW CREATE TABLE `{$table}`"));
fwrite($pointer, str_replace(array("\n ", "\n"), "", end($definition)) . ";\n");
// Get all the table contents, write them out
$rows = BigTree::tableContents($table);
foreach ($rows as $row) {
fwrite($pointer, $row . ";\n");
}
// Separate it from the next table
fwrite($pointer, "\n");
}
fwrite($pointer, "\nSET foreign_key_checks = 1;");
fclose($pointer);
return true;
}