public function executeSqlStatement($sql_start, $sql_end)
 {
     $this->start_time = time();
     $this->operation_description = 'SQL Statement: "' . stripslashes($sql_start . ' ' . $this->app_description . '.' . $sql_end . '"');
     foreach ($this->app_array as $app) {
         $sql = $this->constructSqlStatement($app, $sql_start, $sql_end);
         $result = $app->gcQuery($sql, array(), false, true);
         if ($result == -1) {
             $this->failure_list[] = $app->getShortName();
         } else {
             GcrDatabaseAccessPostgres::logQueryResult($sql, $result);
         }
     }
     $this->close();
 }
 protected function getNextPollTime()
 {
     $milliseconds = gcr::updatePollingMin;
     $ratio = GcrDatabaseAccessPostgres::getConnectionCountRatio();
     // We take usage in excess of .5 of the available connections as the
     // point at which we start to slow down polling intervals
     $overuse = ($ratio - 0.5) * 2;
     // ratio used of the remaining 50%
     if ($overuse > 0) {
         // add on up to an extra minute depending on how close to using the
         // max connections we are.
         $milliseconds += gcr::updatePollingMax * $overuse;
     }
     return $milliseconds;
 }
 public function upsertIntoMdlTable($tableName, $valueAssocArray, $whereAssocArray)
 {
     return GcrDatabaseAccessPostgres::upsertIntoTable($this, $tableName, $valueAssocArray, $whereAssocArray);
 }
 public function upsertIntoMhrTable($tableName, $valueAssocArray, $whereAssocArray)
 {
     //  Changed by Mohan following Ron's email
     //	return GcrDatabaseAccessPostgres::upsertIntoTable($this, $tableName, $valueAssocArray, $whereAssocArray);
     $this->beginTransaction();
     // We need this to get past Mahara's triggers which are not schema aware.
     $this->gcQuery('SET LOCAL search_path TO ' . $this->short_name);
     $result = GcrDatabaseAccessPostgres::upsertIntoTable($this, $tableName, $valueAssocArray, $whereAssocArray);
     $this->commitTransaction();
     return $result;
 }