Class: Bs_Odbc
Source Location: /core/db/Bs_Odbc.class.php
Bs_Object
|
--Bs_Db
|
--Bs_Odbc
*********************************************************************** dependencies: Bs_Db
Author(s):
Version:
- 4.3.$Revision: 1.2 $ $Date: 2003/08/09 15:17:44 $
Copyright:
|
|
|
Inherited Variables
|
Inherited Methods
|
Class Details
Class Variables
Class Methods
constructor Bs_Odbc [line 59]
method connect [line 80]
int connect(
$dsn
$dsn, [$persistent
$persistent = TRUE])
|
|
Connect to a database server and log in as the specified user. use (select) the given db, if any. NOTE I: If we are already connected to somewhere (no matter where), the existing db connection gets closed first. NOTE II: It's possible to get back an exception but the connection was successfull. Probably the given default database could not be selected => BS_DB_ERROR_CANNOT_SELECT_DB
Tags:
Parameters:
method disconnect [line 135]
Log out and disconnect from the database.
Tags:
method escapeString [line 328]
string escapeString(
string
$query)
|
|
Escape string for mysql query. This method is a wrapper for mysql_escape_string() and overwrites its parent method. mysql_escape_string() is new sinde php403 or 404 and by now it's not documented. I have found this in the mysql manual: mysql_real_escape_string() Escapes special characters in a string for use in a SQL statement taking into account the current charset of the connection. mysql_escape_string() Escapes special characters in a string for use in a SQL statement. So watch out for mysql_real_escape_string() to be implemented in php... You can find a pure php impelementation here: http://www.zend.com/codex.php?id=204&single=1
Tags:
Overrides Bs_Db::escapeString() (Escape string for the query.)
Parameters:
method fetchRow [line 181]
mixed &fetchRow(
$result
$result, [int
$fetchMode = BS_DB_FETCHMODE_ASSOC])
|
|
Fetch a row and return it as vector or hash depending on the fetchMode. Subsequent calls will return the next row in the result set, or NULL if there are no more rows. If fetchMode is BS_DB_FETCHMODE_ASSOC (default), it returns a hash array that corresponds to the fetched row else if it's BS_DB_FETCHMODE_ORDERED returns a vector starting at offset 0. A clean example usage of this method to fetch rows into an array: while ($row = $this->fetchRow($res, $fetchMode)) { if (isEx($row)) { $row->stackTrace('was here: currentFunction()', __FILE__, __LINE__); return $row; } $ret[] = $row; }
Tags:
Overrides Bs_Db::fetchRow() (Fetch a row and return it as vector or hash depending on the fetchMode.)
Parameters:
method fieldLen [line 265]
int fieldLen(
resource
$result, int
$offset)
|
|
Returns the length of a field at the specified offset from a result id. NOTE: Not the actual value length but the max possible field space: E.g. if a varchar(20) has the value 'foobar' it returns 20 not 6. This is a wrapper for odbc_field_len().
Tags:
Parameters:
method fieldName [line 246]
string fieldName(
resource
$result, int
$offset)
|
|
Get the field name at the specified offset from a result id. This is a wrapper for odbc_field_name().
Tags:
Parameters:
method fieldType [line 295]
string fieldType(
resource
$result, [int
$offset = 1])
|
|
Get the type of a field at the specified offset from a result id. This is a wrapper for odbc_field_type().
Tags:
Parameters:
method freeResult [line 231]
void freeResult(
$result
$result)
|
|
Free the internal resources associated with $result. Only needs to be called if you are concerned about how much memory is being used for queries that return large result sets. All associated result memory is automatically freed at the end of the script's execution.
Tags:
Overrides Bs_Db::freeResult() (Free the internal resources associated with $result.)
Parameters:
method listTables [line 307]
void listTables(
[mixed
$dbName = NULL])
|
|
see odbc_tables()
Tags:
method nativeError [line 368]
Returns the native error from the previous db operation or '' (empty string) if no error occured.
Tags:
method nativeErrorCode [line 340]
Returns the numerical native error code from the previous db operation or 0 (zero) if no error occured. This method is a wrapper for odbc_error().
Tags:
Overrides Bs_Db::nativeErrorCode() (Returns the numerical native error code from the previous DB operation or 0 (zero) if no error occured.)
method nativeErrorMsg [line 355]
Returns the native error text from the previous db operation or '' (empty string) if no error occured. This method is a wrapper for odbc_errormsg(). HINT: Better use nativeErrorCode() before calling this method, or call nativeError() directly.
Tags:
Overrides Bs_Db::nativeErrorMsg() (Returns the native error text from the previous DB operation or '' (empty string) if no error occured.)
method numCols [line 212]
int numCols(
$result
$result)
|
|
Get the number of columns (fields) from a result set.
Tags:
Overrides Bs_Db::numCols() (Get the number of columns (fields) in a result identifier.)
Parameters:
method _dbErrorToBsError [line 425]
mixed _dbErrorToBsError(
int
$dbError)
|
|
Maps error codes of the current dbms to bs-dbErrorCodes.
Tags:
Parameters:
|
|