2010-04-03 23:51:10 +00:00
|
|
|
#include <time.h>
|
2010-03-26 08:03:08 +00:00
|
|
|
#include <ruby.h>
|
|
|
|
|
2010-04-07 14:03:31 +00:00
|
|
|
#ifdef HAVE_MYSQL_H
|
|
|
|
#include <mysql.h>
|
|
|
|
#include <mysql_com.h>
|
|
|
|
#include <errmsg.h>
|
|
|
|
#include <mysqld_error.h>
|
|
|
|
#else
|
2010-03-26 08:03:08 +00:00
|
|
|
#include <mysql/mysql.h>
|
|
|
|
#include <mysql/mysql_com.h>
|
|
|
|
#include <mysql/errmsg.h>
|
|
|
|
#include <mysql/mysqld_error.h>
|
2010-04-07 14:03:31 +00:00
|
|
|
#endif
|
2010-03-26 08:03:08 +00:00
|
|
|
|
2010-04-01 19:56:49 +00:00
|
|
|
#ifdef HAVE_RUBY_ENCODING_H
|
|
|
|
#include <ruby/encoding.h>
|
2010-04-01 21:29:20 +00:00
|
|
|
int utf8Encoding, binaryEncoding;
|
2010-04-01 19:56:49 +00:00
|
|
|
#endif
|
|
|
|
|
2010-04-03 23:51:10 +00:00
|
|
|
static VALUE cBigDecimal, cDate, cDateTime;
|
|
|
|
ID intern_new, intern_local;
|
2010-03-31 06:30:06 +00:00
|
|
|
|
2010-04-05 06:46:42 +00:00
|
|
|
/* Mysql2::Error */
|
|
|
|
VALUE cMysql2Error;
|
|
|
|
|
2010-03-30 16:56:24 +00:00
|
|
|
/* Mysql2::Client */
|
|
|
|
#define GetMysql2Client(obj, sval) (sval = (MYSQL*)DATA_PTR(obj));
|
2010-04-03 19:15:16 +00:00
|
|
|
static ID sym_socket, sym_host, sym_port, sym_username, sym_password,
|
2010-04-06 05:47:16 +00:00
|
|
|
sym_database, sym_reconnect, sym_connect_timeout, sym_id, sym_version,
|
2010-04-07 16:16:30 +00:00
|
|
|
sym_sslkey, sym_sslcert, sym_sslca, sym_sslcapath, sym_sslcipher,
|
|
|
|
sym_symbolize_keys, sym_async;
|
2010-04-03 03:14:29 +00:00
|
|
|
static VALUE rb_mysql_client_new(int argc, VALUE * argv, VALUE klass);
|
2010-04-07 16:16:30 +00:00
|
|
|
static VALUE rb_mysql_client_init(int argc, VALUE * argv, VALUE self);
|
|
|
|
static VALUE rb_mysql_client_query(int argc, VALUE * argv, VALUE self);
|
2010-04-01 18:44:59 +00:00
|
|
|
static VALUE rb_mysql_client_escape(VALUE self, VALUE str);
|
2010-04-03 19:15:16 +00:00
|
|
|
static VALUE rb_mysql_client_info(VALUE self);
|
|
|
|
static VALUE rb_mysql_client_server_info(VALUE self);
|
2010-04-05 06:31:32 +00:00
|
|
|
static VALUE rb_mysql_client_socket(VALUE self);
|
2010-04-07 16:16:30 +00:00
|
|
|
static VALUE rb_mysql_client_async_result(VALUE self);
|
2010-04-07 16:36:36 +00:00
|
|
|
static VALUE rb_mysql_client_last_id(VALUE self);
|
2010-04-07 16:47:45 +00:00
|
|
|
static VALUE rb_mysql_client_affected_rows(VALUE self);
|
2010-03-26 08:03:08 +00:00
|
|
|
void rb_mysql_client_free(void * client);
|
|
|
|
|
2010-03-30 16:56:24 +00:00
|
|
|
/* Mysql2::Result */
|
|
|
|
#define GetMysql2Result(obj, sval) (sval = (MYSQL_RES*)DATA_PTR(obj));
|
|
|
|
VALUE cMysql2Result;
|
2010-03-26 08:03:08 +00:00
|
|
|
static VALUE rb_mysql_result_to_obj(MYSQL_RES * res);
|
2010-03-30 16:56:24 +00:00
|
|
|
static VALUE rb_mysql_result_fetch_row(int argc, VALUE * argv, VALUE self);
|
2010-04-02 22:32:58 +00:00
|
|
|
static VALUE rb_mysql_result_each(int argc, VALUE * argv, VALUE self);
|
2010-04-01 19:04:48 +00:00
|
|
|
void rb_mysql_result_free(void * result);
|