SQCloudBlobReOpen

bool SQCloudBlobReOpen (SQCloudBlob *blob, int64_t rowid);

Description

This function is used to move an existing BLOB handle so that it points to a different row of the same database table. The new row is identified by the rowid value passed as the second argument. Only the row can be changed. The database, table and column on which the blob handle is open remain the same.

This function resembles the sqlite3_blob_reopen SQLite API.

Parameters

  • blob: a valid SQCloudBlob opaque datatype obtained by SQCloudBlobOpen
  • rowid: rowid of the BLOB to open

Return value

true if operation succed, otherwise false

Example

int main (int argc, const char * argv[]) {
    // setup config
    SQCloudConfig config = {0};
    config.username = "myusername";
    config.password = "mypassword"

    SQCloudConnection *conn = SQCloudConnect("myproject.sqlite.cloud", SQCLOUD_DEFAULT_PORT, &config);
    if (SQCloudIsError(conn)) {
        printf("ERROR connecting: %s (%d)\n", SQCloudErrorMsg(conn), SQCloudErrorCode(conn));
        return -1;
    } else {
        printf("Connection to host OK...\n\n");
    }

    // choose a database first
    SQCloudResult *r = SQCloudExec(conn, "USE DATABASE mydatabase.sqlite;");

    // open a BLOB for reading
    SQCloudBlobOpen *blob = SQCloudBlobOpen(conn, NULL, "mytable", "mycolumn", 1, 0);

    // ...

    // re-open another rowid
    SQCloudBlobReOpen(blob, 2);
}