- <?php
- class Postgres_DbDriver extends BaseObject {
- var $sql_statement;
- var $db_connection_handle;
- var $db_result;
- var $db_result_return;
- var $debug;
- /* Postgres specific */
- var $num_rows;
- var $cur_row;
- Function Postgres_DbDriver() {
- $this->BaseObject( 'Postgres_DbDriver' );
- $this->sql_statement = '';
- $this->db_connection_handle = '';
- $this->db_result = '';
- $this->db_result_return = 0;
- $this->num_rows = 0;
- $this->cur_row = 0;
- $this->debug = new Debug();
- $this->debug->prefix = 'Postgres_Db::DbDriver';
- $this->debug->On();
- }
- Function Exec() {
- $this->debug->Message(
- 'Execing sql stmt : ' . "n" .
- $this->sql_statement . "n"
- );
- $this->db_result_return = (
- $this->db_result = @pg_Exec(
- $this->db_connection_handle,
- $this->sql_statement
- )
- );
- if ( $this->db_result_return == false ) {
- $error_string = @pg_ErrorMessage( $this->$db_connection_handle );
- $this->debug->Message( $error_string );
- return false;
- } else {
- $this->db_result_return = true;
- return true;
- }
- }
- Function GetInsertId() {
- //return @mysql_insert_id( $this->db_result );
- return -1;
- }
- Function FetchRow() {
- /* If the sql hasn't been ran dammit run it */
- if ( $this->db_result_return != true ) { $this->Exec(); }
- if ( $this->db_result_return == true ) {
- $this->num_rows = @pg_NumRows( $this->db_result );
- if ( $this->cur_row < $this->num_rows ) {
- /* Increment up the current row for the next iteration */
- $this->cur_row += 1;
- return @pg_Fetch_Row( $this->db_result, $this->cur_row - 1);
- } else {
- return false;
- }
- } else {
- /* Whooo bad high... out of rows and or out of command */
- return false;
- }
- }
- Function FetchCell( $xx, $yy ) {
- /* If the sql hasn't been ran dammit run it */
- /* if ( $this->db_result_return != true ) {
- $this->Exec();
- }
- if ( $this->db_result_return == true ) {
- if ( @mysql_data_seek( $this->db_result, $yy ) ) {
- return @mysql_fetch_field( $this->db_result, xx );
- }
- } else {
- return false;
- }
- */
- }
- }
- ?>