SQCloudResultType
SQCLOUD_RESULT_TYPE SQCloudResultType (SQCloudResult *result);
Description
Get the type of the opaque datatype result.
Parameters
- result: A valid SQCloudResult pointer returned by an SQCloud function.
Return value
An int
represented by the SQCLOUD_RESULT_TYPE enum type:
typedef enum {
RESULT_OK,
RESULT_ERROR,
RESULT_STRING,
RESULT_INTEGER,
RESULT_FLOAT,
RESULT_ROWSET,
RESULT_ARRAY,
RESULT_NULL,
RESULT_JSON,
RESULT_BLOB
} SQCLOUD_RESULT_TYPE;
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;");
SQCLOUD_RESULT_TYPE type = SQCloudResultType(r);
switch(type) {
case RESULT_OK: printf("Result is OK\n"); break;
case RESULT_ERROR: printf("Result is ERROR\n"); break;
case RESULT_STRING: printf("Result is STRING\n"); break;
case RESULT_INTEGER: printf("Result is INTEGER\n"); break;
case RESULT_FLOAT: printf("Result is FLOAT\n"); break;
case RESULT_ROWSET: printf("Result is ROWSET\n"); break;
case RESULT_ARRAY: printf("Result is ARRAY\n"); break;
case RESULT_NULL: printf("Result is NULL\n"); break;
case RESULT_JSON: printf("Result is JSON\n"); break;
case RESULT_BLOB: printf("Result is BLOB\n"); break;
}
// ...
}