1 module hunt.database.driver.mysql.MySQLConnection;
2 
3 import hunt.database.driver.mysql.MySQLConnectOptions;
4 import hunt.database.driver.mysql.MySQLSetOption;
5 
6 import hunt.database.base.AsyncResult;
7 import hunt.database.base.Common;
8 // import hunt.database.driver.mysql.impl.MySQLConnectionImpl;
9 import hunt.database.base.PreparedQuery;
10 import hunt.database.base.Row;
11 import hunt.database.base.RowSet;
12 import hunt.database.base.SqlConnection;
13 import hunt.database.base.SqlResult;
14 import hunt.database.base.Tuple;
15 
16 /**
17  * A connection to MySQL server.
18  */
19 interface MySQLConnection : SqlConnection {
20     /**
21      * Create a connection to MySQL server with the given {@code connectOptions}.
22      *
23      * @param vertx the vertx instance
24      * @param connectOptions the options for the connection
25      * @param handler the handler called with the connection or the failure
26      */
27     // static void connect(MySQLConnectOptions connectOptions, AsyncResultHandler!(MySQLConnection)) handler) {
28     //     MySQLConnectionImpl.connect(connectOptions, handler);
29     // }
30 
31     /**
32      * Like {@link #connect(Vertx, MySQLConnectOptions, Handler)} with options build from {@code connectionUri}.
33      */
34     // static void connect(string connectionUri, AsyncResultHandler!(MySQLConnection)) handler) {
35     //     connect(fromUri(connectionUri), handler);
36     // }
37 
38 
39     // MySQLConnection prepare(string sql, PreparedQueryHandler handler);
40 
41     // MySQLConnection exceptionHandler(ExceptionHandler handler);
42 
43     // MySQLConnection closeHandler(AsyncVoidHandler handler);
44 
45     // MySQLConnection preparedQuery(string sql, RowSetHandler handler);
46 
47 
48     // <R> MySQLConnection preparedQuery(string sql, Collector<Row, ?, R> collector, AsyncResultHandler!(SqlResult!(R))) handler);
49 
50 
51     // MySQLConnection query(string sql, RowSetHandler handler);
52 
53 
54 
55     // <R> MySQLConnection query(string sql, Collector<Row, ?, R> collector, AsyncResultHandler!(SqlResult!(R))) handler);
56 
57 
58     // MySQLConnection preparedQuery(string sql, Tuple arguments, RowSetHandler handler);
59 
60 
61     // <R> MySQLConnection preparedQuery(string sql, Tuple arguments, Collector<Row, ?, R> collector, AsyncResultHandler!(SqlResult!(R))) handler);
62 
63     /**
64      * Send a PING command to check if the server is alive.
65      *
66      * @param handler the handler notified when the server responses to client
67      * @return a reference to this, so the API can be used fluently
68      */
69     MySQLConnection ping(AsyncVoidHandler handler);
70 
71     /**
72      * Send a INIT_DB command to change the default schema of the connection.
73      *
74      * @param schemaName name of the schema to change to
75      * @param handler the handler notified with the execution result
76      * @return a reference to this, so the API can be used fluently
77      */
78     MySQLConnection specifySchema(string schemaName, AsyncVoidHandler handler);
79 
80     /**
81      * Send a STATISTICS command to get a human readable string of the server internal status.
82      *
83      * @param handler the handler notified with the execution result
84      * @return a reference to this, so the API can be used fluently
85      */
86     MySQLConnection getInternalStatistics(AsyncResultHandler!(string) handler);
87 
88 
89     /**
90      * Send a SET_OPTION command to set options for the current connection.
91      *
92      * @param option the options to set
93      * @param handler the handler notified with the execution result
94      * @return a reference to this, so the API can be used fluently
95      */
96     MySQLConnection setOption(MySQLSetOption option, AsyncVoidHandler handler);
97 
98     /**
99      * Send a RESET_CONNECTION command to reset the session state.
100      *
101      * @param handler the handler notified with the execution result
102      * @return a reference to this, so the API can be used fluently
103      */
104     MySQLConnection resetConnection(AsyncVoidHandler handler);
105 
106     /**
107      * Send a DEBUG command to dump debug information to the server's stdout.
108      *
109      * @param handler the handler notified with the execution result
110      * @return a reference to this, so the API can be used fluently
111      */
112     MySQLConnection dumpDebug(AsyncVoidHandler handler);
113 
114     /**
115      * Send a CHANGE_USER command to change the user of the current connection, this operation will also reset connection state.
116      *
117      * @param options authentication options, only username, password, database, collation and properties will be used.
118      * @param handler the handler
119      * @return a reference to this, so the API can be used fluently
120      */
121     MySQLConnection changeUser(MySQLConnectOptions options, AsyncVoidHandler handler);
122 }