Пример #1
0
 function Setup()
 {
     if (!function_exists("pg_connect")) {
         return "PostgreSQL support is not available in this PHP configuration";
     }
     $this->supported["Sequences"] = $this->supported["Indexes"] = $this->supported["SummaryFunctions"] = $this->supported["OrderByText"] = $this->supported["Transactions"] = $this->supported["GetSequenceCurrentValue"] = $this->supported["SelectRowRanges"] = $this->supported["LOBs"] = $this->supported["Replace"] = $this->supported["AutoIncrement"] = $this->supported["PrimaryKey"] = $this->supported["OmitInsertKey"] = $this->supported["OmitInsertKey"] = $this->supported["PatternBuild"] = 1;
     if (function_exists("pg_cmdTuples")) {
         if ($connection = $this->DoConnect("template1", 0)) {
             if ($result = @pg_Exec($connection, "BEGIN")) {
                 $error_reporting = error_reporting(63);
                 @pg_cmdTuples($result);
                 if (!isset($php_errormsg) || strcmp($php_errormsg, "This compilation does not support pg_cmdtuples()")) {
                     $this->supported["AffectedRows"] = 1;
                 }
                 error_reporting($error_reporting);
             } else {
                 $this->SetError("Setup", pg_ErrorMessage($connection));
             }
             pg_Close($connection);
         } else {
             $result = 0;
         }
         if (!$result) {
             return $this->Error();
         }
     }
     if (isset($this->options["EmulateDecimal"]) && $this->options["EmulateDecimal"]) {
         $this->emulate_decimal = 1;
         $this->decimal_factor = pow(10.0, $this->decimal_places);
     }
     return "";
 }
 function affected_rows($query_id = '')
 {
     if (empty($query_id)) {
         $query_id = $this->result;
     }
     return pg_cmdTuples($query_id);
 }