@@ -42,27 +42,27 @@ immutable SvrCapFlags defaultClientFlags =
42
42
SvrCapFlags.SECURE_CONNECTION ;// | SvrCapFlags.MULTI_STATEMENTS |
43
43
// SvrCapFlags.MULTI_RESULTS;
44
44
45
- /**
46
- * A struct representing a database connection.
47
- *
48
- * The Connection is responsible for handshaking with the server to establish
49
- * authentication. It then passes client preferences to the server, and
50
- * subsequently is the channel for all command packets that are sent, and all
51
- * response packets received.
52
- *
53
- * Uncompressed packets consist of a 4 byte header - 3 bytes of length, and one
54
- * byte as a packet number. Connection deals with the headers and ensures that
55
- * packet numbers are sequential.
56
- *
57
- * The initial packet is sent by the server - essentially a 'hello' packet
58
- * inviting login. That packet has a sequence number of zero. That sequence
59
- * number is the incremented by client and server packets through the handshake
60
- * sequence.
61
- *
62
- * After login all further sequences are initialized by the client sending a
63
- * command packet with a zero sequence number, to which the server replies with
64
- * zero or more packets with sequential sequence numbers.
65
- * /
45
+ /+ +
46
+ A struct representing a database connection.
47
+
48
+ The Connection is responsible for handshaking with the server to establish
49
+ authentication. It then passes client preferences to the server, and
50
+ subsequently is the channel for all command packets that are sent, and all
51
+ response packets received.
52
+
53
+ Uncompressed packets consist of a 4 byte header - 3 bytes of length, and one
54
+ byte as a packet number. Connection deals with the headers and ensures that
55
+ packet numbers are sequential.
56
+
57
+ The initial packet is sent by the server - essentially a 'hello' packet
58
+ inviting login. That packet has a sequence number of zero. That sequence
59
+ number is the incremented by client and server packets through the handshake
60
+ sequence.
61
+
62
+ After login all further sequences are initialized by the client sending a
63
+ command packet with a zero sequence number, to which the server replies with
64
+ zero or more packets with sequential sequence numbers.
65
+ + /
66
66
class Connection
67
67
{
68
68
package :
@@ -437,24 +437,24 @@ package:
437
437
438
438
public :
439
439
440
- /**
441
- * Construct opened connection.
442
- *
443
- * After the connection is created, and the initial invitation is received from the server
444
- * client preferences can be set, and authentication can then be attempted.
445
- *
446
- * Parameters:
447
- * socketType = Whether to use a Phobos or Vibe.d socket. Default is Phobos,
448
- * unless -version=Have_vibe_d_core is used.
449
- * openSocket = Optional callback which should return a newly-opened Phobos
450
- * or Vibe.d TCP socket. This allows custom sockets to be used,
451
- * subclassed from Phobos's or Vibe.d's sockets.
452
- * host = An IP address in numeric dotted form, or as a host name.
453
- * user = The user name to authenticate.
454
- * password = Users password.
455
- * db = Desired initial database.
456
- * capFlags = The set of flag bits from the server's capabilities that the client requires
457
- * /
440
+ /+ +
441
+ Construct opened connection.
442
+
443
+ After the connection is created, and the initial invitation is received from the server
444
+ client preferences can be set, and authentication can then be attempted.
445
+
446
+ Parameters:
447
+ socketType = Whether to use a Phobos or Vibe.d socket. Default is Phobos,
448
+ unless -version=Have_vibe_d_core is used.
449
+ openSocket = Optional callback which should return a newly-opened Phobos
450
+ or Vibe.d TCP socket. This allows custom sockets to be used,
451
+ subclassed from Phobos's or Vibe.d's sockets.
452
+ host = An IP address in numeric dotted form, or as a host name.
453
+ user = The user name to authenticate.
454
+ password = Users password.
455
+ db = Desired initial database.
456
+ capFlags = The set of flag bits from the server's capabilities that the client requires
457
+ + /
458
458
this (string host, string user, string pwd, string db, ushort port = 3306 , SvrCapFlags capFlags = defaultClientFlags)
459
459
{
460
460
version (Have_vibe_d_core)
@@ -521,23 +521,23 @@ public:
521
521
connect(capFlags);
522
522
}
523
523
524
- /**
525
- * Construct opened connection.
526
- *
527
- * After the connection is created, and the initial invitation is received from
528
- * the server client preferences are set, and authentication can then be attempted.
529
- *
530
- * TBD The connection string needs work to allow for semicolons in its parts!
531
- *
532
- * Parameters:
533
- * socketType = Whether to use a Phobos or Vibe.d socket. Default is Phobos
534
- * unless -version=Have_vibe_d_core is used.
535
- * openSocket = Optional callback which should return a newly-opened Phobos
536
- * or Vibe.d TCP socket. This allows custom sockets to be used,
537
- * subclassed from Phobos's or Vibe.d's sockets.
538
- * cs = A connection string of the form "host=localhost;user=user;pwd=password;db=mysqld"
539
- * capFlags = The set of flag bits from the server's capabilities that the client requires
540
- * /
524
+ /+ +
525
+ Construct opened connection.
526
+
527
+ After the connection is created, and the initial invitation is received from
528
+ the server client preferences are set, and authentication can then be attempted.
529
+
530
+ TBD The connection string needs work to allow for semicolons in its parts!
531
+
532
+ Parameters:
533
+ socketType = Whether to use a Phobos or Vibe.d socket. Default is Phobos
534
+ unless -version=Have_vibe_d_core is used.
535
+ openSocket = Optional callback which should return a newly-opened Phobos
536
+ or Vibe.d TCP socket. This allows custom sockets to be used,
537
+ subclassed from Phobos's or Vibe.d's sockets.
538
+ cs = A connection string of the form "host=localhost;user=user;pwd=password;db=mysqld"
539
+ capFlags = The set of flag bits from the server's capabilities that the client requires
540
+ + /
541
541
this (string cs, SvrCapFlags capFlags = defaultClientFlags)
542
542
{
543
543
string [] a = parseConnectionString(cs);
@@ -586,22 +586,22 @@ public:
586
586
bool amOwner () { return !! _socket; }
587
587
}
588
588
589
- /**
590
- * Explicitly close the connection.
591
- *
592
- * This is a two-stage process. First tell the server we are quitting this
593
- * connection, and then close the socket.
594
- *
595
- * Idiomatic use as follows is suggested:
596
- * ------------------
597
- * {
598
- * auto con = Connection("localhost:user:password:mysqld");
599
- * scope(exit) con.close();
600
- * // Use the connection
601
- * ...
602
- * }
603
- * ------------------
604
- * /
589
+ /+ +
590
+ Explicitly close the connection.
591
+
592
+ This is a two-stage process. First tell the server we are quitting this
593
+ connection, and then close the socket.
594
+
595
+ Idiomatic use as follows is suggested:
596
+ ------------------
597
+ {
598
+ auto con = Connection("localhost:user:password:mysqld");
599
+ scope(exit) con.close();
600
+ // Use the connection
601
+ ...
602
+ }
603
+ ------------------
604
+ + /
605
605
void close ()
606
606
{
607
607
if (_open == OpenState.authenticated && _socket.connected)
@@ -680,61 +680,61 @@ public:
680
680
return rv;
681
681
}
682
682
683
- /**
684
- * Select a current database.
685
- *
686
- * Params: dbName = Name of the requested database
687
- * Throws: MySQLException
688
- * /
683
+ /+ +
684
+ Select a current database.
685
+
686
+ Params: dbName = Name of the requested database
687
+ Throws: MySQLException
688
+ + /
689
689
void selectDB (string dbName)
690
690
{
691
691
sendCmd(CommandType.INIT_DB , dbName);
692
692
getCmdResponse();
693
693
_db = dbName;
694
694
}
695
695
696
- /**
697
- * Check the server status
698
- *
699
- * Returns: An OKErrorPacket from which server status can be determined
700
- * Throws: MySQLException
701
- * /
696
+ /+ +
697
+ Check the server status
698
+
699
+ Returns: An OKErrorPacket from which server status can be determined
700
+ Throws: MySQLException
701
+ + /
702
702
OKErrorPacket pingServer ()
703
703
{
704
704
sendCmd(CommandType.PING , []);
705
705
return getCmdResponse ();
706
706
}
707
707
708
- /**
709
- * Refresh some feature(s) of the server.
710
- *
711
- * Returns: An OKErrorPacket from which server status can be determined
712
- * Throws: MySQLException
713
- * /
708
+ /+ +
709
+ Refresh some feature(s) of the server.
710
+
711
+ Returns: An OKErrorPacket from which server status can be determined
712
+ Throws: MySQLException
713
+ + /
714
714
OKErrorPacket refreshServer (RefreshFlags flags)
715
715
{
716
716
sendCmd(CommandType.REFRESH , [flags]);
717
717
return getCmdResponse ();
718
718
}
719
719
720
- /**
721
- * Get a textual report on the server status.
722
- *
723
- * (COM_STATISTICS)
724
- * /
720
+ /+ +
721
+ Get a textual report on the server status.
722
+
723
+ (COM_STATISTICS)
724
+ + /
725
725
string serverStats ()
726
726
{
727
727
sendCmd(CommandType.STATISTICS , []);
728
728
return cast (string ) getPacket();
729
729
}
730
730
731
- /**
732
- * Enable multiple statement commands
733
- *
734
- * This can be used later if this feature was not requested in the client capability flags.
735
- *
736
- * Params: on = Boolean value to turn the capability on or off.
737
- * /
731
+ /+ +
732
+ Enable multiple statement commands
733
+
734
+ This can be used later if this feature was not requested in the client capability flags.
735
+
736
+ Params: on = Boolean value to turn the capability on or off.
737
+ + /
738
738
void enableMultiStatements (bool on)
739
739
{
740
740
scope (failure) kill ();
0 commit comments