ruby-informix 0.7.3 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2006-2010, Gerardo Santana Gomez Garrido <gerardo.santana@gmail.com>
2
+ * Copyright (c) 2006-2012, Gerardo Santana Gomez Garrido <gerardo.santana@gmail.com>
3
3
  * All rights reserved.
4
4
  *
5
5
  * Redistribution and use in source and binary forms, with or without
@@ -32,7 +32,7 @@
32
32
  #include <sqlstype.h>
33
33
  #include <sqltypes.h>
34
34
 
35
- static VALUE rb_cDate, rb_cBigDecimal, rb_cRational;
35
+ static VALUE rb_cDate, rb_cBigDecimal;
36
36
 
37
37
  /* Modules */
38
38
  static VALUE rb_mInformix;
@@ -995,7 +995,7 @@ rb_slob_unlock(VALUE self, VALUE offset, VALUE whence, VALUE range)
995
995
  typedef enum {
996
996
  slob_estbytes, slob_extsz, slob_flags, slob_maxbytes, slob_sbspace
997
997
  } slob_option_t;
998
- static char *str_slob_options[] = {
998
+ static const char *str_slob_options[] = {
999
999
  "estbytes", "extsz", "flags", "maxbytes", "sbspace"};
1000
1000
  /*
1001
1001
  * Base function for getting storage charasteristics
@@ -1207,7 +1207,7 @@ rb_slob_set_flags(VALUE self, VALUE value)
1207
1207
  }
1208
1208
 
1209
1209
  typedef enum { slob_atime, slob_ctime, slob_mtime, slob_refcnt, slob_size } slob_stat_t;
1210
- static char *str_slob_stats[] = {
1210
+ static const char *str_slob_stats[] = {
1211
1211
  "atime", "ctime", "mtime", "refcnt", "size"
1212
1212
  };
1213
1213
 
@@ -1842,8 +1842,7 @@ make_result(cursor_t *c, VALUE record)
1842
1842
  value = rb_funcall(value, s_add, 1, LONG2FIX(sign*seconds));
1843
1843
 
1844
1844
  if (usec != 0) {
1845
- VALUE argv[2] = { INT2FIX(sign*usec), LONG2FIX(1000000L) };
1846
- VALUE frac = rb_class_new_instance(2, argv, rb_cRational);
1845
+ VALUE frac = rb_Rational(INT2FIX(sign*usec), LONG2FIX(1000000L));
1847
1846
  value = rb_funcall(frac, s_add, 1, value);
1848
1847
  }
1849
1848
  }
@@ -1909,8 +1908,8 @@ make_result(cursor_t *c, VALUE record)
1909
1908
  if (BUILTIN_TYPE(record) == T_ARRAY) {
1910
1909
  rb_ary_store(record, i, item);
1911
1910
  }
1912
- else {
1913
- rb_hash_aset(record, RARRAY(c->field_names)->ptr[i], item);
1911
+ else {
1912
+ rb_hash_aset(record, RARRAY_PTR(c->field_names)[i], item);
1914
1913
  }
1915
1914
  }
1916
1915
  return record;
@@ -2215,8 +2214,8 @@ static VALUE
2215
2214
  rb_database_columns(VALUE self, VALUE tablename)
2216
2215
  {
2217
2216
  VALUE v, column, result;
2218
- char *stype;
2219
- static char *stypes[] = {
2217
+ const char *stype;
2218
+ static const char *stypes[] = {
2220
2219
  "CHAR", "SMALLINT", "INTEGER", "FLOAT", "SMALLFLOAT", "DECIMAL",
2221
2220
  "SERIAL", "DATE", "MONEY", "NULL", "DATETIME", "BYTE",
2222
2221
  "TEXT", "VARCHAR", "INTERVAL", "NCHAR", "NVARCHAR", "INT8",
@@ -2224,7 +2223,7 @@ rb_database_columns(VALUE self, VALUE tablename)
2224
2223
  "VARIABLE-LENGTH OPAQUE TYPE"
2225
2224
  };
2226
2225
 
2227
- static char *qualifiers[] = {
2226
+ static const char *qualifiers[] = {
2228
2227
  "YEAR", "MONTH", "DAY", "HOUR", "MINUTE", "SECOND"
2229
2228
  };
2230
2229
 
@@ -2720,7 +2719,7 @@ each_by(VALUE self, VALUE n, VALUE type)
2720
2719
 
2721
2720
  for(;;) {
2722
2721
  records = fetch_many(self, n, type);
2723
- if (RARRAY(records)->len == 0)
2722
+ if (RARRAY_LEN(records) == 0)
2724
2723
  return self;
2725
2724
  rb_yield(records);
2726
2725
  }
@@ -3375,8 +3374,6 @@ void Init_informixc(void)
3375
3374
  rb_require("bigdecimal");
3376
3375
  rb_cBigDecimal = rb_const_get(rb_cObject, rb_intern("BigDecimal"));
3377
3376
 
3378
- rb_cRational = rb_const_get(rb_cObject, rb_intern("Rational"));
3379
-
3380
3377
  rb_require("informix/exceptions");
3381
3378
  rb_eError = rb_const_get(rb_mInformix, rb_intern("Error"));
3382
3379
  rb_eWarning = rb_const_get(rb_mInformix, rb_intern("Warning"));
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2008-2010, Gerardo Santana Gomez Garrido <gerardo.santana@gmail.com>
2
+ # Copyright (c) 2008-2012, Gerardo Santana Gomez Garrido <gerardo.santana@gmail.com>
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -32,7 +32,7 @@ require 'informix/seqcursor'
32
32
  require 'informix/scrollcursor'
33
33
 
34
34
  module Informix
35
- VERSION = "0.7.3"
35
+ VERSION = "0.8.0"
36
36
  VERSION.freeze
37
37
 
38
38
  # Shortcut to create a +Database+ object connected to +dbname+ as
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2008-2010, Gerardo Santana Gomez Garrido <gerardo.santana@gmail.com>
2
+ # Copyright (c) 2008-2012, Gerardo Santana Gomez Garrido <gerardo.santana@gmail.com>
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2008-2010, Gerardo Santana Gomez Garrido <gerardo.santana@gmail.com>
2
+ # Copyright (c) 2008-2012, Gerardo Santana Gomez Garrido <gerardo.santana@gmail.com>
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2008-2010, Gerardo Santana Gomez Garrido <gerardo.santana@gmail.com>
2
+ # Copyright (c) 2008-2012, Gerardo Santana Gomez Garrido <gerardo.santana@gmail.com>
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2008-2010, Gerardo Santana Gomez Garrido <gerardo.santana@gmail.com>
2
+ # Copyright (c) 2008-2012, Gerardo Santana Gomez Garrido <gerardo.santana@gmail.com>
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -1,9 +1,6 @@
1
1
  testdir = File.expand_path(File.dirname(__FILE__))
2
2
  $LOAD_PATH.unshift testdir
3
- $LOAD_PATH.unshift File.join(testdir, "..")
4
3
 
5
- require 'informix'
6
- require 'test/unit'
7
4
  require 'testcase'
8
5
 
9
6
  class IfxTestCreate < Informix::TestCase
@@ -1,9 +1,6 @@
1
1
  testdir = File.expand_path(File.dirname(__FILE__))
2
2
  $LOAD_PATH.unshift testdir
3
- $LOAD_PATH.unshift File.join(testdir, "..")
4
3
 
5
- require 'informix'
6
- require 'test/unit'
7
4
  require 'testcase'
8
5
 
9
6
  # Informix::ExcInfo is just a struct, not much testing needed
@@ -1,9 +1,6 @@
1
1
  testdir = File.expand_path(File.dirname(__FILE__))
2
2
  $LOAD_PATH.unshift testdir
3
- $LOAD_PATH.unshift File.join(testdir, "..")
4
3
 
5
- require 'informix'
6
- require 'test/unit'
7
4
  require 'testcase'
8
5
 
9
6
  class IfxTestExceptions < Informix::TestCase
@@ -63,7 +60,7 @@ class IfxTestExceptions < Informix::TestCase
63
60
  end
64
61
 
65
62
  def test_sqlcode
66
- assert_equal -100, @test_exc.sql_code
63
+ assert_equal(-100, @test_exc.sql_code)
67
64
  assert_equal 0, Informix::Error.new.sql_code
68
65
  end
69
66
 
@@ -1,12 +1,7 @@
1
1
  testdir = File.expand_path(File.dirname(__FILE__))
2
2
  $LOAD_PATH.unshift testdir
3
- $LOAD_PATH.unshift File.join(testdir, "..")
4
3
 
5
- require 'informix'
6
- require 'test/unit'
7
4
  require 'testcase'
8
- require 'stringio'
9
- require 'date'
10
5
 
11
6
  class IfxTestXFetchNEach < Informix::TestCase
12
7
  def setup
@@ -22,7 +17,7 @@ class IfxTestXFetchNEach < Informix::TestCase
22
17
  end
23
18
 
24
19
  def teardown
25
- @c.drop
20
+ @c.free
26
21
  end
27
22
 
28
23
  def test_fetch_each_each_by
@@ -1,12 +1,7 @@
1
1
  testdir = File.expand_path(File.dirname(__FILE__))
2
2
  $LOAD_PATH.unshift testdir
3
- $LOAD_PATH.unshift File.join(testdir, "..")
4
3
 
5
- require 'informix'
6
- require 'test/unit'
7
4
  require 'testcase'
8
- require 'stringio'
9
- require 'date'
10
5
 
11
6
  class IfxTestInsert < Informix::TestCase
12
7
  def setup
@@ -1,12 +1,7 @@
1
1
  testdir = File.expand_path(File.dirname(__FILE__))
2
2
  $LOAD_PATH.unshift testdir
3
- $LOAD_PATH.unshift File.join(testdir, "..")
4
3
 
5
- require 'informix'
6
- require 'test/unit'
7
4
  require 'testcase'
8
- require 'stringio'
9
- require 'date'
10
5
 
11
6
  class IfxTestSelect < Informix::TestCase
12
7
  def setup
@@ -19,9 +14,8 @@ class IfxTestSelect < Informix::TestCase
19
14
 
20
15
  def test_select
21
16
  rows = nil
22
-
23
17
  assert_nothing_raised(Informix::Error, "Selecting records") do
24
- rows = db.cursor('select * from test').open.fetch_all
18
+ rows = db.cursor('select * from test') { |c| c.open; c.fetch_all }
25
19
  end
26
20
 
27
21
  assert_equal(2, rows.size, "# of records retrieved")
@@ -83,5 +77,3 @@ class IfxTestSelect < Informix::TestCase
83
77
  end
84
78
  end
85
79
  end
86
-
87
-
@@ -1,6 +1,9 @@
1
1
  testdir = File.expand_path(File.dirname(__FILE__))
2
- $LOAD_PATH.unshift File.join(testdir, "..")
2
+ $LOAD_PATH.unshift testdir
3
+ $LOAD_PATH.unshift File.expand_path(File.join(testdir, "..", "lib"))
4
+ $LOAD_PATH.unshift File.expand_path(File.join(testdir, "..", "ext"))
3
5
 
6
+ gem 'test-unit'
4
7
  require 'test/unit'
5
8
  require 'informix'
6
9
  require 'date'
@@ -97,15 +100,14 @@ module Informix
97
100
  def populate_test_table
98
101
  sql = "insert into test values(#{quote_strings(@rows[0]).join(',')})"
99
102
 
100
- assert_nothing_raised(Informix::Error, "Inserting record with db.do, sql = [#{sql}]") do
103
+ assert_nothing_raised(Informix::Error, "Inserting record with db.execute, sql = [#{sql}]") do
101
104
  db.execute sql
102
105
  end
103
106
 
104
107
  sql = "insert into test values(#{"?," * (@rows[1].size - 1)}#{"?"})"
105
108
 
106
109
  assert_nothing_raised(Informix::Error, "Inserting record with stmt.execute, sql = [#{sql}]") do
107
- stmt = db.prepare sql
108
- stmt.execute(*@rows[1])
110
+ db.prepare(sql) {|stmt| stmt.execute(*@rows[1]) }
109
111
  end
110
112
  ensure
111
113
  rewind_data
@@ -127,8 +129,8 @@ module Informix
127
129
  unless args.empty?
128
130
  @db ||= Informix.connect(args[0], args[1], args[2])
129
131
  @supported = {}
130
- @supported["boolean"] = true if supported_data_type?(@db, "boolean")
131
- @supported["int8"] = true if supported_data_type?(@db, "int8")
132
+ @supported["boolean"] = supported_data_type?(@db, "boolean")
133
+ @supported["int8"] = supported_data_type?(@db, "int8")
132
134
 
133
135
  @rows = [
134
136
  [
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-informix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ prerelease:
5
+ version: 0.8.0
5
6
  platform: ruby
6
7
  authors:
7
8
  - Gerardo Santana Gomez Garrido
@@ -9,8 +10,7 @@ autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
12
 
12
- date: 2010-02-02 00:00:00 -06:00
13
- default_executable:
13
+ date: 2012-04-18 00:00:00 Z
14
14
  dependencies: []
15
15
 
16
16
  description: Ruby library for connecting to IBM Informix 7 and above
@@ -29,19 +29,18 @@ files:
29
29
  - lib/informix/interval.rb
30
30
  - lib/informix/scrollcursor.rb
31
31
  - lib/informix/seqcursor.rb
32
- - test/ifx_all.rb
33
- - test/ifx_test_create_table.rb
34
- - test/ifx_test_errinfo.rb
35
- - test/ifx_test_exceptions.rb
36
- - test/ifx_test_fetch_n_each.rb
37
- - test/ifx_test_insert.rb
38
- - test/ifx_test_select.rb
32
+ - test/test_create_table.rb
33
+ - test/test_errinfo.rb
34
+ - test/test_exceptions.rb
35
+ - test/test_fetch_n_each.rb
36
+ - test/test_insert.rb
37
+ - test/test_select.rb
39
38
  - test/testcase.rb
40
39
  - COPYRIGHT
41
40
  - Changelog
42
41
  - README
43
42
  - ext/informixc.c
44
- has_rdoc: true
43
+ - ext/extconf.rb
45
44
  homepage: http://ruby-informix.rubyforge.org/
46
45
  licenses: []
47
46
 
@@ -60,21 +59,21 @@ rdoc_options:
60
59
  require_paths:
61
60
  - lib
62
61
  required_ruby_version: !ruby/object:Gem::Requirement
62
+ none: false
63
63
  requirements:
64
64
  - - ">="
65
65
  - !ruby/object:Gem::Version
66
66
  version: "0"
67
- version:
68
67
  required_rubygems_version: !ruby/object:Gem::Requirement
68
+ none: false
69
69
  requirements:
70
70
  - - ">="
71
71
  - !ruby/object:Gem::Version
72
72
  version: "0"
73
- version:
74
73
  requirements: []
75
74
 
76
75
  rubyforge_project: ruby-informix
77
- rubygems_version: 1.3.5
76
+ rubygems_version: 1.8.11
78
77
  signing_key:
79
78
  specification_version: 3
80
79
  summary: Ruby library for IBM Informix
@@ -1,31 +0,0 @@
1
- testdir = File.expand_path(File.dirname(__FILE__))
2
- $LOAD_PATH.unshift File.join(testdir, "..")
3
-
4
- require 'informix'
5
- require 'test/unit'
6
-
7
- class IfxAll
8
- def IfxAll.suite
9
- suite = Test::Unit::TestSuite.new "Ruby Informix Test Suite"
10
- Object.constants.grep(/^IfxTest/).sort.each do |const_name|
11
- if (c = Object.const_get(const_name)).kind_of?(Class) && c.respond_to?(:suite)
12
- puts "Adding #{const_name}"
13
- suite << c.suite
14
- end
15
- end
16
- suite
17
- end
18
- end
19
-
20
- if __FILE__ == $0
21
- if ARGV.size == 0
22
- STDERR.puts "Usage:
23
- ruby #{$0} database [username password]"
24
- exit 1
25
- end
26
- require 'test/unit/ui/console/testrunner'
27
- Dir.glob(File.join(testdir, "ifx_test*.rb")).each do |testcase|
28
- require "#{testcase}"
29
- end
30
- Test::Unit::UI::Console::TestRunner.run(IfxAll)
31
- end