Assigns binary data to a bound place holder of a SQL statement or to a result data column of a SQL query. Place holders and data columns are identified by number.
ODBC.bdh
OdbcSetBinary( in cCursor : cursor, in sIdentifier : string, in sBinary : string, in nLength : number, in nIndex : number optional ): boolean;
true if successful
false otherwise
Parameter | Description |
---|---|
cCursor | Cursor associated with a database connection. |
sIdentifier | Identifier of the place holder or the result data column. To identify a place holder, begin this parameter with a colon. |
sBinary | Binary data that is assigned to the place holder or the result data column. |
nLength | Amount of binary data (in bytes) that is assigned to the place holder or the result data column. |
nIndex | Array index for the place holder or column item to be set (optional). By default, this function sets the first item. |
var hEnv, hDbc : number; cCursor : cursor; dcltrans transaction TMain begin OdbcAlloc(SQL_HANDLE_ENV, hEnv); OdbcAlloc(SQL_HANDLE_DBC, hDbc, hEnv); OdbcConnect(hDbc, "DSN=database;UID=user;PWD=pass;"); OdbcOpen(cCursor, hDbc); OdbcPrepare(cCursor, sqlInsert); OdbcBind(cCursor, ":1", SQL_C_CHAR, 32); OdbcBind(cCursor, ":2", SQL_C_BINARY); OdbcSetString(cCursor, ":1", "Bob", 1); OdbcSetBinary(cCursor, ":2", "\h54516170", 4, 1); OdbcSetString(cCursor, ":1", "Marcy", 2); OdbcSetBinary(cCursor, ":2", "\h5458516170", 5, 2); OdbcExecute(cCursor); OdbcClose(cCursor, SQL_DROP); OdbcCommit(hDbc); OdbcDisconnect(hDbc); OdbcFree(hDbc); OdbcFree(hEnv); end TMain; dclsql sqlInsert: INSERT INTO persons (name, password) VALUES (?, ?);