+
+ private function runWithPgEnv($sCmd)
+ {
+ if ($this->bVerbose) {
+ echo "Execute: $sCmd\n";
+ }
+
+ $aProcEnv = null;
+
+ if (isset($this->aDSNInfo['password'])) {
+ $aProcEnv = array_merge(array('PGPASSWORD' => $this->aDSNInfo['password']), $_ENV);
+ }
+
+ return runWithEnv($sCmd, $aProcEnv);
+ }
+
+ /**
+ * Execute the SQL command on the open database.
+ *
+ * @param string $sSQL SQL command to execute.
+ *
+ * @return null
+ *
+ * @pre connect() must have been called.
+ */
+ private function pgExec($sSQL)
+ {
+ if (!pg_query($this->oDB->connection, $sSQL)) {
+ fail(pg_last_error($this->oDB->connection));
+ }
+ }
+
+ /**
+ * Check if the database is in reverse-only mode.
+ *
+ * @return True if there is no search_name table and infrastructure.
+ */
+ private function dbReverseOnly()
+ {
+ $sSQL = "SELECT count(*) FROM pg_tables WHERE tablename = 'search_name'";
+ return !(chksql($this->oDB->getOne($sSQL)));
+ }