Mysql_DbDriver.object
上传用户:xiao730204
上传日期:2007-01-04
资源大小:141k
文件大小:2k
- <?php
- class Mysql_DbDriver extends BaseObject {
- var $sql_statement;
- var $db_connection_handle;
- var $db_result;
- var $db_result_return;
- var $debug;
- Function Mysql_DbDriver() {
- $this->BaseObject( 'Mysql_DbDriver' );
- $this->sql_statement = '';
- $this->db_connection_handle = '';
- $this->db_result = '';
- $this->db_result_return = 0;
- $this->debug = new Debug();
- $this->debug->prefix = 'Mysql_Db::DbDriver';
- $this->debug->Off();
- }
- Function Exec() {
- $this->debug->Message(
- 'Execing sql stmt : ' . "n" .
- $this->sql_statement . "n"
- );
- $this->db_result_return = (
- $this->db_result = @mysql_query(
- $this->sql_statement,
- $this->db_connection_handle
- )
- );
- if ( $this->db_result_return == false ) {
- $error_string = @mysql_errno() . ':' . @mysql_error();
- $this->debug->Message( $error_string );
- return false;
- } else {
- $this->db_result_return = true;
- return true;
- }
- }
- Function GetInsertId() {
- return @mysql_insert_id( $this->db_result );
- }
- 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 ) {
- /* Return a row */
- return @mysql_fetch_row( $this->db_result );
- } 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;
- }
- }
- }
- ?>