You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The X DevAPI allows one to work with MySQL Servers implementing a document store
8
-
via the X Plugin. One can also execute plain SQL queries using this API.
4
+
Connector/C++ implements the X DevAPI, as described in
5
+
the [X DevAPI User Guide](http://dev.mysql.com/doc/x-devapi-userguide/en/index.html).
6
+
The X DevAPI allows one to work with the document store of MySQL Server 8 or later, communicating over the X protocol. It is also possible to execute plain SQL queries using this API.
9
7
10
8
To get started, check out some of the main X DevAPI classes:
11
9
12
-
- To access data first create a @link mysqlx::abi2::r0::Session `Session`@endlink
13
-
object. Keep in mind that @link mysqlx::abi2::r0::Session `Session`@endlink is
14
-
not thread safe!
10
+
- To access data first create a `mysqlx::Session` object. Keep in mind that
11
+
`mysqlx::Session` is not thread safe!
15
12
16
13
- To manipulate data stored in a document collection or a table, create
17
-
a @link mysqlx::abi2::r0::Collection `Collection`@endlink or a @link mysqlx::abi2::r0::Table
18
-
`Table`@endlink object using methods `getCollection()` or `getTable()` of
19
-
a @link mysqlx::abi2::r0::Schema `Schema`@endlink object obtained from the session.
20
-
21
-
- Queries and other statements are created using methods of the `Collection`
22
-
or `Table` class, such as `find()`. They are executed with method `execute()`.
23
-
24
-
- Results of a query are examined using @link mysqlx::abi2::r0::DocResult
25
-
`DocResult`@endlink or @link mysqlx::abi2::r0::RowResult `RowResult`@endlink instances
26
-
returned from `execute()` method. Method `fetchOne()` fetches the next item
27
-
(a document or a row) from the result until there are no more items left.
28
-
Method `fetchAll()` can fetch all items at once and store them in an STL
29
-
container.
30
-
31
-
- Documents and rows from query results are represented by @link mysqlx::abi2::r0::DbDoc
32
-
`DbDoc`@endlink and @link mysqlx::abi2::r0::Row `Row`@endlink instances, respectively.
14
+
a `mysqlx::Collection` or a `mysqlx::Table` object using methods
Session s3(13009, "mike", "s3cr3t!"); // session on localhost
74
+
Session s4(
75
+
SessionOption::USER, "mike",
76
+
SessionOption::PWD, "s3cr3t!",
77
+
SessionOption::HOST, "localhost",
78
+
SessionOption::PORT, 13009
79
+
);
80
+
~~~~~~
81
+
In general the `mysqlx::Session` constructor uses its arguments to create
82
+
a `mysqlx::SessionSettings` instance -- see documentation of that class for
83
+
possible arguments to the constructor. Enumeration `mysqlx::SessionOption`
84
+
defines all session options recognized by the connector.
85
+
86
+
87
+
Next a `test` schema is created and a `c1` collection within that schema. They
88
+
are represented by `mysqlx::Schema` and `mysqlx::Collection` objects,
89
+
respectively:
90
+
91
+
@skipline "Session accepted
72
92
@until Collection
73
93
74
-
The `true` parameter to @link mysqlx::abi2::r0::Schema::createCollection
75
-
`createCollection()`@endlink method specifies that collection should be re-used
76
-
if it already exists. Without this parameter an attempt to create an already
77
-
existing collection produces an error. It is also possible to create
78
-
a `Collection` object directly, without creating the `Schema` instance:
94
+
The `true` parameter
95
+
to the [`Session::createSchema()`](@ref mysqlx::abi2::r0::Session::createSchema)/[`Schema::createCollection()`](@ref mysqlx::abi2::r0::Schema::createCollection)
96
+
method specifies that the schema/collection should be re-used if it already
97
+
exists (rather than throwing an error which is the default behavior).
98
+
99
+
@note
100
+
It is also possible to create a `mysqlx::Collection` object directly, without
0 commit comments