diff -ru a/ext/sqlite-api.c b/ext/sqlite-api.c --- a/ext/sqlite-api.c 1970-01-01 01:00:00.000000000 +0100 +++ b/ext/sqlite-api.c 2008-10-01 14:23:25.000000000 +0200 @@ -67,6 +67,12 @@ /* special macro for helping RDoc to ignore "section"-level comments. */ #define NO_RDOC +/* Ruby 1.9 compatiblity */ +#ifndef RSTRING_LEN +#define RSTRING_LEN(str) RSTRING(str)->len +#define RSTRING_PTR(str) RSTRING(str)->ptr +#endif + /*>=-----------------------------------------------------------------------=<* * CONSTANTS * ------------------------------------------------------------------------ @@ -780,8 +786,8 @@ { case T_STRING: sqlite_set_result_string( func_ptr, - RSTRING(result)->ptr, - RSTRING(result)->len ); + RSTRING_PTR(result), + RSTRING_LEN(result) ); break; case T_FIXNUM: @@ -817,8 +823,8 @@ GetFunc( func_ptr, func ); Check_Type( string, T_STRING ); - sqlite_set_result_error( func_ptr, RSTRING(string)->ptr, - RSTRING(string)->len ); + sqlite_set_result_error( func_ptr, RSTRING_PTR(string), + RSTRING_LEN(string) ); return string; } diff -ru a/lib/sqlite/database.rb b/lib/sqlite/database.rb --- a/lib/sqlite/database.rb 1970-01-01 01:00:00.000000000 +0100 +++ b/lib/sqlite/database.rb 2008-10-01 16:42:34.000000000 +0200 @@ -30,7 +30,6 @@ # ============================================================================= #++ -require 'base64' require 'sqlite_api' require 'sqlite/pragmas' require 'sqlite/statement' @@ -85,13 +84,13 @@ # Returns a string that represents the serialization of the given object. # The string may safely be used in an SQL statement. def self.encode( object ) - Base64.encode64( Marshal.dump( object ) ).strip + [Marshal.dump(object)].pack('m').strip end # Unserializes the object contained in the given string. The string must be # one that was returned by #encode. def self.decode( string ) - Marshal.load( Base64.decode64( string ) ) + Marshal.load( string.unpack('m').first ) end # Return +true+ if the string is a valid (ie, parsable) SQL statement, and diff -ru a/lib/sqlite/pragmas.rb b/lib/sqlite/pragmas.rb --- a/lib/sqlite/pragmas.rb 1970-01-01 01:00:00.000000000 +0100 +++ b/lib/sqlite/pragmas.rb 2008-10-01 16:46:45.000000000 +0200 @@ -60,8 +60,8 @@ case mode when String case mode.downcase - when "on", "yes", "true", "y", "t": mode = "'ON'" - when "off", "no", "false", "n", "f": mode = "'OFF'" + when "on", "yes", "true", "y", "t" then mode = "'ON'" + when "off", "no", "false", "n", "f" then mode = "'OFF'" else raise Exceptions::DatabaseException, "unrecognized pragma parameter #{mode.inspect}"