<?xml version="1.0"?><phpdoc><class name="Bs_Db" extends="Bs_Object" undoc="false" access="public" package="Db"><file>C:/usr/local/lib/php/blueshoes-4.2/core/db/Bs_Db.class.php</file><doc><author email="andrej@arn.li">andrej arn</author><inherited src="Array"/><overriden src="Array"/><description>abstract class Bs_Db.class.phpThis object is the abstract layer for Db access. It holds the basicfuctions that are DB-independent.To makes use of this object, you must extend it to a DB-specific objectlike Bs_MySql.class.php.Some collected knowledge:-------------------------o) Watch out when you make queries based on variables from a surfer.&amp;quot;SELECT * FROM table where ID=$ID&amp;quot; can easily be hacked to empty your table. Parse allvariables submitted through forms/get if they are to be used in any similar situation.Of course, the hacker would need to know the name of your table.o) In some dbms like MS-ACCESS and mssql (if you call them dbms :) can have field names withspaces. A query would look like this &amp;quot;SELECT [fieldname withspace], anotherField FROM tbl&amp;quot;.Please *NEVER* ever use that &amp;apos;feature&amp;apos;. Many dbms don&amp;apos;t support it (like mySQL); it&amp;apos;s uglyand screams for probs.dependencies: Bs_System, Bs_Date</description><shortdescription>**********************************************************************</shortdescription><version>4.0.$Revision: 1.1.1.1 $</version><copyright>blueshoes</copyright></doc><function name="&amp;getDbObject" undoc="false" access="public"><doc><author>andrej arn &amp;lt;andrej at blueshoes dot org&amp;gt;</author><author>samuel blume &amp;lt;sam at blueshoes dot org&amp;gt;</author><parameter name="$dsn" default="null" type="string">(a hash, see Bs_Form-&amp;gt;dbDsn for a description)</parameter><return name="" type="object [unknown]">(instance of a subclassed db class)</return><throws>bs_exception</throws><description>note: this is a function, not a method of a db object.if $dsn is not given or set to null, a reference to the global shared db objectwill be returned. if it does not exist, this function tries to open the connectionfor it.example:$dsn = array(&amp;apos;host&amp;apos;=&amp;gt;&amp;apos;localhost&amp;apos;, &amp;apos;port&amp;apos;=&amp;gt;3306, &amp;apos;user&amp;apos;=&amp;gt;&amp;apos;foo&amp;apos;, &amp;apos;pass&amp;apos;=&amp;gt;&amp;apos;bar&amp;apos;, &amp;apos;syntax&amp;apos;=&amp;gt;&amp;apos;mysql&amp;apos;, &amp;apos;type&amp;apos;=&amp;gt;&amp;apos;mysql&amp;apos;);$db  = &amp;getDbObject($dsn);^^ important!!!^</description><shortdescription>function to get a db object for a given dsn.</shortdescription><copyright>blueshoes.org</copyright></doc></function><function name="Bs_Db" undoc="false" access="public"><doc><return type="void"/><description/><shortdescription>constructor.</shortdescription></doc></function><function name="&amp;getDsn" undoc="false" access="public"><doc><parameter name="$key" default="NULL" type="string">if specified then only the value for the given key will be returned.</parameter><return name="" type="mixed"> (&amp;hash return the _dsnInfo-hash or mixed, depending on param $key.)</return><description/><shortdescription>Return the _dsnInfo-hash.</shortdescription></doc></function><function name="provides" undoc="false" access="public"><doc><parameter name="$feature" undoc="true"/><return name="" type="bool">whether this DB implementation supports $feature (or NULL if $feature not known).</return><description>currently, these features are reported (see constructor of subclassing class, like Bs_MySql)&amp;apos;prepare&amp;apos;, &amp;apos;pconnect&amp;apos;, &amp;apos;transactions&amp;apos;, &amp;apos;innerSelects&amp;apos;, &amp;apos;insertId&amp;apos;, &amp;apos;affectedRows&amp;apos;,&amp;apos;numRows&amp;apos;, &amp;apos;numCols&amp;apos;</description><shortdescription>Tell whether a DB implementation or its backend extension supports a given feature.</shortdescription></doc></function><function name="getNumRecords" undoc="false" access="private"><doc><parameter name="$query" type="string"/><parameter name="$ignoreLimit" default="TRUE" type="string">(opt) Default TRUE. If TRUE, a limit x,y in the given query is ignored.</parameter><return name="" type="int">the number of records</return><throws>Bs_Exception</throws><description>Example: You want to display page 5 of your search engine with 10 results (per page).So your query would look like this: &amp;quot;select * from searchEngine limit 40,10&amp;quot;.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 &amp;apos;limit&amp;apos; clause and $ignoreLimit is set to true, thelimit will be ignored...NOTE:    This method is *not* optimized. It should not be used with queries thatreturn a large amound of data. Your query is executed in real, and thenumRows() is returned.</description><shortdescription>Returns the number of records that get selected for a given query.</shortdescription></doc></function><function name="getFieldValue" undoc="false" access="public"><doc><parameter name="$theTable" type="string">The db-table to search. Can also be &amp;apos;database.table&amp;apos;.</parameter><parameter name="$fieldToSearch" type="string">The field to compare.</parameter><parameter name="$valueToSearch" type="string">The value to compare.</parameter><parameter name="$fieldToGet" type="mixed">The field name as string of which we want the value, or an array with field names.</parameter><parameter name="$caseSensitive" default="TRUE" type="string">(opt) if the compare in the db should be made case sensitive or no. default is TRUE.</parameter><return name="" type="mixed">The desired field value, whatever that is. If param $fieldToGet is an array, an array is returned here.</return><throws>bs_exception</throws><description>Example  I:$birthday = getFieldValue($theTable=&amp;apos;employees&amp;apos;, $fieldToSearch=&amp;apos;username&amp;apos;, $valueToSearch=&amp;apos;Hugentobler&amp;apos;, $fieldToGet=&amp;apos;birthday&amp;apos;)Example II:list($birthday, $phone) = getFieldValue(&amp;apos;employees&amp;apos;, &amp;apos;username&amp;apos;, &amp;apos;Hugentobler&amp;apos;, array(&amp;apos;birthday&amp;apos;, &amp;apos;phone&amp;apos;))NOTE: Only the first found record is used.</description><shortdescription>Returns 1-n db-field values.</shortdescription></doc></function><function name="read" undoc="false" access="public"><doc><see type="function">countRead()</see><parameter name="$query" type="string">A read only SQL statement.</parameter><return type="void"/><throws>Bs_Exception</throws><description/><shortdescription>Issue a select query and return a resource (or statement for oci).</shortdescription></doc></function><function name="&amp;rsRead" undoc="false" access="public"><doc><see type="function">read()</see><see type="function">countRead()</see><parameter name="$query" type="string">A read only SQL statement.</parameter><return name="" type="object an">instance of Bs_ResultSet</return><throws>Bs_Exception</throws><description/><shortdescription>Issue a select query and return an instance of Bs_ResultSet.</shortdescription></doc></function><function name="countRead" undoc="false" access="public"><doc><see type="function">read()</see><parameter name="$query" type="string">A SQL statement.</parameter><return name="" type="int">number of rows matched (0-x)</return><throws>Bs_Exception</throws><description>This method makes use of this-&amp;gt;numRows().</description><shortdescription>Issue a select query and return the number of &amp;apos;affected&amp;apos; rows.</shortdescription></doc></function><function name="write" undoc="false" access="public"><doc><see type="function">countWrite()</see><see type="function">idWrite()</see><parameter name="$query" type="string">A modifing SQL statement.</parameter><return name="" type="bool">true on success, otherwise throws an exception.</return><throws>Bs_Exception</throws><description/><shortdescription>Issue a write query (insert, update, delete, replace, drop, alter, create).</shortdescription></doc></function><function name="_vendorSpecificWriteMod" undoc="false" access="private"><doc><parameter name="$query" type="string">(write query like insert, update, delete ...)</parameter><return name="" type="string"> (the modified or unmodified query)</return><description/><shortdescription>overwrite this method if needed.</shortdescription></doc></function><function name="countWrite" undoc="false" access="public"><doc><see type="function">write()</see><see type="function">idWrite()</see><see type="function">affectedRows()</see><parameter name="$query" type="string">A modifing SQL statement.</parameter><return name="" type="int">number of rows affected</return><throws>Bs_Exception if the query was unsuccessful</throws><throws>FALSE if the count with affectedRows() failed.</throws><description>this method makes use of this-&amp;gt;affectedRows() read the doc of it!</description><shortdescription>Issue a write query (update, delete, replace) and return the number of affected rows.</shortdescription></doc></function><function name="idWrite" undoc="false" access="public"><doc><see type="function">countWrite()</see><see type="function">write()</see><see type="function">insertId()</see><parameter name="$query" type="string">A SQL statement that inserts a record.</parameter><return name="" type="int"> &amp;gt;=1</return><throws>Bs_Exception if the query failed</throws><throws>FALSE if the operation was not an insert.</throws><description>this method makes use of this-&amp;gt;insertId() read the doc of it!</description><shortdescription>Issue an insert query on a table with an auto_increment field and return the newly inserted id.</shortdescription></doc></function><function name="&amp;getOne" undoc="false" access="public"><doc><parameter name="$source" type="mixed">can be an SQL query as string, or a result set (a resource).</parameter><parameter name="$row" default="0" type="integer">the row number</parameter><parameter name="$col" default="0" type="mixed">which column to return (integer [column number, starting at 0] or string [column name])</parameter><return name="" type="mixed">just one value or NULL if row or col are out of bounds or don&amp;apos;t exsist.</return><throws>Bs_Exception on error</throws><description>$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&amp;apos;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 beused as key to identify the right column. So pass the right type!Sample: Given is the table &amp;quot;mytable&amp;quot; containing:\/ID      TEXT       DATE--------------------------------&amp;gt;    1       &amp;apos;one&amp;apos;      09.05.19602       &amp;apos;two&amp;apos;      25.12.19703       &amp;apos;three&amp;apos;    31.01.1980getOne(&amp;apos;SELECT id, teXt, date as birthday FROM mytable&amp;apos;); // would return &amp;apos;1&amp;apos;.getOne($query, 1, 2);                                     // would return &amp;apos;25.12.1970&amp;apos;.getOne($query, 2, &amp;apos;teXt&amp;apos;);                                // would return &amp;apos;two&amp;apos;.</description><shortdescription>Fetch a single value from a data amount given by the param $source.</shortdescription></doc></function><function name="&amp;getRow" undoc="false" access="public"><doc><parameter name="$source" type="mixed">can be an SQL query string, or a resource.</parameter><parameter name="$row" default="-1" type="integer">IF &amp;gt;=0 will move internal row pointer to abs. position befor fetching the data. Default is -1.</parameter><parameter name="$fetchMode" default="BS_DB_FETCHMODE_ASSOC" type="string">(opt) (default BS_DB_FETCHMODE_ASSOC) see above.</parameter><return name="" type="mixed">vector , hash.  NULL if row offest is out of bounds OR no data found.</return><throws>Bs_Exception on error</throws><description>$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 correspondsto the fetched row else if it&amp;apos;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&amp;apos;t free result set.The default behaver is to fetch current row.Sample: Given is the table &amp;quot;mytable&amp;quot; containing:ID      TEXT       DATE--------------------------------&amp;gt;    1       &amp;apos;one&amp;apos;      09.05.1960    &amp;lt;-2       &amp;apos;two&amp;apos;      25.12.19703       &amp;apos;three&amp;apos;    31.01.1980getRow(&amp;apos;SELECT id, teXt, date as birthday FROM mydate&amp;apos;); // would return array(&amp;apos;id&amp;apos;   =&amp;gt; &amp;apos;1&amp;apos;,&amp;apos;teXt&amp;apos; =&amp;gt; &amp;apos;one&amp;apos;,&amp;apos;birthday&amp;apos; =&amp;gt; &amp;apos;09.05.1960&amp;apos;);</description><shortdescription>Fetch a full row of data as vector or hash given by the param $source.</shortdescription></doc></function><function name="&amp;getCol" undoc="false" access="public"><doc><parameter name="$source" type="mixed">can be an SQL query string, or a resource.</parameter><parameter name="$col" default="0" type="mixed">which column to return (integer [column number, starting at 0] or string [column name])</parameter><parameter name="$startRow" default="0" type="integer">the row number at which we start, *including* that row. default is 0.</parameter><parameter name="$amount" default="-1" type="integer">the row number at which we stop, *including* that row. default is -1 which means loop until the end.</parameter><return type="void"/><throws>Bs_Exception on error</throws><description>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&amp;apos;t free result set.NOTE: col may be given as col-name (string) instead of offset (int). It will beused as key to identify the right column. So pass the right type!Sample: Given is the table &amp;quot;mytable&amp;quot; containing:\/ID      TEXT       DATE-------------------------------1       &amp;apos;one&amp;apos;      09.05.19602       &amp;apos;two&amp;apos;      25.12.19703       &amp;apos;three&amp;apos;    31.01.1980/\getCol(&amp;apos;SELECT id, teXt, date as birthday FROM mydate&amp;apos;, &amp;apos;teXt&amp;apos;); // would return array(&amp;apos;one&amp;apos;, &amp;apos;two&amp;apos;, &amp;apos;three&amp;apos;);If you&amp;apos;d only wand to get array(&amp;apos;two&amp;apos;, &amp;apos;three&amp;apos;) you&amp;apos;d do:getCol($query, 1, 1)  or  getCol($query, 1, 1, 2)  or  getCol($query, &amp;apos;teXt&amp;apos;, 1)</description><shortdescription>Fetch a full OR fraction col of data as vector given by the param $source.</shortdescription></doc></function><function name="&amp;getAssoc" undoc="false" access="public"><doc><parameter name="$source" type="mixed">can be an SQL query string, or a resource.</parameter><parameter name="$forceArray" default="FALSE," type="string">(opt) used only when the query returns exactly two columns.  If true, the values of the returned array will be one-element arrays instead of scalars.</parameter><parameter name="$hashInsteadOfVector" default="FALSE" type="string">(default is FALSE. if set to true then the values will be returned in a hash (with field names) instead of a vector. see example 3 above.)</parameter><return type="void"/><throws>Bs_Exception on error</throws><description>$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&amp;apos;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(&amp;apos;1&amp;apos; =&amp;gt; array(&amp;apos;one&amp;apos;,   &amp;apos;944679408&amp;apos;));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 &amp;quot;mytable&amp;quot; containing:ID      TEXT       DATE-------------------------------1       &amp;apos;one&amp;apos;      09.05.19602       &amp;apos;two&amp;apos;      25.12.19703       &amp;apos;three&amp;apos;    31.01.1980example 1:getAssoc(&amp;apos;SELECT id,text FROM mytable&amp;apos;);    // would return: array( &amp;apos;1&amp;apos; =&amp;gt; &amp;apos;one&amp;apos;,&amp;apos;2&amp;apos; =&amp;gt; &amp;apos;two&amp;apos;,&amp;apos;3&amp;apos; =&amp;gt; &amp;apos;three&amp;apos;)example 2:getAssoc(&amp;apos;SELECT id,text,date FROM mydate&amp;apos;) // would return: array( &amp;apos;1&amp;apos; =&amp;gt; array(&amp;apos;one&amp;apos;,   &amp;apos;944679408&amp;apos;),&amp;apos;2&amp;apos; =&amp;gt; array(&amp;apos;two&amp;apos;,   &amp;apos;944679408&amp;apos;),&amp;apos;3&amp;apos; =&amp;gt; array(&amp;apos;three&amp;apos;, &amp;apos;944679408&amp;apos;))example 3:getAssoc(&amp;apos;SELECT id,text,date FROM mydate&amp;apos;, TRUE, TRUE) // would return:array( &amp;apos;1&amp;apos; =&amp;gt; array(&amp;apos;text&amp;apos;=&amp;gt;&amp;apos;one&amp;apos;,   &amp;apos;date&amp;apos;=&amp;gt;&amp;apos;944679408&amp;apos;),&amp;apos;2&amp;apos; =&amp;gt; array(&amp;apos;text&amp;apos;=&amp;gt;&amp;apos;two&amp;apos;,   &amp;apos;date&amp;apos;=&amp;gt;&amp;apos;944679408&amp;apos;),&amp;apos;3&amp;apos; =&amp;gt; array(&amp;apos;text&amp;apos;=&amp;gt;&amp;apos;three&amp;apos;, &amp;apos;date&amp;apos;=&amp;gt;&amp;apos;944679408&amp;apos;))this option is new, 2002/03/25 --andrejspecial note: you have to use a key that is unique. otherwise only one record will beused, i think the later ones overwrite the previews.</description><shortdescription>Fetch the entire data given by the param $source into a hash using the first column as the key.</shortdescription></doc></function><function name="&amp;getAssoc2" undoc="false" access="public"><doc><parameter name="$source" type="mixed">can be an SQL query string, or a resource.</parameter><parameter name="$forceArray" default="FALSE" type="string">used only when the query returns exactly 1 column.  If true, the values of the returned array will be one-element arrays instead of scalars.</parameter><return type="void"/><throws>Bs_Exception on error</throws><description>The rest is like getAssoc(). See above.Sample: Given is the table &amp;quot;mytable&amp;quot; containing:ID      TEXT       DATE-------------------------------1       &amp;apos;one&amp;apos;      09.05.19602       &amp;apos;two&amp;apos;      25.12.19703       &amp;apos;three&amp;apos;    31.01.1980getAssoc2(&amp;apos;SELECT id, teXt, date as birthday FROM mytable&amp;apos;);would return:array( &amp;apos;id&amp;apos;       =&amp;gt; array(&amp;apos;1&amp;apos;, &amp;apos;2&amp;apos;,   &amp;apos;3&amp;apos;),&amp;apos;teXt&amp;apos;     =&amp;gt; array(&amp;apos;one&amp;apos;, &amp;apos;two&amp;apos;,   &amp;apos;three&amp;apos;),&amp;apos;birthday&amp;apos; =&amp;gt; array(&amp;apos;09.05.1960&amp;apos;, &amp;apos;25.12.1970&amp;apos;, &amp;apos;31.01.1980&amp;apos;))</description><shortdescription>hash array COLUMN BY COLUMN not record by record.</shortdescription></doc></function><function name="&amp;getAll" undoc="false" access="public"><doc><parameter name="$source" type="mixed">can be an SQL query string, or a resource.</parameter><parameter name="$fetchMode" default="BS_DB_FETCHMODE_ASSOC" type="string">(opt) (default BS_DB_FETCHMODE_ASSOC) see getRow.</parameter><return name="" type="array">a nested array. See sample above. may be an empty array if nothing was found.</return><throws>Bs_Exception on error</throws><description>$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&amp;apos;t free result set.Sample: Given is the table &amp;quot;mytable&amp;quot; containing:ID      TEXT       DATE-------------------------------1       &amp;apos;one&amp;apos;      09.05.19602       &amp;apos;two&amp;apos;      25.12.19703       &amp;apos;three&amp;apos;    31.01.1980getAll(&amp;apos;SELECT id, teXt, date as birthday FROM mydate&amp;apos;, &amp;apos;teXt&amp;apos;, BS_DB_FETCHMODE_ASSOC) returns:would return:array( array(&amp;apos;id&amp;apos; =&amp;gt; &amp;apos;1&amp;apos;, &amp;apos;teXt&amp;apos; =&amp;gt; &amp;apos;one&amp;apos;,   &amp;apos;birthday&amp;apos; =&amp;gt; &amp;apos;09.05.1960&amp;apos;),array(&amp;apos;id&amp;apos; =&amp;gt; &amp;apos;2&amp;apos;, &amp;apos;teXt&amp;apos; =&amp;gt; &amp;apos;two&amp;apos;,   &amp;apos;birthday&amp;apos; =&amp;gt; &amp;apos;25.12.1970&amp;apos;),array(&amp;apos;id&amp;apos; =&amp;gt; &amp;apos;3&amp;apos;, &amp;apos;teXt&amp;apos; =&amp;gt; &amp;apos;three&amp;apos;, &amp;apos;birthday&amp;apos; =&amp;gt; &amp;apos;31.01.1980&amp;apos;))</description><shortdescription>Fetch the entire data given by the param $source into a hash.</shortdescription></doc></function><function name="assertExtension" undoc="false" access="public"><doc><parameter name="$name" undoc="true"/><return name="" type="bool">true if the extension was already or successfully loaded, false if it could not be loaded</return><description/><shortdescription>Load a PHP database extension if it is not loaded already.</shortdescription></doc></function><function name="toString" undoc="true" access="public"><doc><return name="" type="string"/><overriden src="Bs_Object"/><description>for security reason, no user/pass information is returned here because someone(you?) might log the returned value.</description><shortdescription>Returns a string with information about the current state of this db object.</shortdescription></doc></function><function name="escapeString" undoc="false" access="public"><doc><parameter name="$query" type="string"/><return name="" type="string">the escaped query</return><description>if there is a better/specialized way for your specific rdbms, overwrite this.</description><shortdescription>Escape string for the query.</shortdescription></doc></function><function name="formatDateForDb" undoc="false" access="public"><doc><see type="function">formatDatetimeForDb()</see><see type="function">formatTimestampForDb()</see><parameter name="$date" type="string">(yyyy-mm-dd)</parameter><return name="" type="string"> (date formatted for this rdbms implementation)</return><description>overwrite this if needed.</description><shortdescription>format and return date string in database date format.</shortdescription></doc></function><function name="formatDatetimeForDb" undoc="false" access="public"><doc><see type="function">formatDateForDb()</see><see type="function">formatTimestampForDb()</see><parameter name="$datetime" type="string">(yyyy-mm-dd hh:mm:ss)</parameter><return name="" type="string"> (datetime formatted for this rdbms implementation)</return><description>overwrite this if needed.</description><shortdescription>format and return datetime string in database datetime format.</shortdescription></doc></function><function name="formatTimestampForDb" undoc="false" access="public"><doc><see type="function">formatDateForDb()</see><see type="function">formatDatetimeForDb()</see><parameter name="$timestamp" type="string">(yyyy-mm-dd hh:mm:ss)</parameter><return name="" type="string"> (timestamp formatted for this rdbms implementation)</return><description>overwrite this if needed.</description><shortdescription>format and return timestamp string in database timestamp format.</shortdescription></doc></function><function name="&amp;quoteArgs" undoc="false" access="public"><doc><parameter name="$arr" type="array">an associative array.</parameter><parameter name="$glue" default="&amp;apos;, &amp;apos;" type="string">a delimiter, default is &amp;apos;, &amp;apos;, could be &amp;apos; AND &amp;apos; or &amp;apos; OR &amp;apos; ...</parameter><return name="" type="string">a string to include in an sql query.</return><description>example 1:$arr = array(&amp;apos;name&amp;apos; =&amp;gt; &amp;apos;tom&amp;apos;, &amp;apos;age&amp;apos; =&amp;gt; &amp;apos;35&amp;apos;, &amp;apos;sex&amp;apos; =&amp;gt; &amp;apos;m&amp;apos;);$sqlQuery = &amp;quot;UPDATE tbl SET &amp;quot; . $db-&amp;gt;quoteArgs($arr, &amp;apos;, &amp;apos;) . &amp;quot; WHERE ID = 1&amp;quot;;=&amp;gt; &amp;quot;UPDATE tbl SET name = &amp;apos;tom&amp;apos;, age = &amp;apos;35&amp;apos;, sex = &amp;apos;m&amp;apos;  WHERE ID = 1&amp;quot;;example 2:$arr = array(&amp;apos;name&amp;apos; =&amp;gt; &amp;apos;tom&amp;apos;, &amp;apos;age&amp;apos; =&amp;gt; &amp;apos;35&amp;apos;, &amp;apos;sex&amp;apos; =&amp;gt; &amp;apos;m&amp;apos;);$sqlQuery = &amp;quot;SELECT * FROM tbl WHERE &amp;quot; . $db-&amp;gt;quoteArgs($arr, &amp;apos; AND &amp;apos;);=&amp;gt; &amp;quot;SELECT * FROM tbl WHERE name = &amp;apos;tom&amp;apos; AND age = &amp;apos;35&amp;apos; AND sex = &amp;apos;m&amp;apos;&amp;quot;;Note  I: $this-&amp;gt;escapeString() is used on the $value.Note II: boolean values are converted to ints.</description><shortdescription>Takes a hash and returns a string for an sql query.</shortdescription></doc></function><function name="isManipulation" undoc="false" access="public"><doc><parameter name="$query" type="string">query</parameter><return type="void"/><description/><shortdescription>Tells whether a query is a data manipulation query (insert, update, delete replace, alter, drop, create).</shortdescription></doc></function><function name="&amp;_raiseError" undoc="false" access="private"><doc><parameter name="$code" default="BS_DB_ERROR," type="string"/><parameter name="$nativeCode" default="NULL," type="string"/><parameter name="$msg" default="NULL," type="string">a custom error message. if not specified, the var $_lastQuery will be used here.</parameter><parameter name="$file" default="&amp;apos;&amp;apos;" type="string">(use __FILE__)</parameter><parameter name="$line" default="&amp;apos;&amp;apos;" type="string">(use __LINE__)</parameter><parameter name="$weight" default="&amp;apos;&amp;apos;" type="string">(&amp;apos;fatal&amp;apos;)</parameter><return type="void"/><description/><shortdescription>This method is called by DB to generate an error.</shortdescription></doc></function><function name="getErrorMessage" undoc="false" access="public"><doc><parameter name="$errCode" type="long">a bs error code (see constants)</parameter><return name="" type="string">error message, or false if the error code was not recognized</return><description/><shortdescription>Return a textual error message for a bs DB error code</shortdescription></doc></function><function name="parseDsn" undoc="false" access="private"><doc><parameter name="$dsn" undoc="true"/><return type="void"/><description/><shortdescription/></doc></function><function name="_query" undoc="false" access="private"><doc><parameter name="$query" type="string">the SQL query</parameter><return type="void"/><description>NOTE: This is so fundemental that we exit with error, if this function is not overloaded.</description><shortdescription>Send a query to the DB and return the result.</shortdescription></doc></function><function name="autoCommit" undoc="false" access="public"><doc><parameter name="$on" default="FALSE" type="string">(opt) If TRUE turn on else off (default TRUE)</parameter><return type="void"/><throws>Bs_Exception  if not supported by this DB</throws><description/><shortdescription>Turn autoCommit on or off</shortdescription></doc></function><function name="startTransaction" undoc="false" access="public"><doc><return type="void"/><throws>Bs_Exception if not supported by this DB or on any other error.</throws><description/><shortdescription>Starts a transaction</shortdescription></doc></function><function name="commit" undoc="false" access="public"><doc><return type="void"/><throws>Bs_Exception if not supported by this DB or on any other error.</throws><description/><shortdescription>Commit last query</shortdescription></doc></function><function name="rollback" undoc="false" access="public"><doc><return type="void"/><throws>Bs_Exception if not supported by this DB or on any other error.</throws><description/><shortdescription>Rollback last query</shortdescription></doc></function><function name="setPointer" undoc="false" access="public"><doc><parameter name="$result" type="int">the row number, which starts at position 0.</parameter><parameter name="$absolutPos" undoc="true"/><return name="" type="mixed">TRUE on success, NULL on a row number (param $num) that is out of bounds.</return><throws>Bs_Exception if not supported by this DB or on any other error.</throws><description>The next fetch call would return that row.</description><shortdescription>Set the internal row pointer of the result id to point to the specified row number.</shortdescription></doc></function><function name="fetchRow" undoc="false" access="public"><doc><parameter name="$result" undoc="true"/><parameter name="$fetchMode" type="string" undoc="true"/><return name="" type="mixed">vector , hash or NULL if there is no more data</return><throws>Bs_Exception if not supported by this DB or any other error.</throws><description>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 correspondsto the fetched row else if it&amp;apos;s BS_DB_FETCHMODE_ORDERED returns a vector starting at offset 0.</description><shortdescription>Fetch a row and return it as vector or hash depending on the fetchMode.</shortdescription></doc></function><function name="freeResult" undoc="false" access="public"><doc><parameter name="$result" undoc="true"/><return type="void"/><description/><shortdescription>Free the internal resources associated with $result.</shortdescription></doc></function><function name="numCols" undoc="false" access="public"><doc><parameter name="$result" undoc="true"/><return name="" type="int">the number of columns per row in $result</return><throws>Bs_Exception if not supported by this DB or any other error.</throws><description/><shortdescription>Get the number of columns (fields) in a result identifier.</shortdescription></doc></function><function name="numRows" undoc="false" access="public"><doc><parameter name="$result" undoc="true"/><return name="" type="int">see above</return><throws>Bs_Exception if not supported by this DB or any other error.</throws><description/><shortdescription>Get the number of rows from a result identifier.</shortdescription></doc></function><function name="affectedRows" undoc="false" access="public"><doc><return name="" type="int">see above</return><throws>Bs_Exception if not supported by this DB or any other error.</throws><description/><shortdescription>Gets the number of rows affected by the last data manipulation query.</shortdescription></doc></function><function name="insertId" undoc="false" access="public"><doc><return name="" type="int">a positive integer, which means &amp;gt;=1</return><throws>Bs_Exception if not supported by this DB or any other error.</throws><description/><shortdescription>Get the id generated from the previous INSERT operation.</shortdescription></doc></function><function name="nativeErrorCode" undoc="false" access="public"><doc><return name="" type="int">see above</return><throws>Bs_Exception if not supported by this DB or any other error.</throws><description/><shortdescription>Returns the numerical native error code from the previous DB operation or 0 (zero) if no error occured.</shortdescription></doc></function><function name="nativeErrorMsg" undoc="false" access="public"><doc><return name="" type="string">see above</return><throws>Bs_Exception if not supported by this DB or any other error.</throws><description/><shortdescription>Returns the native error text from the previous DB operation or &amp;apos;&amp;apos; (empty string) if no error occured.</shortdescription></doc></function><function name="_disconnect" undoc="false" access="private"><doc><parameter name="$disconnectFunctionName" type="string"/><return name="" type="bool">TRUE if we already have been or are now disconnected, FALSE if we&amp;apos;re on a persistant conn.</return><throws>NULL if we cannot tell in which state the connection is now. internally for this object</throws><throws>the connection is &amp;apos;closed&amp;apos;.</throws><description>Note: p-connected links won&amp;apos;t be closed.</description><shortdescription>Log out and disconnect from the database.</shortdescription></doc></function><function name="fetchDbNames" undoc="true" access="private"><doc><parameter name="$cached" type="string" undoc="true"/><return type="void"/></doc></function><function name="listFields" undoc="true" access="private"><doc><return type="void"/></doc></function><variable name="$_connection" access="private" type="string">NULL<doc><description/><shortdescription>a reference to a real db connection</shortdescription></doc></variable><variable name="$_connected" access="private" type="string">FALSE<doc><description/><shortdescription>Tells whether we&amp;apos;re connected.</shortdescription></doc></variable><variable name="$_persistent" access="private" type="string">FALSE<doc><description/><shortdescription>Tells whether we&amp;apos;re on a persistant connection.</shortdescription></doc></variable><variable name="$_dsnInfo" access="private" type="string">NULL<doc><description>&amp;apos;name&amp;apos;     =&amp;gt; db name     &amp;apos;pass&amp;apos;    =&amp;gt; letmein&amp;apos;host&amp;apos;     =&amp;gt; localhost   &amp;apos;socket&amp;apos;  =&amp;gt; a unix socket&amp;apos;port&amp;apos;     =&amp;gt; 6667        &amp;apos;syntax&amp;apos;  =&amp;gt; mysql&amp;apos;user&amp;apos;     =&amp;gt; root        &amp;apos;type&amp;apos;    =&amp;gt; mysql&amp;apos;tns&amp;apos;      =&amp;gt; identifier for oracleDB type (mysql, oci8, odbc etc.)Db syntax (mysql, access, oracle, ...)</description><shortdescription>associative array holding the db-conn info in these fields:</shortdescription></doc></variable><variable name="$_lastQuery" access="private" type="string">NULL<doc><description/><shortdescription>the last executed query.</shortdescription></doc></variable><variable name="$Bs_Date" access="public" type="object [unknown]"><doc><description/><shortdescription>reference to the globally used pseudostatic Bs_Date object.</shortdescription></doc></variable><variable name="$_Bs_System" access="private" type="string">NULL<doc><description>They make use of _Bs_System-&amp;gt;isWindows() function.</description><shortdescription>A few functions are system dependent like assertExtension() and the subclassed Bs_MySql.</shortdescription></doc></variable><variable name="$_features" access="private" type="string">NULL<doc><description>with the elements&amp;apos;prepare&amp;apos;      =&amp;gt; bool&amp;apos;pconnect&amp;apos;     =&amp;gt; bool&amp;apos;transactions&amp;apos; =&amp;gt; bool&amp;apos;innerSelects&amp;apos; =&amp;gt; bool&amp;apos;insertId&amp;apos;     =&amp;gt; bool&amp;apos;affectedRows&amp;apos; =&amp;gt; bool&amp;apos;numRows&amp;apos;      =&amp;gt; bool&amp;apos;numCols&amp;apos;      =&amp;gt; bool&amp;apos;storedProc&amp;apos;   =&amp;gt; bool</description><shortdescription>Associative array of capabilities for this DB implementation</shortdescription></doc></variable><variable name="$format" access="public" type="array">array(&#x0a;    &amp;apos;date&amp;apos;       =&amp;gt; &amp;quot;&amp;apos;Y-m-d&amp;apos;&amp;quot;,       //no escapeString() will be used on that.&#x0a;    &amp;apos;datetime&amp;apos;   =&amp;gt; &amp;quot;&amp;apos;Y-m-d H:i:s&amp;apos;&amp;quot;, //no escapeString() will be used on that.&#x0a;    &amp;apos;timestamp&amp;apos;  =&amp;gt; &amp;quot;&amp;apos;YmdHis&amp;apos;&amp;quot;,      //no escapeString() will be used on that.&#x0a;  )<doc><see type="function">formatDateForDb()</see><see type="function">formatDatetimeForDb()</see><see type="function">formatTimestampForDb()</see><description/><shortdescription>some database specific formats. please overwrite.</shortdescription></doc></variable><constant name="BS_DB_FETCHMODE_ORDERED" undoc="false" access="private" case="default: case sensitive">1<doc><description/><shortdescription>Column data indexed by numbers, ordered from 0 and up</shortdescription></doc></constant><constant name="BS_DB_FETCHMODE_ASSOC" undoc="false" access="private" case="default: case sensitive">2<doc><description/><shortdescription>Column data indexed by column names</shortdescription></doc></constant><constant name="BS_DB_VERSION" undoc="true" access="private" case="default: case sensitive">4.0.$x$<doc></doc></constant><constant name="BS_DB_ERROR" undoc="true" access="private" case="default: case sensitive">1<doc></doc></constant><constant name="BS_DB_ERROR_SYNTAX" undoc="true" access="private" case="default: case sensitive">2<doc></doc></constant><constant name="BS_DB_ERROR_CONSTRAINT" undoc="true" access="private" case="default: case sensitive">3<doc></doc></constant><constant name="BS_DB_ERROR_NOT_FOUND" undoc="true" access="private" case="default: case sensitive">4<doc></doc></constant><constant name="BS_DB_ERROR_ALREADY_EXISTS" undoc="true" access="private" case="default: case sensitive">5<doc></doc></constant><constant name="BS_DB_ERROR_UNSUPPORTED" undoc="true" access="private" case="default: case sensitive">6<doc></doc></constant><constant name="BS_DB_ERROR_MISMATCH" undoc="true" access="private" case="default: case sensitive">7<doc></doc></constant><constant name="BS_DB_ERROR_INVALID" undoc="true" access="private" case="default: case sensitive">8<doc></doc></constant><constant name="BS_DB_ERROR_NOT_CAPABLE" undoc="true" access="private" case="default: case sensitive">9<doc></doc></constant><constant name="BS_DB_ERROR_TRUNCATED" undoc="true" access="private" case="default: case sensitive">10<doc></doc></constant><constant name="BS_DB_ERROR_INVALID_NUMBER" undoc="true" access="private" case="default: case sensitive">11<doc></doc></constant><constant name="BS_DB_ERROR_INVALID_DATE" undoc="true" access="private" case="default: case sensitive">12<doc></doc></constant><constant name="BS_DB_ERROR_DIVZERO" undoc="true" access="private" case="default: case sensitive">13<doc></doc></constant><constant name="BS_DB_ERROR_NODBSELECTED" undoc="true" access="private" case="default: case sensitive">14<doc></doc></constant><constant name="BS_DB_ERROR_CANNOT_CREATE" undoc="true" access="private" case="default: case sensitive">15<doc></doc></constant><constant name="BS_DB_ERROR_CANNOT_DELETE" undoc="true" access="private" case="default: case sensitive">16<doc></doc></constant><constant name="BS_DB_ERROR_CANNOT_DROP" undoc="true" access="private" case="default: case sensitive">17<doc></doc></constant><constant name="BS_DB_ERROR_NOSUCHTABLE" undoc="true" access="private" case="default: case sensitive">18<doc></doc></constant><constant name="BS_DB_ERROR_NOSUCHFIELD" undoc="true" access="private" case="default: case sensitive">19<doc></doc></constant><constant name="BS_DB_ERROR_NEED_MORE_DATA" undoc="true" access="private" case="default: case sensitive">20<doc></doc></constant><constant name="BS_DB_ERROR_NOT_LOCKED" undoc="true" access="private" case="default: case sensitive">21<doc></doc></constant><constant name="BS_DB_ERROR_VALUE_COUNT_ON_ROW" undoc="true" access="private" case="default: case sensitive">22<doc></doc></constant><constant name="BS_DB_ERROR_INVALID_DSN" undoc="true" access="private" case="default: case sensitive">23<doc></doc></constant><constant name="BS_DB_ERROR_CONNECT_FAILED" undoc="true" access="private" case="default: case sensitive">24<doc></doc></constant><constant name="BS_DB_ERROR_CANNOT_SELECT_DB" undoc="true" access="private" case="default: case sensitive">25<doc></doc></constant><constant name="BS_DB_ERROR_NOT_CONNECTED" undoc="true" access="private" case="default: case sensitive">26<doc></doc></constant><constant name="BS_DB_ERROR_INVALID_RS" undoc="true" access="private" case="default: case sensitive">27<doc></doc></constant><inherited src="Bs_Object" type="functions"><element>isex</element><element>isexception</element><element>tohtml</element><element>persist</element><element>unpersist</element><element>bs_object</element><element>bbsetoutput</element><element>bbawake</element><element>bbisawake</element><element>bbxmsg</element><element>bbxfunctionstart</element><element>bbxfunctionend</element><element>bbxecho</element><element>bbxvar</element><element>bbxvardump</element><element>bbforcetrace</element><element>bbbufferstart</element><element>bbbufferget</element><element>bbbufferendflush</element><element>bbbufferendclean</element></inherited><inherited src="Bs_Object" type="consts"><element>bs_object_version</element></inherited><path><parent>Bs_Object</parent></path><baseclass>Bs_Object</baseclass><subclasses><subclass>Bs_MsSql</subclass><subclass>Bs_MySql</subclass><subclass>Bs_Oci</subclass></subclasses></class></phpdoc>