Recent changes

2013-04-14 2013-04-02 2013-02-17 2013-01-29 2013-01-20 2013-01-18 2012-12-08 2012-11-06 2012-09-04 2012-08-02

php/ADOdb/Document

ADOdb Methods

Replace

Replace($table, $fieldArray, $keyCol, $autoQuote=false, $has_autoinc=false)

Insert or replace a single record <blockquote> Note: this is not the same as MySQL's replace. ADOdb's Replace() uses update-insert semantics, not insert-delete-duplicates of MySQL. Also note that no table locking is done currently, so it is possible that the record be inserted twice by two programs...

$this->Replace('products', array('prodname' =>"'Nails'","price" => 3.99), 'prodname');

$table table name
$fieldArray associative array of data (you must quote strings yourself)
$keyCol the primary key field name or if compound key, array of field names
autoQuote set to true to use a hueristic to quote strings. Works with nulls and numbers but does not work with dates nor SQL functions.
has_autoinc the primary key is an auto-inc field, so skip in insert.

Currently blob replace not supported returns 0 = fail, 1 = update, 2 = insert </blockquote>

GetInsertSQL

GetInsertSQL <blockquote> GetInsertSQL(&$rs, $arrFields,$magicq=false,$forcenulls=false)

Generate SQL to insert into a table given a recordset $rs. Requires the query to be associative. $magicq is used to indicate whether magic quotes are enabled (for qstr()).

Since 2.42, you can pass a table name instead of a recordset into GetInsertSQL (in $rs), and it will generate an insert statement for that table.

Since 4.52, we allow you to pass the $force type parameter, and this overrides the $ADODB_FORCE_TYPE global variable. </blockquote>

Result Class

RecordCount()

Record Count <blockquote> Returns the number of rows in the record set. If the number of records returned cannot be determined from the database driver API, we will buffer all rows and return a count of the rows after all the records have been retrieved. This buffering can be disabled (for performance reasons) by setting the global variable $ADODB_COUNTRECS = false. When disabled, RecordCount( ) will return -1 for certain databases. See the supported databases list above for more details.

RowCount is a synonym for RecordCount. </blockquote>