@@ -265,10 +265,15 @@ func (c *Conn) GetDB() string {
265
265
return c .db
266
266
}
267
267
268
+ // GetServerVersion returns the version of the server as reported by the server
269
+ // in the initial server greeting.
268
270
func (c * Conn ) GetServerVersion () string {
269
271
return c .serverVersion
270
272
}
271
273
274
+ // CompareServerVersion is comparing version v against the version
275
+ // of the server and returns 0 if they are equal, and 1 if the server version
276
+ // is higher and -1 if the server version is lower.
272
277
func (c * Conn ) CompareServerVersion (v string ) (int , error ) {
273
278
return CompareServerVersions (c .serverVersion , v )
274
279
}
@@ -294,13 +299,6 @@ func (c *Conn) Execute(command string, args ...interface{}) (*Result, error) {
294
299
// When ExecuteMultiple is used, the connection should have the SERVER_MORE_RESULTS_EXISTS
295
300
// flag set to signal the server multiple queries are executed. Handling the responses
296
301
// is up to the implementation of perResultCallback.
297
- //
298
- // Example:
299
- //
300
- // queries := "SELECT 1; SELECT NOW();"
301
- // conn.ExecuteMultiple(queries, func(result *mysql.Result, err error) {
302
- // // Use the result as you want
303
- // })
304
302
func (c * Conn ) ExecuteMultiple (query string , perResultCallback ExecPerResultCallback ) (* Result , error ) {
305
303
if err := c .writeCommandStr (COM_QUERY , query ); err != nil {
306
304
return nil , errors .Trace (err )
@@ -354,15 +352,6 @@ func (c *Conn) ExecuteMultiple(query string, perResultCallback ExecPerResultCall
354
352
// When given, perResultCallback will be called once per result
355
353
//
356
354
// ExecuteSelectStreaming should be used only for SELECT queries with a large response resultset for memory preserving.
357
- //
358
- // Example:
359
- //
360
- // var result mysql.Result
361
- // conn.ExecuteSelectStreaming(`SELECT ... LIMIT 100500`, &result, func(row []mysql.FieldValue) error {
362
- // // Use the row as you want.
363
- // // You must not save FieldValue.AsString() value after this callback is done. Copy it if you need.
364
- // return nil
365
- // }, nil)
366
355
func (c * Conn ) ExecuteSelectStreaming (command string , result * Result , perRowCallback SelectPerRowCallback , perResultCallback SelectPerResultCallback ) error {
367
356
if err := c .writeCommandStr (COM_QUERY , command ); err != nil {
368
357
return errors .Trace (err )
@@ -494,6 +483,8 @@ func (c *Conn) exec(query string) (*Result, error) {
494
483
return c .readResult (false )
495
484
}
496
485
486
+ // CapabilityString is returning a string with the names of capability flags
487
+ // separated by "|". Examples of capability names are CLIENT_DEPRECATE_EOF and CLIENT_PROTOCOL_41.
497
488
func (c * Conn ) CapabilityString () string {
498
489
var caps []string
499
490
capability := c .capability
0 commit comments