|
| | Blob (bool readWrite=false, bool autoOpen=true) |
| | Constructor. More...
|
| |
|
| Blob (Blob &source) |
| |
| bool | close (QString *errorMsg=nullptr) |
| | Closes the blob if open. More...
|
| |
| bool | open (QString *errorMsg=nullptr) |
| | Opens the blob if closed. More...
|
| |
| bool | open (qint64 rowid, QString *errorMsg=nullptr) |
| | Open the blob to a particular row id. More...
|
| |
| bool | reopenFast (qint64 newId, QString *errorMsg=nullptr) |
| | Reopens the blob with a new id. More...
|
| |
| bool | isOpen () |
| | Checks if the blob is currently open. More...
|
| |
| bool | isReadWrite () |
| | Returns the read/write mode. More...
|
| |
| bool | autoOpen () |
| | Returns the autoOpen mode. More...
|
| |
| qint64 | size () |
| | Get the size of the blob. More...
|
| |
| bool | read (void *data, qsizetype size, qsizetype offset=0) |
| | Reads data from the blob. More...
|
| |
| QByteArray | read (qsizetype size, qsizetype offset=0) |
| | Read data from the blob an returns a QByteArray with read data. More...
|
| |
| QByteArray | readAll () |
| | Reads all the data in the blob. More...
|
| |
| bool | write (const void *data, qsizetype size, qsizetype offset) |
| | Writes data to the blob. More...
|
| |
| bool | write (const QByteArray &data, qsizetype offset=0) |
| | Writes data to the blob. More...
|
| |
| QString | database () |
| | Returns current database name. More...
|
| |
| QString | table () |
| | Returns current table name. More...
|
| |
| QString | column () |
| | Returns current column name. More...
|
| |
| qint64 | rowId () |
| | Returns current row id. More...
|
| |
|
The functions here are used to set all parameters needed for succesfully opening a blob. - Warning
- Calling any function in this group with values differents from the ones already set closes the Blob if autoOpen is not true or reopens it if it is false
|
| bool | set (Db *db, const char *database, const char *table, const char *column, qint64 rowid) |
| | Sets several parameters at once. More...
|
| |
| bool | set (Db *db, const char *database, const char *table, const char *column) |
| | Sets several parameters at once. More...
|
| |
| bool | set (Db *db, const char *database, const char *table, qint64 rowid) |
| | Sets several parameters at once. More...
|
| |
| bool | setDatabase (const char *database) |
| | Sets the database name. If not set it will "main". More...
|
| |
| bool | setTable (const char *table) |
| | Sets the table name. More...
|
| |
| bool | setColumn (const char *column) |
| | Sets the column name. More...
|
| |
| bool | setRowId (qint64 rowId) |
| | Sets the row id. More...
|
| |
| bool | setReadWrite (bool readWrite) |
| | Sets the read/write mode. More...
|
| |
| bool | setDbPointer (Db *db) |
| | Sets the connection this blob refers to. More...
|
| |
| void | setAutoOpen (bool newAutoOpen) |
| | Sets the autoOpen mode. More...
|
| |
Provides direct read/write access to a blob.
Blob has two options that influence its behaviour:
- readWrite set if the blob should be open in read-only mode (false) or in read-write mode (true)
- autoOpen If set to true (default behaviour) after any call to function that sets parameters if all parameters needed for opening the blob (database pointer, table, column and row id) are set the function will try to open/reopen the blob. Note that in this case the functions will return true only if the open was successfull.
There are three ways of setting blob parameters:
- Directly using any function to set parameters calls
- Reading the Blob with a column containing a blob sets database pointer, database, table and column to the one of the blob
- Reading the Blob with a column containing an integer sets the rowid
Typical usage case will be like setting everything by hand:
b.set(m_db, nullptr, "TestTable", "blobColumn", 4);
Blob(bool readWrite=false, bool autoOpen=true)
Constructor.
Definition: HFSQtLi.h:1542
or set all the parameters except the rowid by hand and then using a "SELECT" to retive it
b.set(m_db, nullptr, "TestTable", "blobColumn");
m_db->executeSingle("SELECT rowid FROM TestTable WHERE name="Foo", b)
or set all the parameters via a select:
m_db->executeSingle("SELECT blobColumn, rowid FROM TestTable WHERE name="Foo", b, b);