|
||
| [ class tree: core_db ] [ index: core_db ] [ all elements ] | ||
|
Packages: packageless applications_chartwizard applications_cms applications_contactform applications_debedoo applications_faq applications_filebrowser applications_filemanager applications_imagearchive applications_indexedlistmanager applications_mailinglist applications_simplequiz applications_smartshop applications_websearchengine core core_auth core_crypt core_date core_db core_file core_gfx core_html core_lang core_net core_storage core_text core_util core_xml Cpdf plugins_geo plugins_indexserver plugins_instanthelp plugins_jsrs plugins_onomastics toolbox_phppackager _ Files:
Bs_ArrayDb.class.php
Bs_Db.class.php Bs_DbGeneral.lib.php Bs_DbWrapper.class.php Bs_Db_PhpUnit.class.php Bs_MsSql.class.php Bs_MySql.class.php Bs_MySql_PhpUnit.class.php Bs_Oci.class.php Bs_Odbc.class.php Bs_ResultSet.class.php subpackage examples Classes: |
[ Top ] Class Methodsconstructor Bs_Db [line 238]method affectedRows [line 1343]
Gets the number of rows affected by the last data manipulation query. Tags:
Overridden in child classes as:
[ Top ]
method assertExtension [line 1012]
Load a PHP database extension if it is not loaded already. Tags:
Parameters:
[ Top ]
method autoCommit [line 1244]
Turn autoCommit on or off Tags:
Overridden in child classes as:
Parameters:
[ Top ]
method commit [line 1264]
Commit last query Tags:
Overridden in child classes as:
[ Top ]
method countRead [line 429]
Issue a select query and return the number of 'affected' rows. This method makes use of this->numRows(). Tags:
Parameters:
[ Top ]
method countWrite [line 483]
Issue a write query (update, delete, replace) and return the number of affected rows. this method makes use of this->affectedRows() read the doc of it! Tags:
Parameters:
[ Top ]
method dbPing [line 250]
Tells whether we're connected. Tags:
[ Top ]
method escapeString [line 1049]
Escape string for the query. if there is a better/specialized way for your specific rdbms, overwrite this. Tags:
Overridden in child classes as:
Parameters:
[ Top ]
method fetchRow [line 1302]
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. Tags:
Overridden in child classes as:
Parameters:
[ Top ]
method formatDateForDb [line 1062]
format and return date string in database date format. overwrite this if needed. Tags:
Overridden in child classes as:
Parameters:
[ Top ]
method formatDatetimeForDb [line 1075]
format and return datetime string in database datetime format. overwrite this if needed. Tags:
Overridden in child classes as:
Parameters:
[ Top ]
method formatTimestampForDb [line 1088]
format and return timestamp string in database timestamp format. overwrite this if needed. Tags:
Overridden in child classes as:
Parameters:
[ Top ]
method freeResult [line 1311]
Free the internal resources associated with $result. Tags:
Overridden in child classes as:
Parameters:
[ Top ]
method getAll [line 978]
Fetch the entire data given by the param $source into a hash. $source can be either a SQL query string or a result set. IF param $source is a query-string: Execute the query, fetch entire data and clean up (free the results set). ELSEIF param $source is a result set: Fetch the entire data. Don't free result set. Sample: Given is the table "mytable" containing: ID TEXT DATE -------------------------------
Tags:
Parameters:
[ Top ]
method getAssoc [line 751]
Fetch the entire data given by the param $source into a hash using the first column as the key. $source can be either a SQL query string or a result set. IF param $source is a query-string: Execute the query, fetch entire data and clean up (free the results set). ELSEIF param $source is a result set: Fetch the entire data. Don't free result set. If more than 2 values are involved in the result set or if $forceArray is TRUE, a hash containing a vector is returned e.g. array('1' => array('one', '944679408')); otherwise a simple hash is returned (see sample below). If the result set contains fewer than two columns, a BS_DB_ERROR_TRUNCATED exception is raised. Sample: Given is the table "mytable" containing: ID TEXT DATE -------------------------------
example 2: getAssoc('SELECT id,text,date FROM mydate') // would return: array( '1' => array('one', '944679408'), '2' => array('two', '944679408'), '3' => array('three', '944679408') ) example 3: getAssoc('SELECT id,text,date FROM mydate', TRUE, TRUE) // would return: array( '1' => array('text'=>'one', 'date'=>'944679408'), '2' => array('text'=>'two', 'date'=>'944679408'), '3' => array('text'=>'three', 'date'=>'944679408') ) this option is new, 2002/03/25 --andrej special note: you have to use a key that is unique. otherwise only one record will be used, i think the later ones overwrite the previews. Tags:
Parameters:
[ Top ]
method getAssoc2 [line 841]
hash array COLUMN BY COLUMN not record by record. The rest is like getAssoc(). See above. Sample: Given is the table "mytable" containing: ID TEXT DATE -------------------------------
Tags:
Parameters:
[ Top ]
method getAssoc3 [line 913]
group the values of one field by another one. see the example. Sample: Given is the table "mytable" containing: ID aID bID --------------------------
you have to select exactly 2 fields. not less, not more. Tags:
Parameters:
[ Top ]
method getCol [line 667]
Fetch a full OR fraction col of data as vector given by the param $source. IF param $source is a query-string: Execute the query, fetch col and clean up (free the results set). ELSEIF param $source is a result set: Move down $row-rows, fetch col and leave DB curser *after* last read row. Don't free result set. NOTE: col may be given as col-name (string) instead of offset (int). It will be used as key to identify the right column. So pass the right type! Sample: Given is the table "mytable" containing: \/ ID TEXT DATE -------------------------------
If you'd only wand to get array('two', 'three') you'd do: getCol($query, 1, 1) or getCol($query, 1, 1, 2) or getCol($query, 'teXt', 1) Tags:
Parameters:
[ Top ]
method getDsn [line 262]
Return the _dsnInfo-hash. Tags:
Parameters:
[ Top ]
method getErrorMessage [line 1173]
Return a textual error message for a bs DB error code Tags:
Parameters:
[ Top ]
method getFieldValue [line 358]
Returns 1-n db-field values. Example I: $birthday = getFieldValue($theTable='employees', $fieldToSearch='username', $valueToSearch='Hugentobler', $fieldToGet='birthday') Example II: list($birthday, $phone) = getFieldValue('employees', 'username', 'Hugentobler', array('birthday', 'phone')) NOTE: Only the first found record is used. Tags:
Parameters:
[ Top ]
method getNumRecords [line 309]
Returns the number of records that get selected for a given query. Example: You want to display page 5 of your search engine with 10 results (per page). So your query would look like this: "select * from searchEngine limit 40,10". But at the same time, you want to show the user how many records really *were* found. The numRows() for the above query will only show you 10... Caution: Never fire a delete statement to this method. This is for select queries only. If you do and it has a 'limit' clause and $ignoreLimit is set to true, the limit will be ignored... NOTE: since bs-4.5 this is optimized. "select x, y from table" is replaced with "select count(*) from table", and if there is a "limit x, y" clause, it is removed. the first part has been added in bs-4.5. Tags:
Parameters:
[ Top ]
method getOne [line 549]
Fetch a single value from a data amount given by the param $source. $source can be either a SQL query string or a result set. IF param $source is a query-string: Execute the query, fetch value and clean up (free the results set). ELSEIF param $source is a result set: Move down $row-rows, fetch value at $col and leave DB curser *after* offset rows. Don't free result set. A row and col offset can be given. Top left cell is row=0 / col=0. The default behavior is to fetch cell [0,0] (top left cell). NOTE: col may be given as col-name (string) instead of offset (int). It will be used as key to identify the right column. So pass the right type! Sample: Given is the table "mytable" containing: \/ ID TEXT DATE ------------------------------- -> 1 'one' 09.05.1960 2 'two' 25.12.1970 3 'three' 31.01.1980 getOne('SELECT id, teXt, date as birthday FROM mytable'); // would return '1'. getOne($query, 1, 2); // would return '25.12.1970'. getOne($query, 2, 'teXt'); // would return 'two'. Tags:
Parameters:
[ Top ]
method getRow [line 609]
Fetch a full row of data as vector or hash given by the param $source. $source can be either a SQL query string or a result set. If fetchMode is BS_DB_FETCHMODE_ASSOC (default) 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. IF param $source is a query-string: Execute the query, fetch row and clean up (free the results set). ELSEIF param $source is a result set: Move down $row-rows, fetch row and leave DB curser *after* offset rows. Don't free result set. The default behaver is to fetch current row. Sample: Given is the table "mytable" containing: ID TEXT DATE ------------------------------- -> 1 'one' 09.05.1960 <- 2 'two' 25.12.1970 3 'three' 31.01.1980 getRow('SELECT id, teXt, date as birthday FROM mydate'); // would return array('id' => '1', 'teXt' => 'one', 'birthday' => '09.05.1960'); Tags:
Parameters:
[ Top ]
method idWrite [line 504]
Issue an insert query on a table with an auto_increment field and return the newly inserted id. this method makes use of this->insertId() read the doc of it! Tags:
Overridden in child classes as:
Parameters:
[ Top ]
method insertId [line 1353]
Get the id generated from the previous INSERT operation. Tags:
Overridden in child classes as:
[ Top ]
method isManipulation [line 1139]
Tells whether a query is a data manipulation query (insert, update, delete replace, alter, drop, create). Tags:
Parameters:
[ Top ]
method nativeErrorCode [line 1363]
Returns the numerical native error code from the previous DB operation or 0 (zero) if no error occured. Tags:
Overridden in child classes as:
[ Top ]
method nativeErrorMsg [line 1373]
Returns the native error text from the previous DB operation or '' (empty string) if no error occured. Tags:
Overridden in child classes as:
[ Top ]
method numCols [line 1322]
Get the number of columns (fields) in a result identifier. Tags:
Overridden in child classes as:
Parameters:
[ Top ]
method numRows [line 1333]
Get the number of rows from a result identifier. Tags:
Overridden in child classes as:
Parameters:
[ Top ]
method parseDsn [line 1219]method provides [line 281]
Tell whether a DB implementation or its backend extension supports a given feature. currently, these features are reported (see constructor of subclassing class, like Bs_MySql) 'prepare', 'pconnect', 'transactions', 'innerSelects', 'insertId', 'affectedRows', 'numRows', 'numCols' Tags:
Parameters:
[ Top ]
method quoteArgs [line 1115]
Takes a hash and returns a string for an sql query. example 1: $arr = array('name' => 'tom', 'age' => '35', 'sex' => 'm'); $sqlQuery = "UPDATE tbl SET " . $db->quoteArgs($arr, ', ') . " WHERE ID = 1"; => "UPDATE tbl SET name = 'tom', age = '35', sex = 'm' WHERE ID = 1"; example 2: $arr = array('name' => 'tom', 'age' => '35', 'sex' => 'm'); $sqlQuery = "SELECT * FROM tbl WHERE " . $db->quoteArgs($arr, ' AND '); => "SELECT * FROM tbl WHERE name = 'tom' AND age = '35' AND sex = 'm'"; Note I: $this->escapeString() is used on the $value. Note II: boolean values are converted to ints. Tags:
Parameters:
[ Top ]
method read [line 389]
Issue a select query and return a resource (or statement for oci). Tags:
Parameters:
[ Top ]
method rollback [line 1274]
Rollback last query Tags:
Overridden in child classes as:
[ Top ]
method rsRead [line 408]
Issue a select query and return an instance of Bs_ResultSet. Tags:
Parameters:
[ Top ]
method setPointer [line 1287]
Set the internal row pointer of the result id to point to the specified row number. The next fetch call would return that row. Tags:
Overridden in child classes as:
Parameters:
[ Top ]
method startTransaction [line 1254]
Starts a transaction Tags:
Overridden in child classes as:
[ Top ]
method toString [line 1028]
Returns a string with information about the current state of this db object. for security reason, no user/pass information is returned here because someone (you?) might log the returned value. Tags:
Overrides Bs_Object::toString() (Dumps the content of this object to a string using PHP's var_dump().) [ Top ]
method write [line 453]
Issue a write query (insert, update, delete, replace, drop, alter, create). Tags:
Parameters:
[ Top ]
Documentation generated on Mon, 29 Dec 2003 21:08:44 +0100 by phpDocumentor 1.2.3 |

