v5:reference:connection:autoexecute
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
reference:autoexecute [2015/12/19 17:23] – mnewnham | v5:reference:connection:autoexecute [2021/01/25 03:07] (current) – mnewnham | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== 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, | ||
+ | </ | ||
+ | ~~NOTOC~~ | ||
+ | <WRAP right box> | ||
+ | == See Also == | ||
+ | [[v5: | ||
+ | == Syntax == | ||
+ | bool autoExecute( | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | ) | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Description ===== | ||
+ | The function '' | ||
+ | |||
+ | autoExecute() inserts or updates **$table** given an array of **$arrFields**, | ||
+ | |||
+ | ==== $table ==== | ||
+ | The name of the table to update | ||
+ | |||
+ | ==== $arrFields ==== | ||
+ | An associative array of field=> | ||
+ | |||
+ | ==== $mode ===== | ||
+ | Legal values for ` $mode ` are | ||
+ | |||
+ | ^String^Integer^Constant^ | ||
+ | |INSERT|1|DB_AUTOQUERY_INSERT| | ||
+ | |UPDATE|2|DB_AUTOQUERY_UPDATE| | ||
+ | |||
+ | ==== $where ==== | ||
+ | The $where clause is required if $mode == ' | ||
+ | |||
+ | ==== $forceUpdate ==== | ||
+ | |||
+ | ^Value^Description^Overhead^ | ||
+ | |false|(default). Only fields that have been modified are updated|The database record is re-read before update| | ||
+ | |true|All fields provided are updated|The constructed statement may be considerably larger| | ||
+ | |||
+ | ==== Usage ==== | ||
+ | <code php> | ||
+ | autoExecute($table, | ||
+ | </ | ||
+ | |||
+ | === Insert example === | ||
+ | <code php> | ||
+ | $table | ||
+ | $record[" | ||
+ | $record[" | ||
+ | |||
+ | $conn-> | ||
+ | |||
+ | /* | ||
+ | * result executes " | ||
+ | */ | ||
+ | </ | ||
+ | |||
+ | === Update example === | ||
+ | <code php> | ||
+ | $table | ||
+ | $record[" | ||
+ | $record[" | ||
+ | $where | ||
+ | |||
+ | $conn-> | ||
+ | |||
+ | /* | ||
+ | * result executes " | ||
+ | */ | ||
+ | </ | ||
+ | |||
+ | In situations where the table names contain certain special characters, such as dashes, the [[v5: | ||
+ | |||
+ | <code php> | ||
+ | $ADODB_QUOTE_FIELDNAMES = ' | ||
+ | $table | ||
+ | $record[" | ||
+ | $record[" | ||
+ | $where | ||
+ | |||
+ | $conn-> | ||
+ | |||
+ | /* | ||
+ | * result executes " | ||
+ | */ | ||
+ | </ |