Skip to content

Instantly share code, notes, and snippets.

@brianmario
Created September 7, 2010 22:42
Show Gist options
  • Save brianmario/569282 to your computer and use it in GitHub Desktop.
Save brianmario/569282 to your computer and use it in GitHub Desktop.
Mysql2::EM::Client
- should support async queries
Mysql2::Client
- should accept connect flags and pass them to #connect
- should default flags to 0
- should have a global default_query_options hash
- should be able to connect via SSL options (PENDING: DON'T WORRY, THIS TEST PASSES :) - but is machine-specific. You need to have MySQL running with SSL configured and enabled. Then update the paths in this test to your needs and remove the pending state.)
- should respond to #close
- should be able to close properly
- should respond to #query
- should respond to #escape
- #escape should return a new SQL-escape version of the passed string
- #escape should return the passed string if nothing was escaped
- #escape should not overflow the thread stack
- #escape should not overflow the process stack
- should respond to #info
- #info should return a hash containing the client version ID and String
- should respond to #server_info
- #server_info should return a hash containing the client version ID and String
- should respond to #socket
- #socket should return a Fixnum (file descriptor from C)
- should raise a Mysql2::Error exception upon connection failure
- threaded queries should be supported
- evented async queries should be supported
Mysql2::Client#query
- should accept an options hash that inherits from Mysql2::Client.default_query_options
- should return results as a hash by default
- should be able to return results as an array
- should be able to return results with symbolized keys
- should not allow another query to be sent without fetching a result first
- should run signal handlers while waiting for a response (FAILED - 1)
Mysql2::Client write operations api
- should respond to #last_id
- #last_id should return a Fixnum, the from the last INSERT/UPDATE
- should respond to #last_id
- #last_id should return a Fixnum, the from the last INSERT/UPDATE
Mysql2::Error
- should respond to #error_number
- should respond to #sql_state
- should alias #error_number to #errno
- should alias #message to #error
Mysql2::Result
- should have included Enumerable
- should respond to #each
- should raise a Mysql2::Error exception upon a bad query
Mysql2::Result#each
- should yield rows as hash's
- should yield rows as hash's with symbol keys if :symbolize_keys was set to true
- should be able to return results as an array
- should cache previously yielded results by default
- should not cache previously yielded results if cache_rows is disabled
Mysql2::Result#fields
- method should exist
- should return an array of field names in proper order
Mysql2::Result row data type mapping
- should return nil for a NULL value
- should return Fixnum for a BIT value
- should return Fixnum for a TINYINT value
- should return TrueClass or FalseClass for a TINYINT value if :cast_booleans is enabled
- should return Fixnum for a SMALLINT value
- should return Fixnum for a MEDIUMINT value
- should return Fixnum for an INT value
- should return Fixnum for a BIGINT value
- should return Fixnum for a YEAR value
- should return BigDecimal for a DECIMAL value
- should return Float for a FLOAT value
- should return Float for a DOUBLE value
- should return Time for a DATETIME value when within the supported range
- should return DateTime for a DATETIME value when outside the supported range
- should return Time for a TIMESTAMP value when within the supported range
- should return Time for a TIME value
- should return Date for a DATE value
- should return String for an ENUM value
- should return String for a SET value
- should return String for a BINARY value
- should return a String for VARCHAR
- should return a String for MEDIUMTEXT
- should return a String for LONGTEXT
- should return a String for TEXT
- should return a String for TINYBLOB
- should return a String for MEDIUMBLOB
- should return a String for TINYTEXT
- should return a String for BLOB
- should return a String for CHAR
- should return a String for VARBINARY
- should return a String for LONGBLOB
Pending:
Mysql2::Client should be able to connect via SSL options (DON'T WORRY, THIS TEST PASSES :) - but is machine-specific. You need to have MySQL running with SSL configured and enabled. Then update the paths in this test to your needs and remove the pending state.)
/Users/brianmario/Sites/opensource/mysql2.git/spec/mysql2/client_spec.rb:45:in `__script__ {}'
1)
ArgumentError in 'Mysql2::Client#query should run signal handlers while waiting for a response'
NULL pointer given
/Users/brianmario/Sites/opensource/mysql2.git/spec/mysql2/client_spec.rb:119:in `__script__ {}'
kernel/common/eval.rb:158:in `instance_eval'
/Users/brianmario/.rvm/rubies/rbx-head/lib/timeout.rb:134:in `timeout'
kernel/bootstrap/array.rb:163:in `each'
kernel/bootstrap/array.rb:163:in `each'
kernel/common/kernel.rb:626:in `load'
kernel/delta/codeloader.rb:67:in `load_script'
kernel/delta/codeloader.rb:91:in `load_script'
kernel/loader.rb:431:in `script'
kernel/loader.rb:523:in `main'
kernel/loader.rb:549:in `main'
kernel/loader.rb:561:in `__script__'
Finished in 3.097655 seconds
77 examples, 1 failure, 1 pending
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment