You can subscribe to this list here.
2002 |
Jan
|
Feb
(3) |
Mar
|
Apr
(12) |
May
(11) |
Jun
(2) |
Jul
(37) |
Aug
(3) |
Sep
(24) |
Oct
(31) |
Nov
|
Dec
(4) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(3) |
Feb
(7) |
Mar
|
Apr
(11) |
May
(15) |
Jun
(7) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(4) |
Dec
|
2004 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Michael N. <mne...@us...> - 2004-04-22 17:45:20
|
Update of /cvsroot/ruby-dbi/src/lib/dbd_frontbase In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13315/dbd_frontbase Log Message: Directory /cvsroot/ruby-dbi/src/lib/dbd_frontbase added to the repository |
From: Michael N. <mne...@us...> - 2003-11-22 21:22:24
|
Update of /cvsroot/ruby-dbi/subprojects/ruby-db2 In directory sc8-pr-cvs1:/tmp/cvs-serv1954 Modified Files: ChangeLog Log Message: * Index: ChangeLog =================================================================== RCS file: /cvsroot/ruby-dbi/subprojects/ruby-db2/ChangeLog,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ChangeLog 11 Sep 2003 15:47:06 -0000 1.2 +++ ChangeLog 22 Nov 2003 21:22:21 -0000 1.3 @@ -1,6 +1,9 @@ =begin = ChangeLog for Ruby/DB2 : 0.4 +* fixed bug in db2_SQLGetData, that caused the last character of a SQL_CHAR + column to be null (S. Veit) +* fixes bug in SQLGetData that occurs for SQL_BIGINTs (S. Veit) * db2_SQLDataSources: remove null-termination if it exists (by S. Veit) * SQLColumns method added (by S. Veit) * Some SQL_XXX constants added (by S. Veit) |
From: Michael N. <mne...@us...> - 2003-11-22 21:03:02
|
Update of /cvsroot/ruby-dbi/subprojects/ruby-db2/ext/db2 In directory sc8-pr-cvs1:/tmp/cvs-serv31392 Modified Files: db2cli.c Log Message: fixed bug in db2_SQLGetData, that caused the last character of a SQL_CHAR column to be null. Index: db2cli.c =================================================================== RCS file: /cvsroot/ruby-dbi/subprojects/ruby-db2/ext/db2/db2cli.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- db2cli.c 22 Nov 2003 16:56:46 -0000 1.4 +++ db2cli.c 22 Nov 2003 21:02:56 -0000 1.5 @@ -843,8 +843,8 @@ case SQL_DECIMAL: case SQL_NUMERIC: - ptr = (SQLPOINTER) ALLOC_N(SQLCHAR, bl); - CALL_SQL_GET_DATA(ptr, SQL_C_CHAR, bl); + ptr = (SQLPOINTER) ALLOC_N(SQLCHAR, bl + 1); + CALL_SQL_GET_DATA(ptr, SQL_C_CHAR, bl + 1); RETVAL( rb_str_new(ptr, MIN(bl, strlen_or_indptr)) ); free((void*)ptr); |
From: Michael N. <mne...@us...> - 2003-11-22 16:56:49
|
Update of /cvsroot/ruby-dbi/subprojects/ruby-db2/ext/db2 In directory sc8-pr-cvs1:/tmp/cvs-serv19572 Modified Files: db2cli.c Log Message: fixes bug in SQLGetData that occurs for SQL_BIGINTs Index: db2cli.c =================================================================== RCS file: /cvsroot/ruby-dbi/subprojects/ruby-db2/ext/db2/db2cli.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- db2cli.c 11 Sep 2003 15:47:07 -0000 1.3 +++ db2cli.c 22 Nov 2003 16:56:46 -0000 1.4 @@ -885,8 +885,21 @@ /* TODO: How large can a BIGINT be? ==> expect 200 bytes, should be enought? */ ptr = (SQLPOINTER) ALLOC_N(SQLCHAR, MAX(bl,200)); CALL_SQL_GET_DATA(ptr, SQL_C_CHAR, bl); - RETVAL( rb_str_new(ptr, MIN(bl, strlen_or_indptr)) ); - rc = rb_funcall(rc, rb_intern("to_i"), 0); + + if (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO) { + if (strlen_or_indptr == SQL_NULL_DATA) { + retval = objNull; + } + else { + /* convert string to integer */ + retval = rb_str_new(ptr, MIN(bl, strlen_or_indptr)); + retval = rb_funcall(retval, rb_intern("to_i"), 0); + } + } + else { + retval = Qnil; + } + free((void*)ptr); break; |
From: Michael N. <mne...@us...> - 2003-11-05 21:24:21
|
Update of /cvsroot/ruby-dbi/src/lib/dbi In directory sc8-pr-cvs1:/tmp/cvs-serv28091 Modified Files: dbi.rb Log Message: StatementHandle#execute returns nil instead for internal use intended DBI::Row object Index: dbi.rb =================================================================== RCS file: /cvsroot/ruby-dbi/src/lib/dbi/dbi.rb,v retrieving revision 1.40 retrieving revision 1.41 diff -u -r1.40 -r1.41 --- dbi.rb 11 Sep 2003 20:57:35 -0000 1.40 +++ dbi.rb 5 Nov 2003 20:46:16 -0000 1.41 @@ -773,6 +773,7 @@ #if @row.nil? @row = DBI::Row.new(column_names,nil) #end + return nil end def finish |
From: Michael N. <mne...@us...> - 2003-06-10 21:40:23
|
Update of /cvsroot/ruby-dbi/src/lib/dbi In directory sc8-pr-cvs1:/tmp/cvs-serv7801 Modified Files: sql.rb Log Message: fixed SQL tokenizer bug: single slashes are preserved Index: sql.rb =================================================================== RCS file: /cvsroot/ruby-dbi/src/lib/dbi/sql.rb,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- sql.rb 16 May 2003 09:43:05 -0000 1.15 +++ sql.rb 10 Jun 2003 21:40:16 -0000 1.16 @@ -152,6 +152,7 @@ | - (?# matches single "-" ) | /[*] .*? [*]/ (?# matches C-style comments ) + | / (?# matches single slash ) | ' ( [^'\\] | '' | \\. )* ' (?# match strings surrounded by apostophes ) | |
From: Michael N. <mne...@us...> - 2003-06-10 21:40:23
|
Update of /cvsroot/ruby-dbi/src/lib/dbi/test In directory sc8-pr-cvs1:/tmp/cvs-serv7801/test Modified Files: testsqlbind.rb Log Message: fixed SQL tokenizer bug: single slashes are preserved Index: testsqlbind.rb =================================================================== RCS file: /cvsroot/ruby-dbi/src/lib/dbi/test/testsqlbind.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- testsqlbind.rb 16 May 2003 09:44:07 -0000 1.7 +++ testsqlbind.rb 10 Jun 2003 21:40:16 -0000 1.8 @@ -73,6 +73,13 @@ assert_equal sql, bind(self, sql, []) end + def test_slash + sql = "SELECT 5 / 4" + res = "SELECT 5 / 4" + assert_equal res, bind(self, sql, []) + end + + end $last_suite.add_test (TestSqlBind.suite) |
From: Michael N. <mne...@us...> - 2003-06-06 11:36:10
|
Update of /cvsroot/ruby-dbi/src/lib/dbi In directory sc8-pr-cvs1:/tmp/cvs-serv17052/lib/dbi Modified Files: version.rb Log Message: new version Index: version.rb =================================================================== RCS file: /cvsroot/ruby-dbi/src/lib/dbi/version.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- version.rb 27 Apr 2003 18:54:18 -0000 1.5 +++ version.rb 6 Jun 2003 10:54:22 -0000 1.6 @@ -4,6 +4,6 @@ module DBI -VERSION = "0.0.19" +VERSION = "0.0.20" end |
From: Michael N. <mne...@us...> - 2003-06-06 11:36:09
|
Update of /cvsroot/ruby-dbi/src/build In directory sc8-pr-cvs1:/tmp/cvs-serv17052/build Modified Files: DBI-VERSIONS Log Message: new version Index: DBI-VERSIONS =================================================================== RCS file: /cvsroot/ruby-dbi/src/build/DBI-VERSIONS,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- DBI-VERSIONS 27 Apr 2003 18:51:55 -0000 1.4 +++ DBI-VERSIONS 6 Jun 2003 10:54:22 -0000 1.5 @@ -1,4 +1,5 @@ # All times are in UCT +dbi-0-0-20 2003-06-06 12:00 UTC dbi-0-0-19 2003-04-27 23:00 UTC dbi-0-0-18 2002-10-22 23:00 UTC dbi-0-0-17 2002-10-03 10:00 UTC |
From: Michael N. <mne...@us...> - 2003-06-06 10:48:25
|
Update of /cvsroot/ruby-dbi/src/doc In directory sc8-pr-cvs1:/tmp/cvs-serv14805 Modified Files: index.rd Log Message: contributors added Index: index.rd =================================================================== RCS file: /cvsroot/ruby-dbi/src/doc/index.rd,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- index.rd 16 May 2003 09:50:43 -0000 1.30 +++ index.rd 6 Jun 2003 10:48:22 -0000 1.31 @@ -72,7 +72,8 @@ Submitted several patches and helped with lots of comments; Co-owner of the project. : MoonWolf quote/escape_bytea patch for DBD Pg. - DBD::SQLite patch + DBD::SQLite patch and Database#columns implementation. + Further patches. : Paul DuBois Fixed typos and formatting. Maintains DBD Mysql. @@ -83,6 +84,8 @@ : Florian G. Pflug Discussion and helpful comments/benchmarks about DBD::Pg async_exec vs. exec. +: Oliver M. Bolzer + Patches to support Postgres arrays for DBD::Pg == Database Drivers (DBDs) |
From: Michael N. <mne...@us...> - 2003-06-03 18:46:51
|
Update of /cvsroot/ruby-dbi/src/lib/dbi In directory sc8-pr-cvs1:/tmp/cvs-serv21610 Modified Files: utils.rb Log Message: TableFormatter: convert false to "false", not "NULL" (MoonWolf) Index: utils.rb =================================================================== RCS file: /cvsroot/ruby-dbi/src/lib/dbi/utils.rb,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- utils.rb 31 May 2003 15:52:20 -0000 1.11 +++ utils.rb 3 Jun 2003 18:46:47 -0000 1.12 @@ -127,7 +127,8 @@ col_lengths = (0...(header.size)).collect do |colnr| [ (0...rows.size).collect { |rownr| - (rows[rownr][colnr] || "NULL").to_s.size + value = rows[rownr][colnr] + (value.nil? ? "NULL" : value).to_s.size }.max, header[colnr].size ].max @@ -144,7 +145,7 @@ output << indent + "|" row.each_with_index {|c,i| output << cellspace - str = (c || "NULL").to_s + str = (c.nil? ? "NULL" : c).to_s output << case orient when :left then str.ljust(col_lengths[i]) when :right then str.rjust(col_lengths[i]) |
From: Michael N. <mne...@us...> - 2003-06-03 18:42:43
|
Update of /cvsroot/ruby-dbi/src/ext/dbd_sqlite In directory sc8-pr-cvs1:/tmp/cvs-serv19403 Modified Files: SQLite.c Log Message: Database#columns method added (MoonWolf) Index: SQLite.c =================================================================== RCS file: /cvsroot/ruby-dbi/src/ext/dbd_sqlite/SQLite.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- SQLite.c 14 May 2003 19:52:07 -0000 1.6 +++ SQLite.c 3 Jun 2003 18:42:38 -0000 1.7 @@ -436,6 +436,66 @@ } static VALUE +Database_columns(VALUE self, VALUE tablename) +{ + struct sDatabase *db; + struct sTable *tb; + VALUE sql_type, table, columns, hash; + VALUE str; + VALUE col_name, type_name; + int state, i, j, pos, row_index; + char *errmsg; + + Data_Get_Struct(self, struct sDatabase, db); + + /* build SQL statement */ + sql_type = rb_str_new2("PRAGMA table_info("); + rb_str_concat(sql_type, tablename); + rb_str_cat(sql_type, ")", 1); + + table = Data_Make_Struct(rb_cObject, struct sTable, 0, table_free, tb); + + /* execute SQL */ + state = sqlite_get_table(db->conn, STR2CSTR(sql_type), &tb->result, &tb->nrow, &tb->ncolumn, &errmsg); + if (state != SQLITE_OK) { + VALUE errstr; + errstr = rb_str_new2(errmsg); free(errmsg); + rb_str_cat(errstr, "(", 1); rb_str_concat(errstr, rb_str_new2(sqliteErrStr(state))); + rb_str_cat(errstr, ")", 1); + rb_raise(eDatabaseError, STR2CSTR(errstr)); + } + + columns = rb_ary_new(); + for (row_index=0; row_index < tb->nrow ; row_index++) { + pos = (row_index+1)*tb->ncolumn; + + hash = rb_hash_new(); + rb_ary_store(columns, row_index, hash); + if (tb->result[pos] != NULL) { + col_name = rb_str_new2(tb->result[pos+1]); + rb_hash_aset(hash, rb_str_new2("name"), col_name); + + type_name = rb_str_new2(tb->result[pos+2]); + rb_hash_aset(hash, rb_str_new2("type_name"), type_name); + + if (tb->result[pos+3] != NULL) { + if (strcmp(tb->result[pos+3],"0")) { + rb_hash_aset(hash, rb_str_new2("nullable"), Qfalse); + } else { + rb_hash_aset(hash, rb_str_new2("nullable"), Qtrue); + } + } + + if ((tb->result[pos+4]) != NULL) { + str = rb_str_new2(tb->result[pos+4]); + rb_hash_aset(hash, rb_str_new2("default"), str); + } + } + } + return columns; +} + +static VALUE Statement_execute(VALUE self) { int state, i; @@ -786,6 +846,7 @@ rb_define_method(cDatabase, "rollback", Database_rollback, 0); rb_define_method(cDatabase, "[]", Database_aref, 1); rb_define_method(cDatabase, "[]=", Database_aset, 2); + rb_define_method(cDatabase, "columns", Database_columns, 1); rb_include_module(cDatabase, rb_eval_string("DBI::SQL::BasicBind")); |
From: Michael N. <mne...@us...> - 2003-05-31 16:14:34
|
Update of /cvsroot/ruby-dbi/src/lib/dbi In directory sc8-pr-cvs1:/tmp/cvs-serv28003 Modified Files: utils.rb Log Message: fixed quoting bug ('\"' should be '"') in textconv (Brian Candler) Index: utils.rb =================================================================== RCS file: /cvsroot/ruby-dbi/src/lib/dbi/utils.rb,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- utils.rb 22 Nov 2001 14:26:43 -0000 1.10 +++ utils.rb 31 May 2003 15:52:20 -0000 1.11 @@ -99,7 +99,7 @@ def textconv(str) str = str.to_s.gsub('&', "&") str = str.gsub('\'', "'") - str = str.gsub('\"', """) + str = str.gsub('"', """) str = str.gsub('<', "<") str.gsub('>', ">") end |
From: Michael N. <mne...@us...> - 2003-05-18 20:18:14
|
Update of /cvsroot/ruby-dbi/src/lib/dbd_pg In directory sc8-pr-cvs1:/tmp/cvs-serv11179 Modified Files: Pg.rb Log Message: applied array patches by Oliver M. Bolzer (DBD::Pg can now handle Postgres arrays) Index: Pg.rb =================================================================== RCS file: /cvsroot/ruby-dbi/src/lib/dbd_pg/Pg.rb,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- Pg.rb 11 May 2003 15:29:08 -0000 1.31 +++ Pg.rb 18 May 2003 20:18:10 -0000 1.32 @@ -299,11 +299,102 @@ # Other Public Methods --------------------------------------- + + # parse a PostgreSQL-Array output and convert into ruby array + def convert_array( str, elemtype ) + + array_nesting = 0 # nesting level of the array + in_string = false # currently inside a quoted string ? + escaped = false # if the character is escaped + sbuffer = '' # buffer for the current element + result_array = Array.new # the resulting Array + + str.each_byte { |char| # parse character by character + char = char.chr # we need the Character, not it's Integer + + if escaped then # if this character is escaped, just add it to the buffer + sbuffer += char + escaped = false + next + end + + case char # let's see what kind of character we have + #------------- {: beginning of an array ----# + when '{' + if in_string then # ignore inside a string + sbuffer += char + next + end + + if array_nesting >= 1 then # if it's an nested array, defer for recursion + sbuffer += char + end + array_nesting += 1 # inside another array + + #------------- ": string deliminator --------# + when '"' + in_string = !in_string + + #------------- \: escape character, next is regular character # + when '\\' # single \, must be extra escaped in Ruby + escaped = true + + #------------- ,: element separator ---------# + when ',' + if in_string or array_nesting > 1 then # don't care if inside string or + sbuffer += char # nested array + else + if !sbuffer.is_a? Array then + sbuffer = convert( sbuffer, elemtype ) + end + result_array << sbuffer # otherwise, here ends an element + sbuffer = '' + end + + #------------- }: End of Array --------------# + when '}' + if in_string then # ignore if inside quoted string + sbuffer += char + next + end + + array_nesting -=1 # decrease nesting level + + if array_nesting == 1 # must be the end of a nested array + sbuffer += char + sbuffer = convert_array( sbuffer, elemtype ) # recurse, using the whole nested array + elsif array_nesting > 1 # inside nested array, keep it for later + sbuffer += char + else # array_nesting = 0, must be the last } + if !sbuffer.is_a? Array then + sbuffer = convert( sbuffer, elemtype ) + end + + result_array << sbuffer unless sbuffer.nil? # upto here was the last element + end + + #------------- all other characters ---------# + else + sbuffer += char # simply append + + end + + } + + return result_array + end # convert_array() + def convert(obj,typeid) return nil if obj.nil? - converter = @type_map[typeid] || :as_str - #raise DBI::InterfaceError, "Unsupported Type (typeid=#{typeid})" if converter.nil? - @coerce.coerce(converter, obj) + + if @elem_map.include?( typeid ) then + convert_array( obj, @elem_map[ typeid ] ) + else + converter = @type_map[typeid] || :as_str + #raise DBI::InterfaceError, "Unsupported Type (typeid=#{typeid})" if converter.nil? + @coerce.coerce(converter, obj) + end + end def in_transaction? @@ -322,14 +413,18 @@ if PGconn.respond_to?(:quote) def quote(value) - PGconn.quote(value) {|value| - case value - when DBI::Date, DBI::Time, DBI::Timestamp, ::Date, ::Time - "'#{value.to_s}'" - else - value.to_s - end - } + if value.kind_of? Array then # work around broken PGconn.quote for Arrays + "'#{ quote_array_elements( value ).gsub(/\\/){ '\\\\' }.gsub(/'/){ '\\\'' } }'" + else + PGconn.quote(value) {|value| + case value + when DBI::Date, DBI::Time, DBI::Timestamp, ::Date, ::Time + "'#{value.to_s}'" + else + value.to_s + end + } + end end else @@ -338,6 +433,8 @@ case value when String "'#{ value.gsub(/\\/){ '\\\\' }.gsub(/'/){ '\\\'' } }'" + when Array + "'#{ quote_array_elements( value ).gsub(/\\/){ '\\\\' }.gsub(/'/){ '\\\'' } }'" else super end @@ -348,26 +445,45 @@ private # ---------------------------------------------------- + # special quoting if value is element of an array + def quote_array_elements( value ) + case value + when Array + '{'+ value.collect{|v| quote_array_elements(v) }.join(',') + '}' + when String + '"' + value.gsub(/\\/){ '\\\\' }.gsub(/"/){ '\\"' } + '"' + else + quote( value ).sub(/^'/,'').sub(/'$/,'') + end + end + def load_type_map @type_map = Hash.new + @elem_map = Hash.new @coerce = PgCoerce.new - res = _exec("SELECT typname, typelem FROM pg_type") + res = _exec("SELECT oid, typname, typelem FROM pg_type WHERE typtype = 'b';") - res.result.each { |name, idstr| - @type_map[idstr.to_i] = + res.result.each { |typid, name, elmtype| + @type_map[typid.to_i] = case name - when '_bool' then :as_bool - when '_int8', '_int4', '_int2' then :as_int - when '_varchar' then :as_str - when '_float4','_float8' then :as_float - when '_timestamp', '_timestamptz' then :as_timestamp - when '_date' then :as_date - when '_bytea' then :as_bytea - else :as_str + when 'bool' then :as_bool + when 'int8', 'int4', 'int2' then :as_int + when 'varchar' then :as_str + when 'float4','float8' then :as_float + when 'timestamp', 'timestamptz' then :as_timestamp + when 'date' then :as_date + when 'bytea' then :as_bytea + else + if name =~ /^_/ and elmtype.to_i > 0 then + @elem_map[typid.to_i] = elmtype.to_i + :as_str + else + :as_str + end end + } - # additional conversions @type_map[705] ||= :as_str # select 'hallo' @type_map[1114] ||= :as_timestamp # TIMESTAMP WITHOUT TIME ZONE @@ -650,6 +766,7 @@ } a.join("\\") # \\ => \ end + end end # module Pg |
From: Paul D. <pa...@sn...> - 2003-05-17 04:51:47
|
When ruby is run with the -w flag, the following warning occurs: /usr/lib/ruby/site_ruby/1.6/dbi/dbi.rb:318: warning: discarding old fraction That line is: def fraction() @fraction || 0 end |
From: Michael N. <mne...@us...> - 2003-05-16 09:50:47
|
Update of /cvsroot/ruby-dbi/src/doc In directory sc8-pr-cvs1:/tmp/cvs-serv25170 Modified Files: index.rd Log Message: new contributors; link to OCI8 DBD Index: index.rd =================================================================== RCS file: /cvsroot/ruby-dbi/src/doc/index.rd,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- index.rd 27 Apr 2003 17:40:36 -0000 1.29 +++ index.rd 16 May 2003 09:50:43 -0000 1.30 @@ -4,7 +4,7 @@ == License -Copyright (c) 2001, 2002 Michael Neumann <ne...@s-...> +Copyright (c) 2001, 2002, 2003 Michael Neumann <mne...@nt...> All rights reserved. @@ -72,11 +72,17 @@ Submitted several patches and helped with lots of comments; Co-owner of the project. : MoonWolf quote/escape_bytea patch for DBD Pg. + DBD::SQLite patch : Paul DuBois Fixed typos and formatting. Maintains DBD Mysql. : Tim Bates Bug fixes for Mysql and DBI +: Brian Candler + Zero-padding date/time/timestamps fix. +: Florian G. Pflug + Discussion and helpful comments/benchmarks about DBD::Pg + async_exec vs. exec. == Database Drivers (DBDs) @@ -111,6 +117,10 @@ * Oracle ((*(dbd_oracle)*)) depend on the "Oracle 7 Module for Ruby" version 0.2.11 by Yoshida Masato, available from RAA. Works fine with Oracle 8/8i. + +* Oracle OCI8 ((*(dbd_oci8)*)) + + ((<URL:http://www.jiubao.org/ruby-oci8/index.en.html>)) * PostgreSQL ((*(dbd_pg)*)) |
From: Michael N. <mne...@us...> - 2003-05-16 09:44:10
|
Update of /cvsroot/ruby-dbi/src/lib/dbi/test In directory sc8-pr-cvs1:/tmp/cvs-serv20108 Modified Files: testsqlbind.rb Log Message: added new test cases for "-" bug Index: testsqlbind.rb =================================================================== RCS file: /cvsroot/ruby-dbi/src/lib/dbi/test/testsqlbind.rb,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- testsqlbind.rb 1 Feb 2003 13:51:24 -0000 1.6 +++ testsqlbind.rb 16 May 2003 09:44:07 -0000 1.7 @@ -62,6 +62,17 @@ assert_equal res, bind(self, sql, [10]) end + def test_minus_bug + sql = "SELECT 1 - 3" + res = "SELECT 1 - 3" + assert_equal res, bind(self, sql, []) + end + + def test_minus2 + sql = "SELECT * from test --Dan's query" + assert_equal sql, bind(self, sql, []) + end + end $last_suite.add_test (TestSqlBind.suite) @@ -191,6 +202,6 @@ ###################################################################### if __FILE__ == $0 then - RUNIT::CUI::TestRunner.quiet_mode = true + RUNIT::CUI::TestRunner.quiet_mode = false RUNIT::CUI::TestRunner.run ($last_suite) end |
From: Michael N. <mne...@us...> - 2003-05-16 09:43:44
|
Update of /cvsroot/ruby-dbi/src/lib/dbi/test In directory sc8-pr-cvs1:/tmp/cvs-serv20014 Modified Files: testrow.rb testsqlcoerce.rb testsqlquote.rb Log Message: verbose mode Index: testrow.rb =================================================================== RCS file: /cvsroot/ruby-dbi/src/lib/dbi/test/testrow.rb,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- testrow.rb 26 Jul 2001 00:56:37 -0000 1.3 +++ testrow.rb 16 May 2003 09:43:41 -0000 1.4 @@ -108,6 +108,6 @@ # -------------------------------------------------------------------- if __FILE__ == $0 then - RUNIT::CUI::TestRunner.quiet_mode = true + RUNIT::CUI::TestRunner.quiet_mode = false RUNIT::CUI::TestRunner.run ($last_suite) end Index: testsqlcoerce.rb =================================================================== RCS file: /cvsroot/ruby-dbi/src/lib/dbi/test/testsqlcoerce.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- testsqlcoerce.rb 28 Dec 2001 13:05:44 -0000 1.1 +++ testsqlcoerce.rb 16 May 2003 09:43:41 -0000 1.2 @@ -76,6 +76,6 @@ ###################################################################### if __FILE__ == $0 then - RUNIT::CUI::TestRunner.quiet_mode = true + RUNIT::CUI::TestRunner.quiet_mode = false RUNIT::CUI::TestRunner.run ($last_suite) end Index: testsqlquote.rb =================================================================== RCS file: /cvsroot/ruby-dbi/src/lib/dbi/test/testsqlquote.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- testsqlquote.rb 8 Nov 2001 23:30:39 -0000 1.4 +++ testsqlquote.rb 16 May 2003 09:43:41 -0000 1.5 @@ -59,6 +59,6 @@ # -------------------------------------------------------------------- if __FILE__ == $0 then - RUNIT::CUI::TestRunner.quiet_mode = true + RUNIT::CUI::TestRunner.quiet_mode = false RUNIT::CUI::TestRunner.run ($last_suite) end |
From: Michael N. <mne...@us...> - 2003-05-16 09:43:09
|
Update of /cvsroot/ruby-dbi/src/lib/dbi In directory sc8-pr-cvs1:/tmp/cvs-serv19647 Modified Files: sql.rb Log Message: bug fixed: "SELECT 1 - 3" was incorrectly transformed into "SELECT 1 3" Index: sql.rb =================================================================== RCS file: /cvsroot/ruby-dbi/src/lib/dbi/sql.rb,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- sql.rb 27 Apr 2003 17:37:02 -0000 1.14 +++ sql.rb 16 May 2003 09:43:05 -0000 1.15 @@ -149,6 +149,7 @@ sql.scan(%r{ ( -- .* (?# matches "--" style comments to the end of line or string ) + | - (?# matches single "-" ) | /[*] .*? [*]/ (?# matches C-style comments ) | |
From: Michael N. <mne...@us...> - 2003-05-14 19:52:14
|
Update of /cvsroot/ruby-dbi/src/ext/dbd_sqlite In directory sc8-pr-cvs1:/tmp/cvs-serv24938 Modified Files: SQLite.c Log Message: fixed bug: Prepared statement is executed twice: once with no match, once with a match. The second case fails and segfaults. Index: SQLite.c =================================================================== RCS file: /cvsroot/ruby-dbi/src/ext/dbd_sqlite/SQLite.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- SQLite.c 14 May 2003 18:36:16 -0000 1.5 +++ SQLite.c 14 May 2003 19:52:07 -0000 1.6 @@ -475,7 +475,7 @@ /* col_info */ tables = rb_hash_new(); /* cache the table informations here */ - if (rb_iv_get(self, "@col_info") == Qnil) { + if (rb_iv_get(self, "@col_info") == Qnil || RARRAY(rb_iv_get(self, "@col_info"))->len == 0) { rb_iv_set(self, "@col_info", rb_ary_new2(sm->ncolumn)); for (i=0; i<sm->ncolumn;i++) { /* only first column */ |
From: Michael N. <mne...@us...> - 2003-05-14 19:52:14
|
Update of /cvsroot/ruby-dbi/src/ext/dbd_sqlite/test In directory sc8-pr-cvs1:/tmp/cvs-serv24938/test Added Files: segfault-bug.rb Log Message: fixed bug: Prepared statement is executed twice: once with no match, once with a match. The second case fails and segfaults. --- NEW FILE: segfault-bug.rb --- # Demonstrates bug in ruby-dbi with SQLite # Prepared statement is executed twice: once with no match, once with # a match. The second case falls over. require 'dbi' File.unlink("dbierrortestdb") rescue nil db = DBI.connect("dbi:SQLite:dbierrortestdb") db.execute("create table foo (bar integer)") db.execute("insert into foo (bar) values (99)") sth = db.prepare("select * from foo where bar=?") puts "First time:" sth.execute(3) p sth.fetch puts "Second time:" sth.execute(99) p sth.fetch # /usr/local/lib/ruby/site_ruby/1.6/dbi/dbi.rb:794: [BUG] Segmentation fault # ruby 1.6.8 (2002-12-24) [i386-freebsd4.7] # Abort trap (core dumped) |
From: Michael N. <mne...@us...> - 2003-05-14 18:36:19
|
Update of /cvsroot/ruby-dbi/src/ext/dbd_sqlite/test In directory sc8-pr-cvs1:/tmp/cvs-serv16393/test Added Files: test.rb Log Message: Patch by <moo...@mo...>: * fix Row Processed Count(sqlite_changes() function) * fix DBI::Timestamp quote format for Timestamp sorting before '2003-2-13 1.2.3.0' => after '2003-02-13 01:02:03' --- NEW FILE: test.rb --- require 'dbi' File.unlink("dbierrortestdb") rescue nil db = DBI.connect("dbi:SQLite:dbierrortestdb") db.execute("create table sequences (name varchar(30), val integer)") db.execute("insert into sequences (name,val) values ('test',1000)") puts "Before: #{db.select_all('select * from sequences').inspect}" sth = db.prepare("update sequences set val=? where val=? and name=?") sth.execute(1001,1000,"test") rows = sth.rows puts "Rows changed: #{rows}" puts "After: #{db.select_all('select * from sequences').inspect}" if rows != 1 puts "TEST FAILED" exit -1 else puts "TEST PASSED" exit 0 end |
From: Michael N. <mne...@us...> - 2003-05-14 18:36:19
|
Update of /cvsroot/ruby-dbi/src/ext/dbd_sqlite In directory sc8-pr-cvs1:/tmp/cvs-serv16393 Modified Files: SQLite.c Log Message: Patch by <moo...@mo...>: * fix Row Processed Count(sqlite_changes() function) * fix DBI::Timestamp quote format for Timestamp sorting before '2003-2-13 1.2.3.0' => after '2003-02-13 01:02:03' Index: SQLite.c =================================================================== RCS file: /cvsroot/ruby-dbi/src/ext/dbd_sqlite/SQLite.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- SQLite.c 3 Jul 2002 16:48:35 -0000 1.4 +++ SQLite.c 14 May 2003 18:36:16 -0000 1.5 @@ -1,7 +1,7 @@ /* * DBD driver for SQLite * - * Copyright (c) 2001, 2002 Michael Neumann <ne...@s-...> + * Copyright (c) 2001, 2002, 2003 Michael Neumann <mne...@nt...> * * All rights reserved. * @@ -49,9 +49,11 @@ static VALUE mDBD, mSQLite; static VALUE cDriver, cDatabase, cStatement; static VALUE cBaseDriver, cBaseDatabase, cBaseStatement; +static VALUE cTimestamp; static VALUE eOperationalError, eDatabaseError, eInterfaceError; static VALUE eNotSupportedError; static VALUE TYPE_CONV_MAP, CONVERTER, CONVERTER_PROC; +static ID id_to_time, id_utc, id_strftime; #define SQL_FETCH_NEXT 1 #define SQL_FETCH_PRIOR 2 @@ -69,7 +71,7 @@ struct sStatement { VALUE conn, statement; char **result; - int nrow, ncolumn, row_index; + int nrow, ncolumn, row_index, nrpc; }; struct sTable { @@ -406,6 +408,7 @@ sm->result = NULL; sm->nrow = -1; sm->ncolumn = -1; + sm->nrpc = -1; return statement; } @@ -468,6 +471,7 @@ rb_str_cat(errstr, "(", 1); rb_str_concat(errstr, rb_str_new2(sqliteErrStr(state))); rb_str_cat(errstr, ")", 1); rb_raise(eDatabaseError, STR2CSTR(errstr)); } + sm->nrpc = sqlite_changes(db->conn); /* col_info */ tables = rb_hash_new(); /* cache the table informations here */ @@ -586,6 +590,7 @@ } sm->nrow = -1; + sm->nrpc = -1; rb_iv_set(self, "@rows", rb_ary_new()); rb_iv_set(self, "@params", rb_ary_new()); @@ -726,13 +731,26 @@ struct sStatement *sm; Data_Get_Struct(self, struct sStatement, sm); - if (sm->nrow != -1) { - return INT2NUM(sm->nrow); + if (sm->nrpc != -1) { + return INT2NUM(sm->nrpc); } else { return Qnil; } } +static VALUE +Statement_quote(VALUE self,VALUE obj) +{ + if (TYPE(obj)==T_OBJECT && RBASIC(obj)->klass == cTimestamp) { + VALUE time; + time = rb_funcall(obj, id_to_time, 0); + time = rb_funcall(time, id_utc, 0); + return rb_funcall(time , id_strftime, 1, rb_str_new2("'%Y/%m/%d %H:%M:%S'")); + } else { + return rb_call_super(1, &obj); + } +} + /* Init */ void Init_SQLite() { @@ -744,7 +762,11 @@ eDatabaseError = rb_eval_string("DBI::DatabaseError"); eInterfaceError = rb_eval_string("DBI::InterfaceError"); eNotSupportedError= rb_eval_string("DBI::NotSupportedError"); - + cTimestamp = rb_eval_string("DBI::Timestamp"); + id_to_time = rb_intern("to_time"); + id_utc = rb_intern("utc"); + id_strftime = rb_intern("strftime"); + mSQLite = rb_define_module_under(mDBD, "SQLite"); /* Driver */ @@ -777,9 +799,12 @@ rb_define_method(cStatement, "fetch_scroll", Statement_fetch_scroll, 2); rb_define_method(cStatement, "column_info", Statement_column_info, 0); rb_define_method(cStatement, "rows", Statement_rows, 0); + rb_define_method(cStatement, "quote", Statement_quote, 1); + rb_enable_super(cStatement, "quote"); rb_include_module(cStatement, rb_eval_string("DBI::SQL::BasicBind")); rb_include_module(cStatement, rb_eval_string("DBI::SQL::BasicQuote")); + TYPE_CONV_MAP = rb_eval_string( " [ \n" @@ -813,6 +838,8 @@ "} \n" ); rb_define_const(cStatement, "CONVERTER_PROC", CONVERTER_PROC); + + } |
From: Michael N. <mne...@us...> - 2003-05-14 18:33:00
|
Update of /cvsroot/ruby-dbi/src/ext/dbd_sqlite/test In directory sc8-pr-cvs1:/tmp/cvs-serv13503/test Log Message: Directory /cvsroot/ruby-dbi/src/ext/dbd_sqlite/test added to the repository |
From: Michael N. <mne...@us...> - 2003-05-11 15:29:11
|
Update of /cvsroot/ruby-dbi/src/lib/dbd_pg In directory sc8-pr-cvs1:/tmp/cvs-serv8557 Modified Files: Pg.rb Log Message: added NonBlocking execution mode Index: Pg.rb =================================================================== RCS file: /cvsroot/ruby-dbi/src/lib/dbd_pg/Pg.rb,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- Pg.rb 25 Oct 2002 12:48:37 -0000 1.30 +++ Pg.rb 11 May 2003 15:29:08 -0000 1.31 @@ -1,7 +1,7 @@ # # DBD::Pg # -# Copyright (c) 2001, 2002 Jim Weirich, Michael Neumann <ne...@s-...> +# Copyright (c) 2001, 2002, 2003 Jim Weirich, Michael Neumann <mne...@nt...> # # All rights reserved. # @@ -36,7 +36,7 @@ module DBD module Pg - VERSION = "0.3.2" + VERSION = "0.3.3" USED_DBD_VERSION = "0.2" class Driver < DBI::BaseDriver @@ -82,8 +82,6 @@ nil => [SQL_OTHER, nil, nil] } - attr_reader :connection - def initialize(dbname, user, auth, attr) hash = Utils.parse_params(dbname) @@ -98,7 +96,10 @@ @connection = PGconn.new(hash['host'], hash['port'], hash['options'], hash['tty'], hash['dbname'] || hash['database'], user, auth) + @exec_method = :exec + @attr = attr + @attr['NonBlocking'] ||= false @attr.each { |k,v| self[k] = v} load_type_map @@ -114,13 +115,13 @@ def disconnect if not @attr['AutoCommit'] and @in_transaction - @connection.exec("ROLLBACK") # rollback outstanding transactions + _exec("ROLLBACK") # rollback outstanding transactions end @connection.close end def ping - answer = @connection.exec("SELECT 1") + answer = _exec("SELECT 1") if answer return answer.num_tuples == 1 else @@ -256,7 +257,7 @@ if value # turn AutoCommit ON if @in_transaction # TODO: commit outstanding transactions? - @connection.exec("COMMIT") + _exec("COMMIT") @in_transaction = false end else # turn AutoCommit OFF @@ -264,6 +265,8 @@ end end # value is assigned below + when 'NonBlocking' + @exec_method = if value then :async_exec else :exec end when 'pg_client_encoding' @connection.set_client_encoding(value) else @@ -278,7 +281,7 @@ def commit if @in_transaction - @connection.exec("COMMIT") + _exec("COMMIT") @in_transaction = false else # TODO: Warn? @@ -287,7 +290,7 @@ def rollback if @in_transaction - @connection.exec("ROLLBACK") + _exec("ROLLBACK") @in_transaction = false else # TODO: Warn? @@ -308,10 +311,14 @@ end def start_transaction - @connection.exec("BEGIN") + _exec("BEGIN") @in_transaction = true end + def _exec(sql) + @connection.send(@exec_method, sql) + end + if PGconn.respond_to?(:quote) def quote(value) @@ -345,7 +352,7 @@ @type_map = Hash.new @coerce = PgCoerce.new - res = @connection.exec("SELECT typname, typelem FROM pg_type") + res = _exec("SELECT typname, typelem FROM pg_type") res.result.each { |name, idstr| @type_map[idstr.to_i] = @@ -375,7 +382,7 @@ start_transaction unless @in_transaction @connection.lo_import(file) #if @attr['AutoCommit'] - # @connection.exec("COMMIT") + # _exec("COMMIT") # @in_transaction = false #end rescue PGError => err @@ -386,7 +393,7 @@ start_transaction unless @in_transaction @connection.lo_export(oid.to_i, file) #if @attr['AutoCommit'] - # @connection.exec("COMMIT") + # _exec("COMMIT") # @in_transaction = false #end rescue PGError => err @@ -397,7 +404,7 @@ start_transaction unless @in_transaction @connection.lo_create(mode) #if @attr['AutoCommit'] - # @connection.exec("COMMIT") + # _exec("COMMIT") # @in_transaction = false #end rescue PGError => err @@ -408,7 +415,7 @@ start_transaction unless @in_transaction @connection.lo_open(oid.to_i, mode) #if @attr['AutoCommit'] - # @connection.exec("COMMIT") + # _exec("COMMIT") # @in_transaction = false #end rescue PGError => err @@ -419,7 +426,7 @@ start_transaction unless @in_transaction @connection.lo_unlink(oid.to_i) #if @attr['AutoCommit'] - # @connection.exec("COMMIT") + # _exec("COMMIT") # @in_transaction = false #end rescue PGError => err @@ -504,7 +511,7 @@ if not SQL.query?(boundsql) and not @db['AutoCommit'] then @db.start_transaction unless @db.in_transaction? end - pg_result = @db.connection.exec(boundsql) + pg_result = @db._exec(boundsql) @result = Tuples.new(@db, pg_result) rescue PGError, RuntimeError => err |