ExecuteQueryCached

(ODBC Manager Library)

Description:

Called to send an SQL data modification command to the server.

This module will cache the query locally if it fails and send it to the database after the next successful transaction with the db. This module was designed to be used for logging values that cannot be lost.

Returns: 0 upon query execution starting. See the following comments.
Usage: Script Only.
Related to: AddConnection | BuildDelete | BuildInsert | BuildSelect | BuildUpdate | ConvertToDbDate | ConvertToDbTime | ConvertToDbTimeStamp | ConvertToVTSDate | ConvertToVTSTime | ConvertToVTSTimeStamp | CopyRecords | DBDropList | DBGridList | ErrMessage | ExecuteQuery | FlushCache | FormatBatchQuery | GetConnList | ResultFormat | StatsWin | TableSynch | Transaction | TransactionCached
Format: \ODBCManager.ExecuteQueryCached(ErrPtr,  CmdStr,  DSN,  UserName,  Password[,  BatchSize])
Parameters:  
ErrPtr 
Required. Pointer to an error. Always valid on completion. Set to 0 if the command succeeds.
CmdStr
Required. The SQL command to send to the database
DSN
Required. The name of the ODBC database in which to execute the command.
UserName
Required. The user name in the database for authentication. A null provided in this field will be passed to the database as a null string.
Password
Required. The password in the database for authentication. A null provided in this field will be passed to the database as a null string.
BatchSize
Optional. The number of array entries to send in one batch no default. Returns 0 upon query execution starting. See the following comments.
Comments: This module is a member of the ODBCManager Library, and must therefore be prefaced by \ODBCManager, as shown in "Format" above.
This module MUST be called as a subroutine in a script. Completed execution of the query is indicated by a valid value set in the variable pointed to by parameter "ErrPtr". For this reason the variable referenced by "ErrPtr" MUST be invalidated before calling the function.

Example:

InsertRecord [
  If 1 NextRecord;
  [
    Names  = New(4);
    Types  = New(4);
    Values = New(4);
    Names[0] = "RecordName";
    Names[1] = "TextVal";
    Names[2] = "NumberVal";
    Names[3] = "BoolVal";
    Types[0] = \ODBCManager\#SQL_VARCHAR;
    Types[1] = \ODBCManager\#SQL_VARCHAR;
    Types[2] = \ODBCManager\#SQL_NUMERIC;
    Types[3] = \ODBCManager\#SQL_BINARY;
    Values[0] = "rec1";
    Values[1] = "string1";
    Values[2] = 11;
    Values[3] = 1;
    Query = \ODBCManager.BuildInsert("TestTable", Names, Values, Types,
                                     \ODBCManager\#dbType_MSAccess);
    Err    = Invalid;
    Result = Invalid;
    Attrib = Invalid;
    ErrorMsg = Invalid;
    SQLState = Invalid;
    ErrorCode = Invalid;
    \ODBCManager.ExecuteQueryCached(&Err, Query, Conn1DSN, Invalid, Invalid);
  ]
]
NextRecord [ ...