Connector/Net Programming
1923
mysql Information: 3 : 1: Query Opened: SHOW COLLATION
mysql Information: 4 : 1: Resultset Opened: field(s) = 6, affected rows = -1, inserted id = -1
mysql Information: 5 : 1: Resultset Closed. Total rows=127, skipped rows=0, size (bytes)=4102
mysql Information: 6 : 1: Query Closed
mysql Information: 3 : 1: Query Opened: SET character_set_results=NULL
mysql Information: 4 : 1: Resultset Opened: field(s) = 0, affected rows = 0, inserted id = 0
mysql Information: 5 : 1: Resultset Closed. Total rows=0, skipped rows=0, size (bytes)=0
mysql Information: 6 : 1: Query Closed
mysql Information: 10 : 1: Set Database: world
mysql Information: 3 : 1: Query Opened: SELECT Name, HeadOfState FROM Country WHERE Continent='Oceania'
mysql Information: 4 : 1: Resultset Opened: field(s) = 2, affected rows = -1, inserted id = -1
American Samoa -- George W. Bush
Australia -- Elisabeth II
...
Wallis and Futuna -- Jacques Chirac
Vanuatu -- John Bani
United States Minor Outlying Islands -- George W. Bush
mysql Information: 5 : 1: Resultset Closed. Total rows=28, skipped rows=0, size (bytes)=788
mysql Information: 6 : 1: Query Closed
Done.
mysql Information: 2 : 1: Connection Closed
The first number displayed in the trace message corresponds to the MySQL event type:
Event
Description
1
ConnectionOpened: connection string
2
ConnectionClosed:
3
QueryOpened: mysql server thread id, query text
4
ResultOpened: field count, affected rows (-1 if select), inserted
id (-1 if select)
5
ResultClosed: total rows read, rows skipped, size of resultset in
bytes
6
QueryClosed:
7
StatementPrepared: prepared sql, statement id
8
StatementExecuted: statement id, mysql server thread id
9
StatementClosed: statement id
10
NonQuery: [varies]
11
UsageAdvisorWarning: usage advisor flag. NoIndex = 1,
BadIndex = 2, SkippedRows = 3, SkippedColumns = 4,
FieldConversion = 5.
12
Warning: level, code, message
13
Error: error number, error message
The second number displayed in the trace message is the connection count.
Although this example uses the
ConsoleTraceListener
, any of the other standard listeners could
have been used. Another possibility is to create a custom listener that uses the information passed
using the
TraceEvent
method. For example, a custom trace listener could be created to perform
active monitoring of the MySQL event messages, rather than simply writing these to an output device.
It is also possible to add listeners to the MySQL Trace Source at runtime. This can be done with the
following code:
MySqlTrace.Listeners.Add(new ConsoleTraceListener());
MySQL Connector/Net 6.3.2 introduced the ability to switch tracing on and off at runtime. This
can be achieved using the calls
MySqlTrace.EnableQueryAnalyzer(string host, int
postInterval)
and
MySqlTrace.DisableQueryAnalyzer()
. The parameter
host
is the URL of
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...