Class Connection
A struct representing a database connection.
The Connection is responsible for handshaking with the server to establish authentication. It then passes client preferences to the server, and subsequently is the channel for all command packets that are sent, and all response packets received.
Uncompressed packets consist of a 4 byte header - 3 bytes of length, and one byte as a packet number. Connection deals with the headers and ensures that packet numbers are sequential.
The initial packet is sent by the server - essentially a 'hello' packet inviting login. That packet has a sequence number of zero. That sequence number is the incremented by client and server packets through the handshake sequence.
After login all further sequences are initialized by the client sending a command packet with a zero sequence number, to which the server replies with zero or more packets with sequential sequence numbers.
Inherits from
-
Object
(base class)
Constructors
Name | Description |
---|---|
this
|
Construct opened connection. |
this
|
Construct opened connection. |
this
|
Construct opened connection. |
Properties
Name | Type | Description |
---|---|---|
charSet
[get]
|
ubyte |
Current character set |
closed
[get]
|
bool |
|
currentDB
[get]
|
string |
Current database |
hasPending
[get]
|
bool |
Gets whether anything (rows, headers or binary) is pending. |
lastCommandId
[get]
|
ulong |
This gets incremented every time a command is issued or results are purged, |
lastInsertID
[get]
|
ulong |
After a command that inserted a row into a table with an auto-increment |
protocol
[get]
|
ubyte |
Return the in-force protocol number |
resultFieldDescriptions
[get]
|
FieldDescription[] |
Gets the result header's field descriptions. |
rowsPending
[get]
|
bool |
Gets whether rows are pending |
serverCapabilities
[get]
|
uint |
Server capability flags |
serverStatus
[get]
|
ushort |
Server status |
serverVersion
[get]
|
string |
Server version |
socketType
[get]
|
MySQLSocketType |
Socket type being used |
Methods
Name | Description |
---|---|
acquire
|
|
amOwner
|
|
close
|
Explicitly close the connection. |
enableMultiStatements
|
Enable multiple statement commands |
getNextRow
|
Get the next Row of a pending result set. |
isOwner
|
|
parseConnectionString
|
|
pingServer
|
Check the server status |
purgeResult
|
Flush any outstanding result set elements. |
reconnect
|
|
reconnect
|
|
refreshServer
|
Refresh some feature(s) of the server. |
release
|
|
selectDB
|
Select a current database. |
serverStats
|
Get a textual report on the server status. |