本文整理汇总了PHP中PMA_exportData函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_exportData函数的具体用法?PHP PMA_exportData怎么用?PHP PMA_exportData使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_exportData函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: backup_mysql_fn
function backup_mysql_fn($shost, $suser, $spass, $sdb, $sdbfile)
{
//echo $shost.' == '. $suser.' == '. $spass.' == '. $sdb.' == '. $sdbfile;
$link = mysql_connect($shost, $suser, $spass);
mysql_query('SET CHARACTER SET utf8');
// Open and create a file handle for sql.
$handle = fopen($sdbfile, 'w');
$s_def = $alter_queries = $sresponse = '';
$sql_alter = $tables = array();
$ser_ver = PMA_sversion();
$s_def = PMA_exportHeader($sdb, $ser_ver);
fwrite($handle, $s_def);
// List the tables
$squery = mysql_query('SHOW TABLES FROM `' . $sdb . '`');
while ($row = mysql_fetch_row($squery)) {
$tables[] = $row[0];
}
// Sort the tables
usort($tables, 'strnatcasecmp');
foreach ($tables as $table => $v) {
// Get the table structure(table definition)
$stable_defn = PMA_getTableDef($sdb, $v, "\n");
$s_def = $stable_defn['structure'] . "\n";
fwrite($handle, $s_def);
// Get the table data(table contents)
// We have added $handle so that we can write the INSERT queries directly when we get it.
// Basically To avoid MEMORY EXHAUST FOR BIG INSERTS
PMA_exportData($sdb, $v, "\n", $handle);
// List of alter queries
// We have changed this because the OLD method was putting the ALTER queries after CREATE table query which was causing issues.
if (!empty($stable_defn['alter'])) {
$alter_queries .= $stable_defn['alter'];
}
}
fwrite($handle, $alter_queries);
$sresponse = PMA_exportFooter();
// Just to add the finishing lines
fwrite($handle, $sresponse);
fclose($handle);
// Just check that file is created or not ??
if (file_exists($sdbfile)) {
return true;
}
return false;
}
示例2: preg_replace
}
// If this is an export of a single view, we have to export data;
// for example, a PDF report
if (isset($GLOBALS[$what . '_data'])) {
if (!empty($sql_query)) {
// only preg_replace if needed
if (!empty($add_query)) {
// remove trailing semicolon before adding a LIMIT
$sql_query = preg_replace('%;\\s*$%', '', $sql_query);
}
$local_query = $sql_query . $add_query;
PMA_DBI_select_db($db);
} else {
$local_query = 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . $add_query;
}
if (!PMA_exportData($db, $table, $crlf, $err_url, $local_query)) {
break;
}
}
// now export the triggers (needs to be done after the data because
// triggers can modify already imported tables)
if (isset($GLOBALS[$what . '_structure'])) {
if (!PMA_exportStructure($db, $table, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates, 'triggers', $export_type)) {
break 2;
}
}
if (!PMA_exportDBFooter($db)) {
break;
}
}
if (!PMA_exportFooter()) {