char *SQCloudRowsetValue (SQCloudResult *result, uint32_t row, uint32_t col, uint32_t *len);


If the result of the function SQCloudResultType is RESULT_ROWSET then use this function to retrieve a pointer and a length for a rowset item identified by a given row and column index.


  • result: A valid SQCloudResult pointer returned by an SQCloud function.
  • row: A row index (from 0 to SQCloudRowsetRows-1)
  • col: A column index (from 0 to SQCloudRowsetCols-1)
  • len: On output the length of the returned buffer

Return value

A pointer to the value.


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 (no error check here)
    SQCloudResult *r1 = SQCloudExec(conn, "USE DATABASE mydatabase.sqlite;");

    // perform a sample query
    SQCloudResult *r = SQCloudExec(conn, "SELECT * FROM mytable;");
    if (SQCloudResultType(r) == RESULT_ROWSET) {
        uint32_t nrows = SQCloudRowsetRows(r);
        uint32_t ncols = SQCloudRowsetCols(r);

        // print column names
        for (uint32_t i=0; i<ncols; ++i) {
            uint32_t len;
            char *value = SQCloudRowsetColumnName(result, i, &len);
            printf("%.*s\n", len, value);

        // print values
        for (uint32_t i=0; i<nrows; ++i) {
            for (uint32_t j=0; j<ncols; ++j) {
                SQCLOUD_VALUE_TYPE type = SQCloudRowsetValueType(r, i, j);

                switch (type) {
                case VALUE_NULL: {
                case VALUE_INTEGER: {
                    int32_t value = SQCloudRowsetInt32Value(r, i, j);
                    printf("%d\n", value);
                    // int64_t value = SQCloudRowsetInt64Value(r, i, j);
                    // printf("%lld\n", value);
                case VALUE_FLOAT: {
                    float value = SQCloudRowsetFloatValue(r, i);
                    printf("%f\n", value);
                    // double value = SQCloudRowsetDoubleValue(r, i, j);
                    // printf("%f\n", value);
                case VALUE_BLOB:
                case VALUE_TEXT: {
                    uint32_t len;
                    char *value = SQCloudRowsetValue(result, i, j, &len);
                    if (type == VALUE_BLOB) printf("[%d] BLOB size %d\n", i, len);
                    else printf("[%d] %.*s\n", i, len, value);