ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:reference:connection:autoexecute

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
v5:reference:connection:autoexecute [2018/07/16 19:25] – start functions lowercase peterddv5:reference:connection:autoexecute [2026/03/11 11:53] (current) – [Description] formatting dregad
Line 1: Line 1:
 ====== autoExecute ====== ====== autoExecute ======
-<WRAP info> +
-autoExecute is designed to provide a robust simple interface to record updating and insertion. As such, it contains multiple layers of table, column and data validation to ensure data integrity prior to record insertion or update. Consequently, there may be some performance degradation when used for large numbers of record updates. Consider using [[v5:reference:connection:execute|execute()]] for that purpose instead. +
-</WRAP>+
 ~~NOTOC~~ ~~NOTOC~~
 +
 <WRAP right box> <WRAP right box>
 == See Also == == See Also ==
 [[v5:reference:adodb_quote_fieldnames|$ADODB_QUOTE_FIELDNAMES]] [[v5:reference:adodb_quote_fieldnames|$ADODB_QUOTE_FIELDNAMES]]
 == Syntax == == Syntax ==
-    bool autoExecute(+    ADORecordSet_empty|false autoExecute(
        string $tables,        string $tables,
        string[] $arrFields,        string[] $arrFields,
Line 14: Line 13:
        optional mixed $where=false        optional mixed $where=false
        optional bool $forceUpdate=false        optional bool $forceUpdate=false
-       optional bool $dontFixQuotes=false 
        )        )
- 
 </WRAP> </WRAP>
  
  
 ===== Description ===== ===== Description =====
-The function ''autoExecute()'' can automatically generate and execute INSERT and UPDATE statements on a given table with this function, and is a wrapper for [[v5:reference:connection:getinsertsql|getInsertSQL()]] and [[v5:reference:connection:getupdatesql|getUpdateSQL()]] 
  
-autoExecute() inserts or updates `$tablegiven an array of `$arrFields`, where the keys are the field names and the array values are the field values to store. Note that there is some overhead because the table is first queried to extract key information before the SQL is generated. An INSERT or UPDATE is generated based on `$mode` (see below). +The ''autoExecute()'' function can automatically generate and execute INSERT and UPDATE statements on a given table. It is a wrapper for [[v5:reference:connection:getinsertsql|getInsertSQL()]] and [[v5:reference:connection:getupdatesql|getUpdateSQL()]] 
 + 
 +autoExecute() inserts or updates **$table** given an array of **$arrFields**, where the keys are the field names and the array values are the field values to store. An INSERT or UPDATE is generated based on **$mode** (see below).  
 + 
 +Until 5.22, the function returned a boolean value, with //true// indicating success and //false// that an error occurred. Starting with 5.23.0((https://github.com/ADOdb/ADOdb/issues/1213)), success returns an //ADORecordSet_empty// object, to be consistent with other ADOdb insert / update functions. Backwards-compatibility is guaranteed, because ADORecordSet_empty == true. 
 + 
 +<WRAP info> 
 +autoExecute() is designed to provide a simple and robust interface to record updating and insertion. As such, it contains multiple layers of table, column and data validation to ensure data integrity; in particular, the table is first queried to extract key information before the SQL is generated. This overhead causes a noticeable performance degradation when used for large numbers of record updates. Consider using [[v5:reference:connection:execute|execute()]] for that purpose instead. 
 +</WRAP> 
  
 ==== $table ==== ==== $table ====
Line 32: Line 37:
  
 ==== $mode ===== ==== $mode =====
-Legal values for `$mode` are +Legal values for ` $mode ` are 
  
 ^String^Integer^Constant^ ^String^Integer^Constant^
Line 47: Line 52:
 |true|All fields provided are updated|The constructed statement may be considerably larger| |true|All fields provided are updated|The constructed statement may be considerably larger|
    
-==== $dontFixQuotes====  
-For a description of this parameter, see [[v5:reference:connection:qstr|qStr()]] 
- 
 ==== Usage ==== ==== Usage ====
- +<code php> 
-autoExecute($table, $arrFields, $mode, $where=false, $forceUpdate=true,$magicq=false+autoExecute($table, $arrFields, $mode, $where=false, $forceUpdate=true) 
 +</code>
  
 === Insert example === === Insert example ===
v5/reference/connection/autoexecute.1531761913.txt.gz · Last modified: by peterdd