ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:reference:connection:getinsertsql

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
v5:reference:connection:getinsertsql [2016/03/23 14:26]
dregad [$recordSet] fix broken link
v5:reference:connection:getinsertsql [2016/03/23 14:39]
dregad [$recordSet] clarify usage of table name, reworded and reformat
Line 21: Line 21:
 ===== Parameters ===== ===== Parameters =====
 ====  $recordSet ==== ====  $recordSet ====
-The parameter ''​$recordSet''​ is either ​a recordset obtained by [[v5:​reference:​connection:​execute|executing]] a select statement to obtain an **empty recordset**. There is no need to read the row.+The parameter ''​$recordSet''​ is either ​
  
-<code php>+  * a //​recordset//​ obtained by [[v5:​reference:​connection:​execute|executing]] a select statement to obtain an **empty recordset**. There is no need to read the row. <code php>
 $SQL = "​SELECT * FROM employees WHERE emp_no=-1";​ $SQL = "​SELECT * FROM employees WHERE emp_no=-1";​
 $result = $db->​execute($SQL);​ $result = $db->​execute($SQL);​
 $sql = $db->​getInsertSql($result,​..... $sql = $db->​getInsertSql($result,​.....
 </​code>​ </​code>​
-or +  ​ 
-<code php>+  * a //string// specifying a table name <code php>
 $table = '​employees';​ $table = '​employees';​
 $sql = $db->​getInsertSql($table,​.... $sql = $db->​getInsertSql($table,​....
-</​code>​ +</​code>​ Note that in this casedue to the fact that the function passes the table name by reference, the following syntax is //not valid//: <code php>
-Note that in the second instancebecause ​the function passes the table name by reference, the following syntax is not valid+
-<code php>+
 /* /*
  * Incorrect syntax  * Incorrect syntax
  */  */
 $sql = $db->​getInsertSql('​employees',​.... $sql = $db->​getInsertSql('​employees',​....
-</​code>​ +</​code>​ Also note that this usage causes ​ADOdb to read the recordset information for itself, ​which may cause performance issues.
- +
-Also note that in the second example, ​ADOdb must attempt ​to read the recordset information for itself, ​and there may be performance issues.+
  
 ==== $fieldArray ==== ==== $fieldArray ====
v5/reference/connection/getinsertsql.txt · Last modified: 2016/03/23 19:15 by dregad