Implement backup_structure method for SQLite driver

This commit is contained in:
Timothy Warren 2012-02-28 16:15:31 -05:00
parent dec1a1714f
commit 4a65be4791
1 changed files with 15 additions and 2 deletions

View File

@ -149,8 +149,21 @@ SQL;
*/
public function backup_structure()
{
// @todo Implement Backup function
return '';
// Fairly easy for SQLite...just query the master table
$sql = 'SELECT "sql" FROM "sqlite_master"';
$res = $this->query($sql);
$result = $res->fetchAll(PDO::FETCH_ASSOC);
$sql_array = array();
foreach($result as $r)
{
$sql_array[] = $r['sql'];
}
$sql_structure = implode("\n\n", $sql_array);
return $sql_structure;
}
// --------------------------------------------------------------------------