MySQL Connector/C++ 9.1.0
MySQL connector library for C and C++ applications
|
Functions | |
int | mysqlx_schema_create (mysqlx_session_t *sess, const char *schema) |
Create a schema. More... | |
int | mysqlx_schema_drop (mysqlx_session_t *sess, const char *schema) |
Drop a schema. More... | |
int | mysqlx_collection_create (mysqlx_schema_t *schema, const char *collection) |
Create a new collection in a specified schema. More... | |
mysqlx_collection_options_t * | mysqlx_collection_options_new () |
Allocate a new create/modify collection options data. More... | |
int | mysqlx_collection_options_set (mysqlx_collection_options_t *options,...) |
Set collection options. More... | |
int | mysqlx_collection_create_with_options (mysqlx_schema_t *schema, const char *collection, mysqlx_collection_options_t *options) |
Create a new collection in a specified schema. More... | |
int | mysqlx_collection_create_with_json_options (mysqlx_schema_t *schema, const char *collection, const char *json_options) |
Create a new collection in a specified schema. More... | |
int | mysqlx_collection_drop (mysqlx_schema_t *schema, const char *collection) |
Drop an existing collection in a specified schema. More... | |
int | mysqlx_collection_create_index (mysqlx_collection_t *coll, const char *name, const char *idx_spec) |
Create index for a collection. More... | |
int | mysqlx_collection_drop_index (mysqlx_collection_t *coll, const char *name) |
Drop index on a collection. More... | |
int mysqlx_schema_create | ( | mysqlx_session_t * | sess, |
const char * | schema | ||
) |
Create a schema.
sess | session handle |
schema | the name of the schema to be created |
RESULT_OK
- on success; RESULT_ERROR
- on error The error handle can be obtained from the session using mysqlx_error()
function. int mysqlx_schema_drop | ( | mysqlx_session_t * | sess, |
const char * | schema | ||
) |
Drop a schema.
sess | session handle |
schema | the name of the schema to be dropped |
RESULT_OK
- on success; RESULT_ERROR
- on error The error handle can be obtained from the session using mysqlx_error()
function. int mysqlx_collection_create | ( | mysqlx_schema_t * | schema, |
const char * | collection | ||
) |
Create a new collection in a specified schema.
schema | schema handle |
collection | collection name to create |
RESULT_OK
- on success; RESULT_ERROR
- on error The error handle can be obtained from the session using mysqlx_error()
function. mysqlx_collection_options_t * mysqlx_collection_options_new | ( | ) |
Allocate a new create/modify collection options data.
mysqlx_free()
. int mysqlx_collection_options_set | ( | mysqlx_collection_options_t * | options, |
... | |||
) |
Set collection options.
options | handle created by mysqlx_collection_options_new() function |
... | variable parameters list consisting of (option, value) pairs terminated by PARAM_END . |
RESULT_OK
- on success; RESULT_ERROR
- on error The error handle can be obtained from the options using mysqlx_error()
function.The variable parameter list is of the form
OPT_COLLECTION_O1(val1), OPT_COLLECTION_O2(val2), ..., PARAM_END
or, equivalently,
MYSQLX_OPT_COLLECTION_O1, val1, MYSQLX_OPT_COLLECTION_02, val2,...,
PARAM_END
Possible options are defined by enumerations mysqlx_collection_opt_t and mysqlx_collection_validation_opt_t. Type of option value vali
(number, string, etc.) must match the option MYSQLX_OPT_COLLECTION_Oi
, otherwise this value along with all the sequential options and values are most likely to be corrupted.
int mysqlx_collection_create_with_options | ( | mysqlx_schema_t * | schema, |
const char * | collection, | ||
mysqlx_collection_options_t * | options | ||
) |
Create a new collection in a specified schema.
schema | schema handle |
collection | collection name to create |
options | handle created by mysqlx_collection_options_new() function |
RESULT_OK
- on success; RESULT_ERROR
- on error The error handle can be obtained from the session using mysqlx_error()
function. int mysqlx_collection_create_with_json_options | ( | mysqlx_schema_t * | schema, |
const char * | collection, | ||
const char * | json_options | ||
) |
Create a new collection in a specified schema.
schema | schema handle |
collection | collection name to create |
json_options | json with options: {
"reuseExisting": true,
"validation":
{
"level": "Strict",
"schema":
{
"id": "http://json-schema.org/geo",
"$schema": "http://json-schema.org/draft-06/schema#",
"description": "A geographical coordinate",
"type": "object",
"properties":
{
"latitude":
{
"type": "number"
},
"longitude":
{
"type": "number"
}
},
"required": ["latitude", "longitude"]
}
}
}
}
|
Document keys:
reuseExisting
: Same as MYSQLX_OPT_COLLECTION_REUSE;validation
: Same as MYSQLX_OPT_COLLECTION_VALIDATION;RESULT_OK
- on success; RESULT_ERROR
- on error The error handle can be obtained from the session using mysqlx_error()
function. int mysqlx_collection_drop | ( | mysqlx_schema_t * | schema, |
const char * | collection | ||
) |
Drop an existing collection in a specified schema.
schema | schema handle |
collection | collection name to drop |
RESULT_OK
- on success; RESULT_ERROR
- on error The error handle can be obtained from the session using mysqlx_error()
function int mysqlx_collection_create_index | ( | mysqlx_collection_t * | coll, |
const char * | name, | ||
const char * | idx_spec | ||
) |
Create index for a collection.
This function creates a named index in the collection using a JSON index specification.
coll | collection to create the index for |
name | name for the index to be created |
idx_spec | index specification as a JSON string |
RESULT_OK
- on success; RESULT_ERROR
- on error The error handle can be obtained from the collection using mysqlx_error()
function. int mysqlx_collection_drop_index | ( | mysqlx_collection_t * | coll, |
const char * | name | ||
) |
Drop index on a collection.
This function drops an index in a collection with a specific name
coll | collection whose index should be dropped |
name | name of the index to be dropped |
RESULT_OK
- on success; RESULT_ERROR
- on error The error handle can be obtained from the collection using mysqlx_error()
function.