@@ -271,7 +271,7 @@ class ViewDefinedAs
271
271
Specify table select operation for which the view is created.
272
272
273
273
@note In situations where select statement is modified after
274
- passing it to definedAs() method, later changes do not afffect
274
+ passing it to definedAs() method, later changes do not affect
275
275
view definition which uses the state of the statement at the time
276
276
of definedAs() call.
277
277
*/
@@ -324,7 +324,7 @@ class ViewSecurity
324
324
public:
325
325
326
326
/* *
327
- Specify security characteristisc of a view.
327
+ Specify security characteristics of a view.
328
328
329
329
@see https://dev.mysql.com/doc/refman/5.7/en/stored-programs-security.html
330
330
*/
@@ -363,8 +363,9 @@ class ViewAlgorithm
363
363
364
364
365
365
/*
366
- Base blass for Create/Alter View
366
+ Base class for Create/Alter View
367
367
*/
368
+
368
369
template <class Op >
369
370
class View_base
370
371
: public ViewAlgorithm<Op>
@@ -887,26 +888,51 @@ class PUBLIC_API Table
887
888
Represents session options to be passed at XSession/NodeSession object
888
889
creation.
889
890
890
- SessionSettings can be constructed using uri, common connect options (host,
891
- port, user, password, database) or using pairs of SessionSettings::Options -
892
- Value objects.
891
+ SessionSettings can be constructed using URL string, common connect options
892
+ (host, port, user, password, database) or with a list
893
+ of `SessionSettings::Options` constants followed by option value (unless
894
+ given option has no value, like `SSL_ENABLE`).
895
+
896
+ Examples:
897
+ ~~~~~~
898
+
899
+ SessionSettings from_url(http://github.com/"mysqlx://user:pwd@host:port/db?ssl-enable");
900
+
901
+ SessionSettings from_options("host", port, "user", "pwd", "db");
902
+
903
+ SessionSettings from_option_list(
904
+ SessionSettings::USER, "user",
905
+ SessionSettings::PWD, "pwd",
906
+ SessionSettings::HOST, "host",
907
+ SessionSettings::PORT, port,
908
+ SessionSettings::DB, "db",
909
+ SessionSettings::SSL_ENABLE
910
+ );
911
+ ~~~~~~
893
912
894
913
@ingroup devapi
895
914
*/
896
915
897
916
class PUBLIC_API SessionSettings
898
917
{
899
918
public:
919
+
920
+ /* *
921
+ Session creation options
922
+
923
+ @note Specifying `SSL_CA` option implies `SSL_ENABLE`.
924
+ */
925
+
900
926
enum Options
901
927
{
902
- URI,
903
- HOST,
904
- PORT,
905
- USER,
906
- PWD,
907
- DB,
908
- SSL_ENABLE,
909
- SSL_CA
928
+ URI, // !< connection URI or string
929
+ HOST, // !< host name or IP address
930
+ PORT, // !< X Plugin port to connect to
931
+ USER, // !< user name
932
+ PWD, // !< password
933
+ DB, // !< default database
934
+ SSL_ENABLE, // !< use TLS connection
935
+ SSL_CA // !< path to a PEM file specifying trusted root certificates
910
936
};
911
937
912
938
@@ -922,6 +948,19 @@ class PUBLIC_API SessionSettings
922
948
{}
923
949
924
950
951
+ /* *
952
+ Create a session using connection string or URL.
953
+
954
+ Connection sting has the form `"user:pass\@host:port/?option&option"`,
955
+ valid URL is like a connection string with a `mysqlx://` prefix. Possible
956
+ connection options are:
957
+
958
+ - `ssl-enable` : use TLS connection
959
+ - `ssl-ca=`<path> : path to a PEM file specifying trusted root certificates
960
+
961
+ Specifying `ssl-ca` option implies `ssl-enable`.
962
+ */
963
+
925
964
SessionSettings (const string &uri)
926
965
{
927
966
add (URI, uri);
@@ -930,6 +969,9 @@ class PUBLIC_API SessionSettings
930
969
931
970
/* *
932
971
Create session explicitly specifying session parameters.
972
+
973
+ @note Session settings constructed this way request an SSL connection
974
+ by default.
933
975
*/
934
976
935
977
SessionSettings (const std::string &host, unsigned port,
@@ -956,9 +998,12 @@ class PUBLIC_API SessionSettings
956
998
: SessionSettings(host, port, user, pwd.c_str(), db)
957
999
{}
958
1000
959
- /* *
960
- Create session using the default port
961
- */
1001
+ /* *
1002
+ Create session using the default port
1003
+
1004
+ @note Session settings constructed this way request an SSL connection
1005
+ by default.
1006
+ */
962
1007
963
1008
SessionSettings (const std::string &host,
964
1009
const string &user,
@@ -974,9 +1019,12 @@ class PUBLIC_API SessionSettings
974
1019
: SessionSettings(host, DEFAULT_MYSQLX_PORT, user, pwd, db)
975
1020
{}
976
1021
977
- /* *
978
- Create session on localhost.
979
- */
1022
+ /* *
1023
+ Create session on localhost.
1024
+
1025
+ @note Session settings constructed this way request an SSL connection
1026
+ by default.
1027
+ */
980
1028
981
1029
SessionSettings (unsigned port,
982
1030
const string &user,
@@ -1054,7 +1102,25 @@ class PUBLIC_API SessionSettings
1054
1102
1055
1103
1056
1104
/* *
1057
- Passing option - value pairs
1105
+ Create session using a list of session options.
1106
+
1107
+ The list of options consist of `SessionSettings::Options` constant
1108
+ identifying the option to set, followed by option value (unless
1109
+ not required, as in the case of `SSL_ENABLE`).
1110
+
1111
+ Example:
1112
+ ~~~~~~
1113
+ SessionSettings from_option_list(
1114
+ SessionSettings::USER, "user",
1115
+ SessionSettings::PWD, "pwd",
1116
+ SessionSettings::HOST, "host",
1117
+ SessionSettings::PORT, port,
1118
+ SessionSettings::DB, "db",
1119
+ SessionSettings::SSL_ENABLE
1120
+ );
1121
+ ~~~~~~
1122
+
1123
+ @see `SessionSettings::Options`.
1058
1124
*/
1059
1125
1060
1126
template <typename V,typename ...R>
@@ -1155,14 +1221,6 @@ namespace internal {
1155
1221
1156
1222
public:
1157
1223
1158
- /* *
1159
- Create session specified by mysqlx connection string.
1160
-
1161
- Connection string can be either an utf8 encoded single-byte
1162
- string or a wide string (which is converted to utf8 before
1163
- parsing).
1164
- */
1165
-
1166
1224
XSession_base (SessionSettings settings);
1167
1225
1168
1226
template <typename ...T>
@@ -1303,11 +1361,42 @@ class PUBLIC_API XSession
1303
1361
1304
1362
public:
1305
1363
1364
+ /* *
1365
+ Create session specified by `SessionSettings` object.
1366
+ */
1367
+
1306
1368
XSession (SessionSettings settings)
1307
1369
: XSession_base(settings)
1308
1370
{}
1309
1371
1310
1372
1373
+ /* *
1374
+ Create session using given session settings.
1375
+
1376
+ This constructor forwards arguments to a `SessionSettings` constructor.
1377
+ Thus all forms of specifying session options are also directly available
1378
+ in `XSession` constructor.
1379
+
1380
+ Examples:
1381
+ ~~~~~~
1382
+
1383
+ XSession from_uri("mysqlx://user:pwd@host:port/db?ssl-enable");
1384
+
1385
+ XSession from_options("host", port, "user", "pwd", "db");
1386
+
1387
+ XSession from_option_list(
1388
+ SessionSettings::USER, "user",
1389
+ SessionSettings::PWD, "pwd",
1390
+ SessionSettings::HOST, "host",
1391
+ SessionSettings::PORT, port,
1392
+ SessionSettings::DB, "db",
1393
+ SessionSettings::SSL_ENABLE
1394
+ );
1395
+ ~~~~~~
1396
+
1397
+ @see `SessionSettings`
1398
+ */
1399
+
1311
1400
template <typename ...T>
1312
1401
XSession (T...options)
1313
1402
: XSession_base(SessionSettings(options...))
0 commit comments