Skip to content
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.

Commit

Permalink
Changes to prepare for release
Browse files Browse the repository at this point in the history
  • Loading branch information
dbussink committed Jan 30, 2011
1 parent 83d72d6 commit e3a2079
Show file tree
Hide file tree
Showing 22 changed files with 70 additions and 22 deletions.
2 changes: 1 addition & 1 deletion data_objects/data_objects.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Gem::Specification.new do |s|

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Dirkjan Bussink"]
s.date = %q{2010-08-09}
s.date = %q{2011-01-29}
s.description = %q{Provide a standard and simplified API for communicating with RDBMS from Ruby}
s.email = %q{d.bussink@gmail.com}
s.extra_rdoc_files = [
Expand Down
2 changes: 1 addition & 1 deletion do_mysql/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ JRUBY = RUBY_PLATFORM =~ /java/
IRONRUBY = defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ironruby'
WINDOWS = Gem.win_platform? || (JRUBY && ENV_JAVA['os.name'] =~ /windows/i)
SUDO = WINDOWS ? '' : ('sudo' unless ENV['SUDOLESS'])
BINARY_VERSION = '5.1.46'
BINARY_VERSION = '5.1.54'

CLEAN.include(%w[ {tmp,pkg}/ **/*.{o,so,bundle,jar,log,a,gem,dSYM,obj,pdb,exp,DS_Store,rbc,db} ext/do_mysql/Makefile ext-java/target ])

Expand Down
3 changes: 2 additions & 1 deletion do_mysql/do_mysql.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Gem::Specification.new do |s|

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Dirkjan Bussink"]
s.date = %q{2010-10-24}
s.date = %q{2011-01-29}
s.description = %q{Implements the DataObjects API for MySQL}
s.email = %q{d.bussink@gmail.com}
s.extensions = ["ext/do_mysql/extconf.rb"]
Expand All @@ -27,6 +27,7 @@ Gem::Specification.new do |s|
"ext/do_mysql/do_mysql.c",
"ext/do_mysql/error.h",
"ext/do_mysql/extconf.rb",
"ext/do_mysql/mysql_compat.h",
"lib/do_mysql.rb",
"lib/do_mysql/encoding.rb",
"lib/do_mysql/transaction.rb",
Expand Down
16 changes: 16 additions & 0 deletions do_mysql/ext/do_mysql/do_mysql.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
#include "compat.h"
#include "error.h"

#ifndef HAVE_CONST_MYSQL_TYPE_STRING
#define HAVE_OLD_MYSQL_VERSION
#endif

#define CONST_GET(scope, constant) (rb_funcall(scope, ID_CONST_GET, 1, rb_str_new2(constant)))
#define DRIVER_CLASS(klass, parent) (rb_define_class_under(mMysql, klass, parent))
#define CHECK_AND_RAISE(mysql_result_value, query) if (0 != mysql_result_value) { raise_error(self, db, query); }
Expand Down Expand Up @@ -106,14 +110,18 @@ static VALUE infer_ruby_type(MYSQL_FIELD *field) {
return Qnil;
case MYSQL_TYPE_TINY:
return rb_cTrueClass;
#ifdef HAVE_CONST_MYSQL_TYPE_BIT
case MYSQL_TYPE_BIT:
#endif
case MYSQL_TYPE_SHORT:
case MYSQL_TYPE_LONG:
case MYSQL_TYPE_INT24:
case MYSQL_TYPE_LONGLONG:
case MYSQL_TYPE_YEAR:
return rb_cInteger;
#ifdef HAVE_CONST_MYSQL_TYPE_NEWDECIMAL
case MYSQL_TYPE_NEWDECIMAL:
#endif
case MYSQL_TYPE_DECIMAL:
return rb_cBigDecimal;
case MYSQL_TYPE_FLOAT:
Expand Down Expand Up @@ -277,7 +285,11 @@ static VALUE parse_date_time(const char *date) {

// Get localtime
time(&rawtime);
#ifdef HAVE_LOCALTIME_R
localtime_r(&rawtime, &timeinfo);
#else
timeinfo = *localtime(&rawtime);
#endif

timeinfo.tm_sec = sec;
timeinfo.tm_min = min;
Expand All @@ -297,7 +309,11 @@ static VALUE parse_date_time(const char *date) {
}

// Reset to GM Time
#ifdef HAVE_GMTIME_R
gmtime_r(&rawtime, &timeinfo);
#else
timeinfo = *gmtime(&rawtime);
#endif

gmt_offset = rawtime - mktime(&timeinfo);

Expand Down
6 changes: 6 additions & 0 deletions do_mysql/ext/do_mysql/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,14 @@ def default_prefix
find_header('mysql.h', *lib_dirs.flatten.map { |p| p.gsub('/lib', '/include') })
end

have_func('localtime_r')
have_func('gmtime_r')

unless RUBY_PLATFORM =~ /mswin|mingw/
have_header 'mysql.h'
have_const 'MYSQL_TYPE_STRING', 'mysql.h'
have_const 'MYSQL_TYPE_BIT', 'mysql.h'
have_const 'MYSQL_TYPE_NEWDECIMAL', 'mysql.h'
have_func 'mysql_query', 'mysql.h'
have_func 'mysql_ssl_set', 'mysql.h'
have_func 'mysql_sqlstate', 'mysql.h'
Expand Down
4 changes: 1 addition & 3 deletions do_mysql/ext/do_mysql/mysql_compat.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#if (MYSQL_VERSION_ID < 40100)
#ifdef HAVE_OLD_MYSQL_VERSION
#define MYSQL_TYPE_VAR_STRING FIELD_TYPE_VAR_STRING
#define MYSQL_TYPE_STRING FIELD_TYPE_STRING
#define MYSQL_TYPE_DECIMAL FIELD_TYPE_DECIMAL
#define MYSQL_TYPE_NEWDECIMAL FIELD_TYPE_DECIMAL
#define MYSQL_TYPE_SHORT FIELD_TYPE_SHORT
#define MYSQL_TYPE_BIT FIELD_TYPE_SHORT
#define MYSQL_TYPE_LONG FIELD_TYPE_LONG
#define MYSQL_TYPE_FLOAT FIELD_TYPE_FLOAT
#define MYSQL_TYPE_DOUBLE FIELD_TYPE_DOUBLE
Expand Down
2 changes: 1 addition & 1 deletion do_mysql/tasks/release.rake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ task :build_all do
`rake clean`
`rake build`
`rake java gem`
`rake cross native gem RUBY_CC_VERSION=1.8.6:1.9.1`
`rake cross native gem RUBY_CC_VERSION=1.8.7:1.9.2`
end

desc 'Release all gems (native, binaries for JRuby and Windows)'
Expand Down
2 changes: 1 addition & 1 deletion do_oracle/do_oracle.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Gem::Specification.new do |s|

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Raimonds Simanovskis"]
s.date = %q{2010-10-24}
s.date = %q{2011-01-29}
s.description = %q{Implements the DataObjects API for Oracle}
s.email = %q{raimonds.simanovskis@gmail.com}
s.extensions = ["ext/do_oracle/extconf.rb"]
Expand Down
2 changes: 1 addition & 1 deletion do_oracle/tasks/compile.rake
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ begin
ext.lib_dir = "lib/#{gemspec.name}"
ext.ext_dir = 'ext-java/src/main/java'
ext.debug = ENV.has_key?('DO_JAVA_DEBUG') && ENV['DO_JAVA_DEBUG']
ext.classpath = '../do_jdbc/lib/do_jdbc_internal.jar'
ext.classpath = '../do_jdbc/lib/do_jdbc_internal.jar:../jdbc_drivers/oracle/ojdbc5.jar'
ext.java_compiling do |gem|

# Hack: Unfortunately there is no way to remove a dependency in the
Expand Down
2 changes: 1 addition & 1 deletion do_oracle/tasks/release.rake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ task :build_all do
`rake clean`
`rake build`
`rake java gem`
`rake cross native gem RUBY_CC_VERSION=1.8.6:1.9.1`
`rake cross native gem RUBY_CC_VERSION=1.8.7:1.9.2`
end

desc 'Release all gems (native, binaries for JRuby and Windows)'
Expand Down
2 changes: 1 addition & 1 deletion do_postgres/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ JRUBY = RUBY_PLATFORM =~ /java/
IRONRUBY = defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ironruby'
WINDOWS = Gem.win_platform? || (JRUBY && ENV_JAVA['os.name'] =~ /windows/i)
SUDO = WINDOWS ? '' : ('sudo' unless ENV['SUDOLESS'])
BINARY_VERSION = '8.3.10'
BINARY_VERSION = '8.3.13'

CLEAN.include(%w[ {tmp,pkg}/ **/*.{o,so,bundle,jar,log,a,gem,dSYM,obj,pdb,exp,DS_Store,rbc,db} ext/do_postgres/Makefile ext-java/target ])

Expand Down
2 changes: 1 addition & 1 deletion do_postgres/do_postgres.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Gem::Specification.new do |s|

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Dirkjan Bussink"]
s.date = %q{2010-10-24}
s.date = %q{2011-01-29}
s.description = %q{Implements the DataObjects API for PostgreSQL}
s.email = %q{d.bussink@gmail.com}
s.extensions = ["ext/do_postgres/extconf.rb"]
Expand Down
10 changes: 10 additions & 0 deletions do_postgres/ext/do_postgres/do_postgres.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,12 @@ static VALUE parse_date_time(const char *date) {

// Get localtime
time(&rawtime);
#ifdef HAVE_LOCALTIME_R
localtime_r(&rawtime, &timeinfo);
#else
// Thread unsafe, this is used on Windows...
timeinfo = *localtime(&rawtime);
#endif

timeinfo.tm_sec = sec;
timeinfo.tm_min = min;
Expand All @@ -257,8 +262,13 @@ static VALUE parse_date_time(const char *date) {
dst_adjustment = 0;
}

#ifdef HAVE_GMTIME_R
// Reset to GM Time
gmtime_r(&rawtime, &timeinfo);
#else
// Same as for localtime_r above
timeinfo = *gmtime(&rawtime);
#endif

gmt_offset = rawtime - mktime(&timeinfo);

Expand Down
4 changes: 2 additions & 2 deletions do_postgres/ext/do_postgres/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ def have_build_env
have_header('catalog/pg_type.h')
end

$CFLAGS << '-UENABLE_NLS -DHAVE_GETTIMEOFDAY -DHAVE_CRYPT' if RUBY_PLATFORM =~ /mswin|mingw/
$CFLAGS << ' -UENABLE_NLS -DHAVE_GETTIMEOFDAY -DHAVE_CRYPT' if RUBY_PLATFORM =~ /mswin|mingw/

dir_config('pgsql-server', config_value('includedir-server'), config_value('libdir'))
dir_config('pgsql-client', config_value('includedir'), config_value('libdir'))
dir_config('pgsql-win32') if RUBY_PLATFORM =~ /mswin|mingw/

desired_functions = %w(PQsetClientEncoding pg_encoding_to_char PQfreemem)
desired_functions = %w(localtime_r gmtime_r PQsetClientEncoding pg_encoding_to_char PQfreemem)
compat_functions = %w(PQescapeString PQexecParams)

if have_build_env
Expand Down
2 changes: 1 addition & 1 deletion do_postgres/tasks/release.rake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ task :build_all do
`rake clean`
`rake build`
`rake java gem`
`rake cross native gem RUBY_CC_VERSION=1.8.6:1.9.1`
`rake cross native gem RUBY_CC_VERSION=1.8.7:1.9.2`
end

desc 'Release all gems (native, binaries for JRuby and Windows)'
Expand Down
2 changes: 1 addition & 1 deletion do_sqlite3/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ JRUBY = RUBY_PLATFORM =~ /java/
IRONRUBY = defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ironruby'
WINDOWS = Gem.win_platform? || (JRUBY && ENV_JAVA['os.name'] =~ /windows/i)
SUDO = WINDOWS ? '' : ('sudo' unless ENV['SUDOLESS'])
BINARY_VERSION = '3_6_23_1'
BINARY_VERSION = '3070400'

CLEAN.include(%w[ {tmp,pkg}/ **/*.{o,so,bundle,jar,log,a,gem,dSYM,obj,pdb,exp,DS_Store,rbc,db} ext/do_sqlite3/Makefile ext-java/target ])

Expand Down
2 changes: 1 addition & 1 deletion do_sqlite3/do_sqlite3.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Gem::Specification.new do |s|

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Dirkjan Bussink"]
s.date = %q{2010-10-24}
s.date = %q{2011-01-29}
s.description = %q{Implements the DataObjects API for Sqlite3}
s.email = %q{d.bussink@gmail.com}
s.extensions = ["ext/do_sqlite3/extconf.rb"]
Expand Down
13 changes: 13 additions & 0 deletions do_sqlite3/ext/do_sqlite3/do_sqlite3.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,11 @@ static VALUE parse_date_time(char *date) {

// Get localtime
time(&rawtime);
#ifdef HAVE_LOCALTIME_R
localtime_r(&rawtime, &timeinfo);
#else
timeinfo = *localtime(&rawtime);
#endif

timeinfo.tm_sec = sec;
timeinfo.tm_min = min;
Expand All @@ -203,7 +207,11 @@ static VALUE parse_date_time(char *date) {
}

// Reset to GM Time
#ifdef HAVE_GMTIME_R
gmtime_r(&rawtime, &timeinfo);
#else
timeinfo = *gmtime(&rawtime);
#endif

gmt_offset = rawtime - mktime(&timeinfo);

Expand Down Expand Up @@ -663,6 +671,10 @@ static VALUE cReader_next(VALUE self) {
VALUE field_type;
VALUE value;

if(rb_iv_get(self, "@done") == Qtrue) {
return Qfalse;
}

Data_Get_Struct(rb_iv_get(self, "@reader"), sqlite3_stmt, reader);
field_count = NUM2INT(rb_iv_get(self, "@field_count"));

Expand All @@ -675,6 +687,7 @@ static VALUE cReader_next(VALUE self) {

if ( result != SQLITE_ROW ) {
rb_iv_set(self, "@values", Qnil);
rb_iv_set(self, "@done", Qtrue);
return Qfalse;
}

Expand Down
2 changes: 2 additions & 0 deletions do_sqlite3/ext/do_sqlite3/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
# Do the work
# create_makefile(extension_name)
if have_header( "sqlite3.h" ) && have_library( "sqlite3", "sqlite3_open" )
have_func("localtime_r")
have_func("gmtime_r")
have_func("sqlite3_prepare_v2")
have_func("sqlite3_open_v2")

Expand Down
2 changes: 1 addition & 1 deletion do_sqlite3/tasks/release.rake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ task :build_all do
`rake clean`
`rake build`
`rake java gem`
`rake cross native gem RUBY_CC_VERSION=1.8.6:1.9.1`
`rake cross native gem RUBY_CC_VERSION=1.8.7:1.9.2`
end

desc 'Release all gems (native, binaries for JRuby and Windows)'
Expand Down
8 changes: 4 additions & 4 deletions do_sqlite3/tasks/retrieve.rake
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ begin
end

# download dll binaries
file "vendor/sqlitedll-#{BINARY_VERSION}.zip" => ['vendor'] do |t|
file "vendor/sqlite-dll-win32-x86-#{BINARY_VERSION}.zip" => ['vendor'] do |t|
url = "http://www.sqlite.org/#{File.basename(t.name)}"
when_writing "downloading #{t.name}" do
cd File.dirname(t.name) do
Expand All @@ -56,19 +56,19 @@ begin
full_file = File.expand_path(t.prerequisites.last)
when_writing "creating #{t.name}" do
cd File.dirname(t.name) do
sh "unzip #{full_file}"
sh "unzip -j #{full_file}"
# update file timestamp to avoid Rake perform this extraction again.
touch File.basename(t.name)
end
end
end

# extract dll files into lib folder
file "vendor/sqlite3/lib/sqlite3.dll" => ['vendor/sqlite3/lib', "vendor/sqlitedll-#{BINARY_VERSION}.zip"] do |t|
file "vendor/sqlite3/lib/sqlite3.dll" => ['vendor/sqlite3/lib', "vendor/sqlite-dll-win32-x86-#{BINARY_VERSION}.zip"] do |t|
full_file = File.expand_path(t.prerequisites.last)
when_writing "creating #{t.name}" do
cd File.dirname(t.name) do
sh "unzip #{full_file}"
sh "unzip -j #{full_file}"
# update file timestamp to avoid Rake perform this extraction again.
touch File.basename(t.name)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static data_objects.util.DynamicProxyUtil.*;
import data_objects.drivers.AbstractDriverDefinition;
import data_objects.util.JDBCUtil;

public class SqlServerDriverDefinition extends AbstractDriverDefinition {

Expand Down

0 comments on commit e3a2079

Please sign in to comment.