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
reference:autoexecute [2015/12/04 17:03] mnewnhamv5:reference:connection:autoexecute [2021/01/25 03:07] (current) mnewnham
Line 1: Line 1:
 ====== autoExecute ====== ====== autoExecute ======
 <WRAP info> <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 [[reference:execute|execute()]] for that purpose instead+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> +
-<WRAP info> +
-Some of the default behaviours of autoExecute have changed in ADOdb Version 6. See the section on [[dictionary:metaCasing]].+
 </WRAP> </WRAP>
 ~~NOTOC~~ ~~NOTOC~~
 <WRAP right box> <WRAP right box>
 == See Also == == See Also ==
-[[reference:adodb_quote_fieldnames|$ADODB_QUOTE_FIELDNAMES]]+[[v5:reference:adodb_quote_fieldnames|$ADODB_QUOTE_FIELDNAMES]]
 == Syntax == == Syntax ==
     bool autoExecute(     bool autoExecute(
Line 17: Line 14:
        optional mixed $where=false        optional mixed $where=false
        optional bool $forceUpdate=false        optional bool $forceUpdate=false
-       optional bool $dontFixQuotes=false 
        )        )
  
Line 24: Line 20:
  
 ===== 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 [[reference:GetInsertSQL|GetInsertSQL()]] and [[reference:GetUpdateSQL|GetUpdateSQL()]]+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). +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. 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). 
  
 ==== $table ==== ==== $table ====
Line 35: Line 31:
  
 ==== $mode ===== ==== $mode =====
-Legal values for `$mode` are +Legal values for ` $mode ` are 
  
 ^String^Integer^Constant^ ^String^Integer^Constant^
Line 50: Line 46:
 |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 [[reference: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 ===
Line 64: Line 57:
 $record["last_name" = "Smith";  $record["last_name" = "Smith"; 
  
-$conn->AutoExecute($table,$record,'INSERT');+$conn->autoExecute($table,$record,'INSERT');
  
 /* /*
Line 78: Line 71:
 $where               = "last_name like 'Sm%'"; $where               = "last_name like 'Sm%'";
  
-$conn->AutoExecute($table,$record,'UPDATE', $where);+$conn->autoExecute($table,$record,'UPDATE', $where);
  
 /* /*
Line 85: Line 78:
 </code> </code>
  
-In situations where the table names contain certain special characters, such as dashes, the [[reference:adodb_quote_fieldnames|$ADODB_QUOTE_FIELDNAMES]] setting can be used to wrap the table and field names.+In situations where the table names contain certain special characters, such as dashes, the [[v5:reference:adodb_quote_fieldnames|$ADODB_QUOTE_FIELDNAMES]] setting can be used to wrap the table and field names.
  
 <code php> <code php>
Line 94: Line 87:
 $where               = "last_name like 'Sm%'"; $where               = "last_name like 'Sm%'";
  
-$conn->AutoExecute($table,$record,'UPDATE', $where);+$conn->autoExecute($table,$record,'UPDATE', $where);
  
 /* /*
v5/reference/connection/autoexecute.txt · Last modified: 2021/01/25 03:07 by mnewnham