Fixed heredoc syntax errors

This commit is contained in:
Timothy Warren 2012-02-13 13:29:31 -05:00
parent 13ff38acb4
commit cfc01cb90e
2 changed files with 15 additions and 8 deletions

View File

@ -54,11 +54,12 @@ class pgSQL extends DB_PDO {
*/ */
function get_dbs() function get_dbs()
{ {
$sql = <<< SQL $sql = <<<SQL
SELECT "datname" FROM "pg_database" SELECT "datname" FROM "pg_database"
WHERE "datname" NOT IN ('template0','template1') WHERE "datname" NOT IN ('template0','template1')
ORDER BY 1 ORDER BY 1
SQL; SQL;
$res = $this->query($sql); $res = $this->query($sql);
$dbs = $res->fetchAll(PDO::FETCH_ASSOC); $dbs = $res->fetchAll(PDO::FETCH_ASSOC);
@ -114,13 +115,14 @@ SQL;
{ {
if($database === "") if($database === "")
{ {
$sql = <<< SQL $sql = <<<SQL
SELECT DISTINCT "schemaname" FROM "pg_tables" SELECT DISTINCT "schemaname" FROM "pg_tables"
WHERE "schemaname" NOT LIKE 'pg\_%' WHERE "schemaname" NOT LIKE 'pg\_%'
SQL; SQL;
} }
$sql = <<< SQL $sql = <<<SQL
SELECT "nspname" FROM pg_namespace SELECT "nspname" FROM pg_namespace
WHERE "nspname" NOT LIKE 'pg\_%' WHERE "nspname" NOT LIKE 'pg\_%'
SQL; SQL;

View File

@ -42,8 +42,10 @@ class SQLite extends DB_PDO {
{ {
// SQLite has a TRUNCATE optimization, // SQLite has a TRUNCATE optimization,
// but no support for the actual command. // but no support for the actual command.
$sql = <<<SQL DELETE FROM "{$table}"" $sql = <<<SQL
DELETE FROM "{$table}"
SQL; SQL;
$this->query($sql); $this->query($sql);
} }
@ -55,8 +57,10 @@ SQL;
function get_tables() function get_tables()
{ {
$tables = array(); $tables = array();
$sql = <<<SQL SELECT "name", "sql" FROM "sqlite_master" WHERE type='table' $sql = <<<SQL
SELECT "name", "sql" FROM "sqlite_master" WHERE "type"='table'
SQL; SQL;
$res = $this->query($sql); $res = $this->query($sql);
$result = $res->fetchAll(PDO::FETCH_ASSOC); $result = $res->fetchAll(PDO::FETCH_ASSOC);
@ -75,7 +79,7 @@ SQL;
*/ */
function get_system_tables() function get_system_tables()
{ {
$sql= <<< SQL $sql= <<<SQL
SELECT "name", "type" SELECT "name", "type"
FROM sqlite_master FROM sqlite_master
WHERE "type" IN ('table', 'view') WHERE "type" IN ('table', 'view')
@ -96,7 +100,7 @@ SQL;
*/ */
function load_database($db, $name) function load_database($db, $name)
{ {
$sql = <<< SQL $sql = <<<SQL
ATTACH DATABASE '{$db}' AS "{$name}" ATTACH DATABASE '{$db}' AS "{$name}"
SQL; SQL;
$this->query($sql); $this->query($sql);
@ -109,7 +113,8 @@ SQL;
*/ */
function unload_database($name) function unload_database($name)
{ {
$sql = <<< SQL DETACH DATABASE "{$name}"" $sql = <<<SQL
DETACH DATABASE "{$name}"
SQL; SQL;
$this->query($sql); $this->query($sql);
} }