Skip to content

Commit 469f9c6

Browse files
committed
Standardize doc comment style.
1 parent 6a584e8 commit 469f9c6

File tree

13 files changed

+1034
-1051
lines changed

13 files changed

+1034
-1051
lines changed

source/mysql/common.d

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ version(Have_vibe_d_core)
2020
static assert(false, "mysql-native can't find Vibe.d's 'vibe.core.net'.");
2121
}
2222

23-
/**
24-
* An exception type to distinguish exceptions thrown by this module.
25-
*/
23+
/++
24+
An exception type to distinguish exceptions thrown by this module.
25+
+/
2626
class MySQLException: Exception
2727
{
2828
this(string msg, string file = __FILE__, size_t line = __LINE__) pure
@@ -32,9 +32,9 @@ class MySQLException: Exception
3232
}
3333
alias MYX = MySQLException;
3434

35-
/**
36-
* Received invalid data from the server which violates the MySQL network protocol.
37-
*/
35+
/++
36+
Received invalid data from the server which violates the MySQL network protocol.
37+
+/
3838
class MySQLProtocolException: MySQLException
3939
{
4040
this(string msg, string file, size_t line) pure

source/mysql/connection.d

Lines changed: 102 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -42,27 +42,27 @@ immutable SvrCapFlags defaultClientFlags =
4242
SvrCapFlags.SECURE_CONNECTION;// | SvrCapFlags.MULTI_STATEMENTS |
4343
//SvrCapFlags.MULTI_RESULTS;
4444

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+
+/
6666
class Connection
6767
{
6868
package:
@@ -437,24 +437,24 @@ package:
437437

438438
public:
439439

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+
+/
458458
this(string host, string user, string pwd, string db, ushort port = 3306, SvrCapFlags capFlags = defaultClientFlags)
459459
{
460460
version(Have_vibe_d_core)
@@ -521,23 +521,23 @@ public:
521521
connect(capFlags);
522522
}
523523

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+
+/
541541
this(string cs, SvrCapFlags capFlags = defaultClientFlags)
542542
{
543543
string[] a = parseConnectionString(cs);
@@ -586,22 +586,22 @@ public:
586586
bool amOwner() { return !!_socket; }
587587
}
588588

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+
+/
605605
void close()
606606
{
607607
if (_open == OpenState.authenticated && _socket.connected)
@@ -680,61 +680,61 @@ public:
680680
return rv;
681681
}
682682

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+
+/
689689
void selectDB(string dbName)
690690
{
691691
sendCmd(CommandType.INIT_DB, dbName);
692692
getCmdResponse();
693693
_db = dbName;
694694
}
695695

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+
+/
702702
OKErrorPacket pingServer()
703703
{
704704
sendCmd(CommandType.PING, []);
705705
return getCmdResponse();
706706
}
707707

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+
+/
714714
OKErrorPacket refreshServer(RefreshFlags flags)
715715
{
716716
sendCmd(CommandType.REFRESH, [flags]);
717717
return getCmdResponse();
718718
}
719719

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+
+/
725725
string serverStats()
726726
{
727727
sendCmd(CommandType.STATISTICS, []);
728728
return cast(string) getPacket();
729729
}
730730

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+
+/
738738
void enableMultiStatements(bool on)
739739
{
740740
scope(failure) kill();

source/mysql/db.d

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
/**
2-
* A lightweight interface to a MySQL database using vibe.d's connectionpool.
3-
*
4-
* You have to include vibe.d in your project to be able to use this class.
5-
* If you don't want to, refer to mysql.connection.
6-
*/
1+
/++
2+
A lightweight interface to a MySQL database using vibe.d's connectionpool.
3+
4+
You have to include vibe.d in your project to be able to use this class.
5+
If you don't want to, refer to mysql.connection.
6+
+/
77
module mysql.db;
88

99
public import mysql.connection;

source/mysql/escape.d

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
1-
/**
2-
* Functions to escape special characters in mysql strings
3-
*/
1+
/++
2+
Functions to escape special characters in mysql strings
3+
+/
44
module mysql.escape;
55

66

7-
/*******************************************************************************
8-
9-
Simple escape function for dangerous SQL characters
10-
11-
Params:
12-
input = string to escape
13-
buffer = buffer to use for the output
14-
15-
*******************************************************************************/
7+
/++
8+
Simple escape function for dangerous SQL characters
169
10+
Params:
11+
input = string to escape
12+
buffer = buffer to use for the output
13+
+/
1714
void mysql_escape ( Buffer, Input ) ( Input input, Buffer buffer )
1815
{
1916
import std.string : translate;
@@ -32,16 +29,13 @@ void mysql_escape ( Buffer, Input ) ( Input input, Buffer buffer )
3229
}
3330

3431

35-
/*******************************************************************************
36-
37-
Struct to wrap around a string so it can be passed to formattedWrite and be
38-
properly escaped all using the buffer that formattedWrite provides.
39-
40-
Template Params:
41-
Input = Type of the input
42-
43-
*******************************************************************************/
32+
/++
33+
Struct to wrap around a string so it can be passed to formattedWrite and be
34+
properly escaped all using the buffer that formattedWrite provides.
4435
36+
Template Params:
37+
Input = Type of the input
38+
+/
4539
struct MysqlEscape ( Input )
4640
{
4741
Input input;
@@ -58,18 +52,15 @@ struct MysqlEscape ( Input )
5852
}
5953
}
6054

61-
/*******************************************************************************
62-
63-
Helper function to easily construct a escape wrapper struct
64-
65-
Template Params:
66-
T = type of the input
67-
68-
Params:
69-
input = input to escape
55+
/++
56+
Helper function to easily construct a escape wrapper struct
7057
71-
*******************************************************************************/
58+
Template Params:
59+
T = type of the input
7260
61+
Params:
62+
input = input to escape
63+
+/
7364
MysqlEscape!(T) mysqlEscape ( T ) ( T input )
7465
{
7566
return MysqlEscape!(T)(input);

0 commit comments

Comments
 (0)