@@ -79,7 +79,7 @@ public function createDatabase($name)
7979 public function postgresDatabaseExists ($ name )
8080 {
8181 $ result = $ this ->preparedQuery ("SELECT datname FROM pg_database WHERE datname = ?; " , array ($ name ));
82- return $ result ->first () ? true : false ;
82+ return $ result ->value () ? true : false ;
8383 }
8484
8585 public function databaseExists ($ name )
@@ -146,7 +146,7 @@ public function schemaExists($name)
146146 return $ this ->preparedQuery (
147147 "SELECT nspname FROM pg_catalog.pg_namespace WHERE nspname = ?; " ,
148148 array ($ name )
149- )->first () ? true : false ;
149+ )->value () ? true : false ;
150150 }
151151
152152 /**
@@ -462,18 +462,18 @@ public function alterTable(
462462 $ stats = $ this ->preparedQuery (
463463 "SELECT relid FROM pg_stat_user_tables WHERE relname = ?; " ,
464464 array ($ table )
465- )->first ();
465+ )->record ();
466466 $ oid = $ stats ['relid ' ];
467467
468468 //Now we can run a long query to get the clustered status:
469469 //If anyone knows a better way to get the clustered status, then feel free to replace this!
470470 $ clustered = $ this ->preparedQuery (
471471 "
472- SELECT c2.relname, i.indisclustered
472+ SELECT c2.relname, i.indisclustered
473473 FROM pg_catalog.pg_class c, pg_catalog.pg_class c2, pg_catalog.pg_index i
474474 WHERE c.oid = ? AND c.oid = i.indrelid AND i.indexrelid = c2.oid AND indisclustered='t'; " ,
475475 array ($ oid )
476- )->first ();
476+ )->value ();
477477
478478 if ($ clustered ) {
479479 $ this ->query ("ALTER TABLE \"$ table \" SET WITHOUT CLUSTER; " );
@@ -830,9 +830,9 @@ public function alterIndex($tableName, $indexName, $indexSpec)
830830 protected function extractTriggerColumns ($ triggerName , $ table )
831831 {
832832 $ trigger = $ this ->preparedQuery (
833- "SELECT t.tgargs
833+ "SELECT t.tgargs
834834 FROM pg_catalog.pg_trigger t
835- INNER JOIN pg_catalog.pg_class c ON c.oid = t.tgrelid
835+ INNER JOIN pg_catalog.pg_class c ON c.oid = t.tgrelid
836836 INNER JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
837837 WHERE c.relname = ?
838838 AND n.nspname = ?
@@ -842,7 +842,7 @@ protected function extractTriggerColumns($triggerName, $table)
842842 $ this ->database ->currentSchema (),
843843 $ triggerName
844844 ]
845- )->first ();
845+ )->record ();
846846
847847 // Convert stream to string
848848 if (is_resource ($ trigger ['tgargs ' ])) {
@@ -968,7 +968,7 @@ protected function constraintExists($constraint, $cache = true)
968968 WHERE r.contype = 'c' AND conname = ? AND n.nspname = ?
969969 ORDER BY 1; " ,
970970 array ($ constraint , $ this ->database ->currentSchema ())
971- )->first ();
971+ )->record ();
972972 if (!$ cache ) {
973973 return $ value ;
974974 }
@@ -1048,7 +1048,7 @@ protected function dropTrigger($triggerName, $tableName)
10481048 FROM information_schema.triggers
10491049 WHERE trigger_name = ? AND trigger_schema = ?; " ,
10501050 array ($ triggerName , $ this ->database ->currentSchema ())
1051- )->first ();
1051+ )->value ();
10521052 if ($ exists ) {
10531053 $ this ->query ("DROP trigger IF EXISTS $ triggerName ON \"$ tableName \"; " );
10541054 }
@@ -1364,7 +1364,7 @@ public function createOrReplaceTablespace($name, $location)
13641364 $ existing = $ this ->preparedQuery (
13651365 "SELECT spcname, spclocation FROM pg_tablespace WHERE spcname = ?; " ,
13661366 array ($ name )
1367- )->first ();
1367+ )->record ();
13681368
13691369 //NOTE: this location must be empty for this to work
13701370 //We can't seem to change the location of the tablespace through any ALTER commands :(
@@ -1489,7 +1489,7 @@ public function createLanguage($language)
14891489 $ result = $ this ->preparedQuery (
14901490 "SELECT lanname FROM pg_language WHERE lanname = ?; " ,
14911491 array ($ language )
1492- )->first ();
1492+ )->value ();
14931493
14941494 if (!$ result ) {
14951495 $ this ->query ("CREATE LANGUAGE $ language; " );
0 commit comments