Set oRecordset = oDb.DbExecute(sId, sCommand, sParams)
|sId||(String) Unique identifier that is used by the PmaAdo object to store the result data in the form of AdoRecordset. |
If an empty string ("") is used, then the SQL statement is executed and the data is returned in the form of the AdoRecordset object, but the PmaAdo object will not store it. This is handy if it is necessary to execute some SQL query in the script and process the resulting data immediately, and release the AdoRecordset object right after that.
Empty string is also entered if entered statement does not return the resulting data.
|sCommand||(String) Usualy, it is a SQL syntax statement (INSERT, UPDATE, DELETE, etc.), that does not return any data in the form of the AdoRecordset object. |
It can also return the data in the form of the AdoRecordset object containing SQL query SELECT, table name, calling the saved procedure, name or URL address of the file containing the saved AdoRecordset object.
|sParams||(String) Additional parameters of the DbExecute method. Entries are in KeyVal format, for example "command:text;execute:norecords;return:map;".|
"command:xxx;" (optional) - Specifies how the corresponding ADO Provider evaluates the sSource parameter, especially if it contains something different than SQL language syntax query/statement (e.g. SELECT, INSERT, etc.).
text (default) - Specifies that the ADO Provider should evaluate the sSource parameter as a textual definition of a command. Corresponds to the ADO adCmdText value.
table - Specifies that the ADO Provider should generate an SQL query to return all records from the table named in the sSource parameter. Corresponds to the ADO adCmdTable value.
storedproc - Specifies that the ADO Provider should evaluate the sSource parameter as a stored procedure. Corresponds to the ADO adCmdStoredProc value.
file - Specifies that a persisted (saved) AdoRecordset object should be restored from the file named in the sSource parameter. Corresponds to the ADO adCmdFile value.
tabledirect - Specifies that the ADO Provider should return all records from the table named in the sSource parameter. Corresponds to the ADO adCmdTableDirect value.
unknown - Specifies that the type of command in the sSource parameter is not known. The ADO Provider will try to evaluate it, but it will just consume more time. Corresponds to the ADO adCmdUnknown value.
"execute:xxx;" (optional) - Specifies the corresponding ADO Provider how to execute the SQL query. The default mode is the synchronous query, i.e. the method waits for the operation result.
async - Asynchronous query, i.e. the method does not wait for the operation result. Corresponds to the ADO adAsyncExecute value.
asyncfetch - Specifies that the rows defined by the ADO Recordset.CacheSize property are to be read synchronously and any remaining records should be fetched asynchronously. Corresponds to the ADO adAsyncFetch value.
asyncfetchnonblocking - Specifies that the main thread will never be blocked while reading is being processed. If the requested row is not read, then the cursor will be moved to the end. Corresponds to the ADO adAsyncFetchNonBlocking value.
record - Specifies that the called query/statement returns a single row, that has the form of the AdoRecord object. Corresponds to the ADO adExecuteRecord value.
"return:xxx;" (optional) - Specifies whether the method returned value is a map containing multiple values (new procedure) or a single value (old procedure). If not set, then the old procedure is used.
map - Returns a map (PmMap) containing multiple returned values (new procedure) (e.g. Result, AffectedRows, ErrorCode, ErrorText).
Depending on the specific ADO Provider it is possible, that a single row SQL query result will not be returned in the form of the AdoRecordset object containing a single record, but in the form of the AdoRecord object (represents the single row). Není to ale typické pro nejběžněji užívané ADO Provider. The AdoRecord object is usually returned by explicit operations, when the specific AdoRecord is returned from the existing AdoRecordset object. The AdoRecord object consists of multiple AdoField objects, the same way as the AdoRecordset object. The difference is that the methods for moving the position of current record are not supported (e.g. MoveFirst). In order to keep the documntation simple, it will be referred only to the commonly returned AdoRecordset object, although in some special cases the system may also return the AdoRecord object.
var oDb = pMe.Pm("/TestAdoDb");
oDb.DbExecute("", "INSERT table1 (name, value) VALUES ('pi', 3.14)", "");