SQCloudResultDouble

double SQCloudResultDouble (SQCloudResult *result);

Description

If the result of the function SQCloudResultType is RESULT_FLOAT then use this function to retrieve a Double value.

Parameters

  • result: A valid SQCloudResult pointer returned by an SQCloud function.

Return value

A double value.

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");
    }

    // execute a sample command
    SQCloudResult *r = SQCloudExec(conn, "GET INFO disk_usage_perc;");
    double value = SQCloudResultDouble(r);
    SQCloudResultFree(r);
}