SetDatabaseBlob()
Syntax
Result = SetDatabaseBlob(#Database, StatementIndex, *Buffer, BufferLength)Description
Set the blob for future use with DatabaseUpdate(). 'StatementIndex' starts from 0, and indicates on which undefined query parameter the blob should be inserted. The SQL syntax to specify undefined parameter is database manager dependent. See the following examples to see how to proceed.Example: SQLite and ODBC
; SQLite and ODBC shares the same syntax to insert blob. It is indicated by the '?' character ; ; The database should be opened and a table PHOTOS with 3 column (BLOB, VARCHAR(255), BLOB) ; SetDatabaseBlob(0, 0, ?Picture, PictureLength) SetDatabaseBlob(0, 1, ?SmallPicture, SmallPictureLength) DatabaseUpdate(0, "INSERT INTO PHOTOS (picture, name, small_picture) values (?, 'my description', ?);")Example: PostgreSQL
; PostgreSQL uses another syntax: $1, $2.. into the statement to indicate the undefined parameter ; ; The database should be opened and a table PHOTOS with 3 column (BYTEA, VARCHAR(255), BYTEA) ; SetDatabaseBlob(0, 0, ?Picture, PictureLength) SetDatabaseBlob(0, 1, ?SmallPicture, SmallPictureLength) DatabaseUpdate(0, "INSERT INTO PHOTOS (picture, name, small_picture) values ($1, 'my description', $2);")Note: PostgreSQL uses BYTEA to store large objects. The escaping needed to store binary data into such a column make it often bigger than expected. A good way to store binary data is to encode it with Base64Encoder() before submitting to the database manager.
Supported OS
All