Class: Mysql
- Defined in:
- lib/vendor/mysql/error.rb,
lib/vendor/mysql.rb,
lib/vendor/mysql/packet.rb,
lib/vendor/mysql/charset.rb,
lib/vendor/mysql/protocol.rb,
lib/vendor/mysql/constants.rb
Overview
Copyright © 2003-2008 TOMITA Masahiro [email protected]
Defined Under Namespace
Classes: Charset, ClientError, Error, Field, Packet, Protocol, ProtocolError, RawRecord, Result, ResultBase, ServerError, Stmt, StmtRawRecord, Time
Constant Summary collapse
- VERSION =
Version number of this library
20913
- MYSQL_UNIX_PORT =
UNIX domain socket filename
"/tmp/mysql.sock"
- MYSQL_TCP_PORT =
TCP socket port number
3306
- COM_SLEEP =
Command
0
- COM_QUIT =
1
- COM_INIT_DB =
2
- COM_QUERY =
3
- COM_FIELD_LIST =
4
- COM_CREATE_DB =
5
- COM_DROP_DB =
6
- COM_REFRESH =
7
- COM_SHUTDOWN =
8
- COM_STATISTICS =
9
- COM_PROCESS_INFO =
10
- COM_CONNECT =
11
- COM_PROCESS_KILL =
12
- COM_DEBUG =
13
- COM_PING =
14
- COM_TIME =
15
- COM_DELAYED_INSERT =
16
- COM_CHANGE_USER =
17
- COM_BINLOG_DUMP =
18
- COM_TABLE_DUMP =
19
- COM_CONNECT_OUT =
20
- COM_REGISTER_SLAVE =
21
- COM_STMT_PREPARE =
22
- COM_STMT_EXECUTE =
23
- COM_STMT_SEND_LONG_DATA =
24
- COM_STMT_CLOSE =
25
- COM_STMT_RESET =
26
- COM_SET_OPTION =
27
- COM_STMT_FETCH =
28
- CLIENT_LONG_PASSWORD =
Client flag
1
- CLIENT_FOUND_ROWS =
new more secure passwords
1 << 1
- CLIENT_LONG_FLAG =
Found instead of affected rows
1 << 2
- CLIENT_CONNECT_WITH_DB =
Get all column flags
1 << 3
- CLIENT_NO_SCHEMA =
One can specify db on connect
1 << 4
- CLIENT_COMPRESS =
Don’t allow database.table.column
1 << 5
- CLIENT_ODBC =
Can use compression protocol
1 << 6
- CLIENT_LOCAL_FILES =
Odbc client
1 << 7
- CLIENT_IGNORE_SPACE =
Can use LOAD DATA LOCAL
1 << 8
- CLIENT_PROTOCOL_41 =
Ignore spaces before ‘(’
1 << 9
- CLIENT_INTERACTIVE =
New 4.1 protocol
1 << 10
- CLIENT_SSL =
This is an interactive client
1 << 11
- CLIENT_IGNORE_SIGPIPE =
Switch to SSL after handshake
1 << 12
- CLIENT_TRANSACTIONS =
IGNORE sigpipes
1 << 13
- CLIENT_RESERVED =
Client knows about transactions
1 << 14
- CLIENT_SECURE_CONNECTION =
Old flag for 4.1 protocol
1 << 15
- CLIENT_MULTI_STATEMENTS =
New 4.1 authentication
1 << 16
- CLIENT_MULTI_RESULTS =
Enable/disable multi-stmt support
1 << 17
- OPT_CONNECT_TIMEOUT =
Connection Option
0
- OPT_COMPRESS =
1
- OPT_NAMED_PIPE =
2
- INIT_COMMAND =
3
- READ_DEFAULT_FILE =
4
- READ_DEFAULT_GROUP =
5
- SET_CHARSET_DIR =
6
- SET_CHARSET_NAME =
7
- OPT_LOCAL_INFILE =
8
- OPT_PROTOCOL =
9
- SHARED_MEMORY_BASE_NAME =
10
- OPT_READ_TIMEOUT =
11
- OPT_WRITE_TIMEOUT =
12
- OPT_USE_RESULT =
13
- OPT_USE_REMOTE_CONNECTION =
14
- OPT_USE_EMBEDDED_CONNECTION =
15
- OPT_GUESS_CONNECTION =
16
- SET_CLIENT_IP =
17
- SECURE_AUTH =
18
- REPORT_DATA_TRUNCATION =
19
- OPT_RECONNECT =
20
- OPT_SSL_VERIFY_SERVER_CERT =
21
- OPTION_MULTI_STATEMENTS_ON =
Server Option
0
- OPTION_MULTI_STATEMENTS_OFF =
1
- SERVER_STATUS_IN_TRANS =
Server Status
1
- SERVER_STATUS_AUTOCOMMIT =
1 << 1
- SERVER_MORE_RESULTS_EXISTS =
1 << 3
- SERVER_QUERY_NO_GOOD_INDEX_USED =
1 << 4
- SERVER_QUERY_NO_INDEX_USED =
1 << 5
- SERVER_STATUS_CURSOR_EXISTS =
1 << 6
- SERVER_STATUS_LAST_ROW_SENT =
1 << 7
- SERVER_STATUS_DB_DROPPED =
1 << 8
- SERVER_STATUS_NO_BACKSLASH_ESCAPES =
1 << 9
- REFRESH_GRANT =
Refresh parameter
1
- REFRESH_LOG =
1 << 1
- REFRESH_TABLES =
1 << 2
- REFRESH_HOSTS =
1 << 3
- REFRESH_STATUS =
1 << 4
- REFRESH_THREADS =
1 << 5
- REFRESH_SLAVE =
1 << 6
- REFRESH_MASTER =
1 << 7
- REFRESH_READ_LOCK =
1 << 14
- REFRESH_FAST =
1 << 15
Instance Attribute Summary collapse
-
#charset ⇒ Mysql::Charset
Character set of MySQL connection.
- #protocol ⇒ Object readonly
- #query_with_result ⇒ Boolean
Class Method Summary collapse
-
.client_info ⇒ String
Client version.
-
.client_version ⇒ Integer
Client version.
-
.escape_string(str) ⇒ String
Escape special character in string.
-
.get_client_info ⇒ String
Client version.
-
.get_client_version ⇒ Integer
Client version.
-
.init ⇒ Mysql
Make Mysql object without connecting.
-
.new ⇒ Mysql
(also: real_connect, connect)
Make Mysql object and connect to mysqld.
-
.quote ⇒ String
Escape special character in string.
Instance Method Summary collapse
-
#affected_rows ⇒ Integer
Number of affected records by insert/update/delete.
-
#autocommit(flag) ⇒ Mysql
Set autocommit mode.
-
#character_set_name ⇒ String
Charset name.
-
#client_info ⇒ String
(also: #get_client_info)
Client version.
-
#client_version ⇒ Integer
(also: #get_client_version)
Client version.
-
#close ⇒ Mysql
Disconnect from mysql.
-
#close! ⇒ Mysql
Disconnect from mysql without QUIT packet.
-
#commit ⇒ Mysql
Commit transaction.
-
#connect(host = nil, user = nil, passwd = nil, db = nil, port = nil, socket = nil, flag = 0) ⇒ Object
(also: #real_connect)
Connect to mysqld.
-
#errno ⇒ Integer
Last error number.
-
#error ⇒ String
Last error message.
-
#escape_string(str) ⇒ Object
(also: #quote)
Escape special character in MySQL.
-
#field_count ⇒ Integer
Number of columns for last query.
-
#host_info ⇒ String
(also: #get_host_info)
Connection type.
-
#info ⇒ String
Information for last query.
-
#initialize ⇒ Mysql
constructor
A new instance of Mysql.
-
#insert_id ⇒ Integer
Latest auto_increment value.
-
#kill(pid) ⇒ Mysql
Kill query.
-
#list_dbs(db = nil) ⇒ Array<String>
database list.
-
#list_fields(table, field = nil) ⇒ Mysql::Result
Returns Mysql::Result object that is empty.
-
#list_processes ⇒ Mysql::Result
Containing process list.
-
#list_tables(table = nil) ⇒ Array<String>
List of table name.
-
#more_results ⇒ Boolean
(also: #more_results?)
True if multiple queries are specified and unexecuted queries exists.
-
#next_result ⇒ Boolean
execute next query if multiple queries are specified.
-
#options(opt, value = nil) ⇒ Mysql
Set option for connection.
-
#ping ⇒ Mysql
Check whether the connection is available.
-
#prepare(str) ⇒ Mysql::Stmt
Parse prepared-statement.
-
#proto_info ⇒ Integer
(also: #get_proto_info)
Protocol version.
-
#query(str) {|Mysql::Result| ... } ⇒ Mysql::Result, ...
(also: #real_query)
Execute query string.
-
#refresh(op) ⇒ Mysql
Flush tables or caches.
-
#reload ⇒ Mysql
Reload grant tables.
-
#rollback ⇒ Mysql
Rollback transaction.
-
#select_db(db) ⇒ Mysql
Select default database.
-
#server_info ⇒ String
(also: #get_server_info)
Server version.
-
#server_version ⇒ Integer
(also: #get_server_version)
Server version.
-
#set_server_option(opt) ⇒ Mysql
Set server option.
-
#shutdown(level = 0) ⇒ Mysql
shutdown server.
-
#sqlstate ⇒ String
Sqlstate for last error.
-
#stat ⇒ String
Statistics message.
-
#stmt_init ⇒ Mysql::Stmt
Make empty prepared-statement object.
-
#store_result ⇒ Mysql::Result
Get all data for last query if query_with_result is false.
-
#thread_id ⇒ Integer
Thread ID.
-
#use_result ⇒ Mysql::Result
Use result of query.
-
#warning_count ⇒ Integer
Number of warnings for previous query.
Constructor Details
#initialize ⇒ Mysql
Returns a new instance of Mysql.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/vendor/mysql.rb', line 74 def initialize @fields = nil @protocol = nil @charset = nil @connect_timeout = nil @read_timeout = nil @write_timeout = nil @init_command = nil @sqlstate = "00000" @query_with_result = true @host_info = nil @last_error = nil @result_exist = false @local_infile = nil end |
Instance Attribute Details
#charset ⇒ Mysql::Charset
Returns character set of MySQL connection.
18 19 20 |
# File 'lib/vendor/mysql.rb', line 18 def charset @charset end |
#protocol ⇒ Object (readonly)
20 21 22 |
# File 'lib/vendor/mysql.rb', line 20 def protocol @protocol end |
Class Method Details
.client_info ⇒ String
Returns client version. This value is dummy for MySQL/Ruby compatibility.
62 63 64 |
# File 'lib/vendor/mysql.rb', line 62 def client_info "5.0.0" end |
.client_version ⇒ Integer
Returns client version. This value is dummy for MySQL/Ruby compatibility.
68 69 70 |
# File 'lib/vendor/mysql.rb', line 68 def client_version 50000 end |
.escape_string(str) ⇒ String
Escape special character in string.
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/vendor/mysql.rb', line 48 def escape_string(str) str.gsub(/[\0\n\r\\\'\"\x1a]/) do |s| case s when "\0" then "\\0" when "\n" then "\\n" when "\r" then "\\r" when "\x1a" then "\\Z" else "\\#{s}" end end end |
.get_client_info ⇒ String
Returns client version. This value is dummy for MySQL/Ruby compatibility.
65 66 67 |
# File 'lib/vendor/mysql.rb', line 65 def client_info "5.0.0" end |
.get_client_version ⇒ Integer
Returns client version. This value is dummy for MySQL/Ruby compatibility.
71 72 73 |
# File 'lib/vendor/mysql.rb', line 71 def client_version 50000 end |
.init ⇒ Mysql
Make Mysql object without connecting.
28 29 30 31 32 |
# File 'lib/vendor/mysql.rb', line 28 def init my = self.allocate my.instance_eval{initialize} my end |
.new ⇒ Mysql Also known as: real_connect, connect
Make Mysql object and connect to mysqld.
37 38 39 40 |
# File 'lib/vendor/mysql.rb', line 37 def new(...) my = self.init my.connect(...) end |
.quote ⇒ String
Escape special character in string.
59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/vendor/mysql.rb', line 59 def escape_string(str) str.gsub(/[\0\n\r\\\'\"\x1a]/) do |s| case s when "\0" then "\\0" when "\n" then "\\n" when "\r" then "\\r" when "\x1a" then "\\Z" else "\\#{s}" end end end |
Instance Method Details
#affected_rows ⇒ Integer
Returns number of affected records by insert/update/delete.
271 272 273 |
# File 'lib/vendor/mysql.rb', line 271 def affected_rows @protocol ? @protocol.affected_rows : 0 end |
#autocommit(flag) ⇒ Mysql
Set autocommit mode
499 500 501 502 |
# File 'lib/vendor/mysql.rb', line 499 def autocommit(flag) query "set autocommit=#{flag ? 1 : 0}" self end |
#character_set_name ⇒ String
Returns charset name.
215 216 217 |
# File 'lib/vendor/mysql.rb', line 215 def character_set_name @charset.name end |
#client_info ⇒ String Also known as: get_client_info
Returns client version.
191 192 193 |
# File 'lib/vendor/mysql.rb', line 191 def client_info self.class.client_info end |
#client_version ⇒ Integer Also known as: get_client_version
Returns client version.
197 198 199 |
# File 'lib/vendor/mysql.rb', line 197 def client_version self.class.client_version end |
#close ⇒ Mysql
Disconnect from mysql.
115 116 117 118 119 120 121 |
# File 'lib/vendor/mysql.rb', line 115 def close if @protocol @protocol.quit_command @protocol = nil end return self end |
#close! ⇒ Mysql
Disconnect from mysql without QUIT packet.
125 126 127 128 129 130 131 |
# File 'lib/vendor/mysql.rb', line 125 def close! if @protocol @protocol.close @protocol = nil end return self end |
#commit ⇒ Mysql
Commit transaction
484 485 486 487 |
# File 'lib/vendor/mysql.rb', line 484 def commit query 'commit' self end |
#connect(host = nil, user = nil, passwd = nil, db = nil, port = nil, socket = nil, flag = 0) ⇒ Object Also known as: real_connect
Connect to mysqld.
99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/vendor/mysql.rb', line 99 def connect(host=nil, user=nil, passwd=nil, db=nil, port=nil, socket=nil, flag=0) if flag & CLIENT_COMPRESS != 0 warn 'unsupported flag: CLIENT_COMPRESS' if $VERBOSE flag &= ~CLIENT_COMPRESS end @protocol = Protocol.new host, port, socket, @connect_timeout, @read_timeout, @write_timeout @protocol.authenticate user, passwd, db, (@local_infile ? CLIENT_LOCAL_FILES : 0) | flag, @charset @charset ||= @protocol.charset @host_info = (host.nil? || host == "localhost") ? 'Localhost via UNIX socket' : "#{host} via TCP/IP" query @init_command if @init_command return self end |
#errno ⇒ Integer
Returns last error number.
220 221 222 |
# File 'lib/vendor/mysql.rb', line 220 def errno @last_error ? @last_error.errno : 0 end |
#error ⇒ String
Returns last error message.
225 226 227 |
# File 'lib/vendor/mysql.rb', line 225 def error @last_error && @last_error.error end |
#escape_string(str) ⇒ Object Also known as: quote
Escape special character in MySQL.
In Ruby 1.8, this is not safe for multibyte charset such as ‘SJIS’. You should use place-holder in prepared-statement. return [String]
182 183 184 185 186 187 |
# File 'lib/vendor/mysql.rb', line 182 def escape_string(str) if not defined? Encoding and @charset.unsafe raise ClientError, 'Mysql#escape_string is called for unsafe multibyte charset' end self.class.escape_string str end |
#field_count ⇒ Integer
Returns number of columns for last query.
235 236 237 |
# File 'lib/vendor/mysql.rb', line 235 def field_count @fields.size end |
#host_info ⇒ String Also known as: get_host_info
Returns connection type.
240 241 242 |
# File 'lib/vendor/mysql.rb', line 240 def host_info @host_info end |
#info ⇒ String
Returns information for last query.
266 267 268 |
# File 'lib/vendor/mysql.rb', line 266 def info @protocol && @protocol. end |
#insert_id ⇒ Integer
Returns latest auto_increment value.
276 277 278 |
# File 'lib/vendor/mysql.rb', line 276 def insert_id @protocol ? @protocol.insert_id : 0 end |
#kill(pid) ⇒ Mysql
Kill query.
288 289 290 291 292 |
# File 'lib/vendor/mysql.rb', line 288 def kill(pid) check_connection @protocol.kill_command pid self end |
#list_dbs(db = nil) ⇒ Array<String>
database list.
297 298 299 300 |
# File 'lib/vendor/mysql.rb', line 297 def list_dbs(db=nil) db &&= db.gsub(/[\\\']/){"\\#{$&}"} query(db ? "show databases like '#{db}'" : "show databases").map(&:first) end |
#list_fields(table, field = nil) ⇒ Mysql::Result
Returns Mysql::Result object that is empty. Use fetch_fields to get list of fields.
411 412 413 414 415 416 417 418 419 420 421 |
# File 'lib/vendor/mysql.rb', line 411 def list_fields(table, field=nil) check_connection begin fields = @protocol.field_list_command table, field return Result.new fields rescue ServerError => e @last_error = e @sqlstate = e.sqlstate raise end end |
#list_processes ⇒ Mysql::Result
Returns containing process list.
424 425 426 427 428 429 |
# File 'lib/vendor/mysql.rb', line 424 def list_processes check_connection @fields = @protocol.process_info_command @result_exist = true store_result end |
#list_tables(table = nil) ⇒ Array<String>
for Ruby 1.8: This is not multi-byte safe. Don’t use for multi-byte charset such as cp932.
Returns list of table name.
434 435 436 437 |
# File 'lib/vendor/mysql.rb', line 434 def list_tables(table=nil) q = table ? "show tables like '#{quote table}'" : "show tables" query(q).map(&:first) end |
#more_results ⇒ Boolean Also known as: more_results?
Returns true if multiple queries are specified and unexecuted queries exists.
371 372 373 |
# File 'lib/vendor/mysql.rb', line 371 def more_results @protocol.server_status & SERVER_MORE_RESULTS_EXISTS != 0 end |
#next_result ⇒ Boolean
execute next query if multiple queries are specified.
378 379 380 381 382 383 384 385 386 387 388 |
# File 'lib/vendor/mysql.rb', line 378 def next_result return false unless more_results check_connection @fields = nil nfields = @protocol.get_result if nfields @fields = @protocol.retr_fields nfields @result_exist = true end return true end |
#options(opt, value = nil) ⇒ Mysql
Set option for connection.
Available options:
Mysql::INIT_COMMAND, Mysql::OPT_CONNECT_TIMEOUT, Mysql::OPT_READ_TIMEOUT,
Mysql::OPT_WRITE_TIMEOUT, Mysql::SET_CHARSET_NAME
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/vendor/mysql.rb', line 141 def (opt, value=nil) case opt when Mysql::INIT_COMMAND @init_command = value.to_s # when Mysql::OPT_COMPRESS when Mysql::OPT_CONNECT_TIMEOUT @connect_timeout = value # when Mysql::GUESS_CONNECTION when Mysql::OPT_LOCAL_INFILE @local_infile = value # when Mysql::OPT_NAMED_PIPE # when Mysql::OPT_PROTOCOL when Mysql::OPT_READ_TIMEOUT @read_timeout = value.to_i # when Mysql::OPT_RECONNECT # when Mysql::SET_CLIENT_IP # when Mysql::OPT_SSL_VERIFY_SERVER_CERT # when Mysql::OPT_USE_EMBEDDED_CONNECTION # when Mysql::OPT_USE_REMOTE_CONNECTION when Mysql::OPT_WRITE_TIMEOUT @write_timeout = value.to_i # when Mysql::READ_DEFAULT_FILE # when Mysql::READ_DEFAULT_GROUP # when Mysql::REPORT_DATA_TRUNCATION # when Mysql::SECURE_AUTH # when Mysql::SET_CHARSET_DIR when Mysql::SET_CHARSET_NAME @charset = Charset.by_name value.to_s # when Mysql::SHARED_MEMORY_BASE_NAME else warn "option not implemented: #{opt}" if $VERBOSE end self end |
#ping ⇒ Mysql
Check whether the connection is available.
441 442 443 444 445 |
# File 'lib/vendor/mysql.rb', line 441 def ping check_connection @protocol.ping_command self end |
#prepare(str) ⇒ Mysql::Stmt
Parse prepared-statement.
393 394 395 396 397 |
# File 'lib/vendor/mysql.rb', line 393 def prepare(str) st = Stmt.new @protocol, @charset st.prepare str st end |
#proto_info ⇒ Integer Also known as: get_proto_info
Returns protocol version.
246 247 248 |
# File 'lib/vendor/mysql.rb', line 246 def proto_info Mysql::Protocol::VERSION end |
#query(str) {|Mysql::Result| ... } ⇒ Mysql::Result, ... Also known as: real_query
Execute query string.
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
# File 'lib/vendor/mysql.rb', line 310 def query(str, &block) check_connection @fields = nil begin nfields = @protocol.query_command str if nfields @fields = @protocol.retr_fields nfields @result_exist = true end if block while true block.call store_result if @fields break unless next_result end return self end if @query_with_result return @fields ? store_result : nil else return self end rescue ServerError => e @last_error = e @sqlstate = e.sqlstate raise end end |
#refresh(op) ⇒ Mysql
Flush tables or caches.
450 451 452 453 454 |
# File 'lib/vendor/mysql.rb', line 450 def refresh(op) check_connection @protocol.refresh_command op self end |
#reload ⇒ Mysql
Reload grant tables.
458 459 460 |
# File 'lib/vendor/mysql.rb', line 458 def reload refresh Mysql::REFRESH_GRANT end |
#rollback ⇒ Mysql
Rollback transaction
491 492 493 494 |
# File 'lib/vendor/mysql.rb', line 491 def rollback query 'rollback' self end |
#select_db(db) ⇒ Mysql
Select default database
464 465 466 467 |
# File 'lib/vendor/mysql.rb', line 464 def select_db(db) query "use #{db}" self end |
#server_info ⇒ String Also known as: get_server_info
Returns server version.
252 253 254 255 |
# File 'lib/vendor/mysql.rb', line 252 def server_info check_connection @protocol.server_info end |
#server_version ⇒ Integer Also known as: get_server_version
Returns server version.
259 260 261 262 |
# File 'lib/vendor/mysql.rb', line 259 def server_version check_connection @protocol.server_version end |
#set_server_option(opt) ⇒ Mysql
Set server option.
364 365 366 367 368 |
# File 'lib/vendor/mysql.rb', line 364 def set_server_option(opt) check_connection @protocol.set_option_command opt self end |
#shutdown(level = 0) ⇒ Mysql
shutdown server.
471 472 473 474 475 |
# File 'lib/vendor/mysql.rb', line 471 def shutdown(level=0) check_connection @protocol.shutdown_command level self end |
#sqlstate ⇒ String
Returns sqlstate for last error.
230 231 232 |
# File 'lib/vendor/mysql.rb', line 230 def sqlstate @last_error ? @last_error.sqlstate : "00000" end |
#stat ⇒ String
Returns statistics message.
478 479 480 |
# File 'lib/vendor/mysql.rb', line 478 def stat @protocol ? @protocol.statistics_command : 'MySQL server has gone away' end |
#stmt_init ⇒ Mysql::Stmt
Make empty prepared-statement object.
402 403 404 |
# File 'lib/vendor/mysql.rb', line 402 def stmt_init Stmt.new @protocol, @charset end |
#store_result ⇒ Mysql::Result
Get all data for last query if query_with_result is false.
341 342 343 344 345 346 347 |
# File 'lib/vendor/mysql.rb', line 341 def store_result check_connection raise ClientError, 'invalid usage' unless @result_exist res = Result.new @fields, @protocol @result_exist = false res end |
#thread_id ⇒ Integer
Returns Thread ID.
350 351 352 353 |
# File 'lib/vendor/mysql.rb', line 350 def thread_id check_connection @protocol.thread_id end |
#use_result ⇒ Mysql::Result
Use result of query. The result data is retrieved when you use Mysql::Result#fetch.
357 358 359 |
# File 'lib/vendor/mysql.rb', line 357 def use_result store_result end |
#warning_count ⇒ Integer
Returns number of warnings for previous query.
281 282 283 |
# File 'lib/vendor/mysql.rb', line 281 def warning_count @protocol ? @protocol.warning_count : 0 end |