die( "PostgreSQL functions missing, have you compiled PHP with the --with-pgsql option?\n" );
}
+ global $wgDBschema;
+
$this->close();
$this->mServer = $server;
$this->mUser = $user;
} else {
$this->mOpened = true;
}
+ $this->query("SET search_path = $wgDBschema,public");
}
return $this->mConn;
}
# Returns the size of a text field, or -1 for "unlimited"
function textFieldSize( $table, $field ) {
$table = $this->tableName( $table );
- $res = $this->query( "SELECT $field FROM $table LIMIT 1", "Database::textFieldLength" );
- $size = pg_field_size( $res, 0 );
+ $sql = "SELECT t.typname as ftype,a.atttypmod as size
+ FROM pg_class c, pg_attribute a, pg_type t
+ WHERE relname='$table' AND a.attrelid=c.oid AND
+ a.atttypid=t.oid and a.attname='$field'";
+ $res =$this->query($sql);
+ $row=$this->fetchObject($res);
+ if ($row->ftype=="varchar") {
+ $size=$row->size-4;
+ } else {
+ $size=$row->size;
+ }
$this->freeResult( $res );
return $size;
}
return wfTimestamp(TS_DB,$ts);
}
+ /**
+ * Return aggregated value function call
+ */
+ function aggregateValue ($valuedata,$valuename='value') {
+ return $valuedata;
+ }
+
+
function reportQueryError( $error, $errno, $sql, $fname, $tempIgnore = false ) {
$message = "A database error has occurred\n" .
"Query: $sql\n" .