ruby-postgres 0.7.1.2005.12.19-mswin32 → 0.7.1.2005.12.20-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/Makefile +1 -1
- data/extconf.rb +1 -0
- data/postgres.c +12 -11
- data/postgres.o +0 -0
- data/postgres.so +0 -0
- data/ruby-postgres.gemspec +2 -4
- data/tests/tc_postgres.rb +24 -0
- metadata +38 -46
- data/ruby-postgres-0.7.1.2005.12.19.gem +0 -0
data/Makefile
CHANGED
@@ -35,7 +35,7 @@ LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
|
35
35
|
LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
|
36
36
|
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
|
37
37
|
|
38
|
-
CFLAGS = -g -O2
|
38
|
+
CFLAGS = -g -O2 -Wall
|
39
39
|
CPPFLAGS = -I. -I$(topdir) -I$(hdrdir) -I$(srcdir) -DHAVE_LIBPQ_FE_H -DHAVE_LIBPQ_LIBPQ_FS_H -DHAVE_PQSETCLIENTENCODING -DHAVE_PG_ENCODING_TO_CHAR -DHAVE_PQFREEMEM -DHAVE_PQESCAPESTRING -DHAVE_PQEXECPARAMS -Ic:/apps/POSTGR~1/8.1/include
|
40
40
|
CXXFLAGS = $(CFLAGS)
|
41
41
|
DLDFLAGS = -Wl,--enable-auto-import,--export-all
|
data/extconf.rb
CHANGED
@@ -27,6 +27,7 @@ if have_build_env
|
|
27
27
|
required_libraries.each(&method(:have_library))
|
28
28
|
desired_functions.each(&method(:have_func))
|
29
29
|
$objs = ['postgres.o'] if compat_functions.all?(&method(:have_func))
|
30
|
+
$CFLAGS << ' -Wall '
|
30
31
|
create_makefile("postgres")
|
31
32
|
else
|
32
33
|
puts 'Could not find PostgreSQL build environment (libraries & headers): Makefile not created'
|
data/postgres.c
CHANGED
@@ -257,7 +257,7 @@ format_array_element(obj)
|
|
257
257
|
return rb_funcall(obj, rb_intern("gsub!"), 2, rb_reg_new("^|$", 3, 0), rb_str_new2("\""));
|
258
258
|
}
|
259
259
|
else {
|
260
|
-
return pgconn_s_format(
|
260
|
+
return pgconn_s_format(rb_cPGconn, obj);
|
261
261
|
}
|
262
262
|
}
|
263
263
|
|
@@ -309,7 +309,7 @@ build_key_value_string_i(key, value, result)
|
|
309
309
|
if (key == Qundef) return ST_CONTINUE;
|
310
310
|
key_value = rb_str_dup(key);
|
311
311
|
rb_str_cat(key_value, "=", 1);
|
312
|
-
rb_str_concat(key_value, pgconn_s_quote(
|
312
|
+
rb_str_concat(key_value, pgconn_s_quote(rb_cPGconn, value));
|
313
313
|
rb_ary_push(result, key_value);
|
314
314
|
return ST_CONTINUE;
|
315
315
|
}
|
@@ -540,14 +540,14 @@ pgconn_exec(argc, argv, obj)
|
|
540
540
|
values[i] = NULL;
|
541
541
|
}
|
542
542
|
else {
|
543
|
-
formatted = pgconn_s_format(
|
543
|
+
formatted = pgconn_s_format(rb_cPGconn, *ptr);
|
544
544
|
values[i] = StringValuePtr(formatted);
|
545
545
|
}
|
546
546
|
}
|
547
547
|
result = PQexecParams(conn, StringValuePtr(command), len, NULL, values, NULL, NULL, 0);
|
548
548
|
#else
|
549
549
|
for (i = 0; i < len; i++) {
|
550
|
-
rb_ary_push(params, pgconn_s_quote(
|
550
|
+
rb_ary_push(params, pgconn_s_quote(rb_cPGconn, rb_ary_entry(params, i)));
|
551
551
|
}
|
552
552
|
result = PQexecParams_compat(conn, command, params);
|
553
553
|
#endif
|
@@ -1214,7 +1214,7 @@ fetch_pgresult(result, row, column)
|
|
1214
1214
|
return *string == 't' ? Qtrue : Qfalse;
|
1215
1215
|
|
1216
1216
|
case BYTEAOID:
|
1217
|
-
return pgconn_s_unescape_bytea(
|
1217
|
+
return pgconn_s_unescape_bytea(rb_cPGconn, rb_tainted_str_new2(string));
|
1218
1218
|
|
1219
1219
|
case NUMERICOID:
|
1220
1220
|
if (has_numeric_scale(PQfmod(result, column))) {
|
@@ -1306,7 +1306,7 @@ pgconn_select_one(argc, argv, self)
|
|
1306
1306
|
VALUE self;
|
1307
1307
|
{
|
1308
1308
|
VALUE result = pgconn_exec(argc, argv, self);
|
1309
|
-
VALUE row = fetch_pgrow(result, pgresult_fields(
|
1309
|
+
VALUE row = fetch_pgrow(result, pgresult_fields(result), 0);
|
1310
1310
|
pgresult_clear(result);
|
1311
1311
|
return row;
|
1312
1312
|
}
|
@@ -1324,9 +1324,9 @@ pgconn_select_value(argc, argv, self)
|
|
1324
1324
|
VALUE *argv;
|
1325
1325
|
VALUE self;
|
1326
1326
|
{
|
1327
|
-
|
1328
|
-
VALUE value = fetch_pgresult(result, 0, 0);
|
1329
|
-
|
1327
|
+
VALUE result = pgconn_exec(argc, argv, self);
|
1328
|
+
VALUE value = fetch_pgresult(get_pgresult(result), 0, 0);
|
1329
|
+
pgresult_clear(result);
|
1330
1330
|
return value;
|
1331
1331
|
}
|
1332
1332
|
|
@@ -1342,7 +1342,8 @@ pgconn_select_values(argc, argv, self)
|
|
1342
1342
|
VALUE *argv;
|
1343
1343
|
VALUE self;
|
1344
1344
|
{
|
1345
|
-
|
1345
|
+
VALUE pg_result = pgconn_exec(argc, argv, self);
|
1346
|
+
PGresult * result = get_pgresult(pg_result);
|
1346
1347
|
int ntuples = PQntuples(result);
|
1347
1348
|
int nfields = PQnfields(result);
|
1348
1349
|
|
@@ -1354,7 +1355,7 @@ pgconn_select_values(argc, argv, self)
|
|
1354
1355
|
}
|
1355
1356
|
}
|
1356
1357
|
|
1357
|
-
|
1358
|
+
pgresult_clear(pg_result);
|
1358
1359
|
return values;
|
1359
1360
|
}
|
1360
1361
|
|
data/postgres.o
CHANGED
Binary file
|
data/postgres.so
CHANGED
Binary file
|
data/ruby-postgres.gemspec
CHANGED
@@ -21,10 +21,8 @@ SPEC = Gem::Specification.new do |s|
|
|
21
21
|
s.extensions = 'extconf.rb'
|
22
22
|
end
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
else
|
27
|
-
s.files = Dir['**/*']
|
24
|
+
s.files = Dir.chdir(File.exists?('_darcs') ? '_darcs/current' : '.') do
|
25
|
+
Dir['**/*'].reject { |file| file =~ /\.gem$/ }
|
28
26
|
end
|
29
27
|
|
30
28
|
end
|
data/tests/tc_postgres.rb
CHANGED
@@ -41,4 +41,28 @@ EOT
|
|
41
41
|
assert_equal(BigDecimal("12345.12345"), tuple['numeric_10_5_value'])
|
42
42
|
end
|
43
43
|
|
44
|
+
def test_select_one
|
45
|
+
res = @conn.select_one("select 1 as a,2 as b union select 2 as a,3 as b order by 1")
|
46
|
+
assert_equal([1,2], res)
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_select_values
|
50
|
+
res = @conn.select_values("select 1,2 union select 2,3 order by 1")
|
51
|
+
assert_equal([1,2,2,3], res)
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_select_value
|
55
|
+
res = @conn.select_value("select 'test', 123")
|
56
|
+
assert_equal("test", res)
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_row_each
|
60
|
+
res = @conn.exec("select 1 as a union select 2 as a union select 3 as a order by 1")
|
61
|
+
n = 1
|
62
|
+
res.each do |tuple|
|
63
|
+
assert_equal(n, tuple['a'])
|
64
|
+
n +=1
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
44
68
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
!ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.8.
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.8.10
|
3
3
|
specification_version: 1
|
4
4
|
name: ruby-postgres
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.7.1.2005.12.
|
7
|
-
date: 2005-12-
|
6
|
+
version: 0.7.1.2005.12.20
|
7
|
+
date: 2005-12-20
|
8
8
|
summary: Ruby extension for PostgreSQL database coordination
|
9
9
|
require_paths:
|
10
|
-
- .
|
10
|
+
- "."
|
11
11
|
email: davelee.com@gmail.com
|
12
12
|
homepage: http://ruby.scripting.ca/postgres/
|
13
13
|
rubyforge_project: ruby-postgres
|
@@ -18,54 +18,46 @@ bindir: bin
|
|
18
18
|
has_rdoc: true
|
19
19
|
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
20
|
requirements:
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
-
|
22
|
+
- ">"
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 0.0.0
|
24
25
|
version:
|
25
26
|
platform: mswin32
|
26
|
-
signing_key:
|
27
|
-
cert_chain:
|
28
27
|
authors:
|
29
|
-
- Yukihiro Matsumoto, Eiji Matsumoto, Noboru Saitou, Dave Lee
|
28
|
+
- "Yukihiro Matsumoto, Eiji Matsumoto, Noboru Saitou, Dave Lee"
|
30
29
|
files:
|
31
|
-
- ChangeLog
|
32
|
-
- Contributors
|
33
|
-
- doc
|
34
|
-
- extconf.rb
|
35
|
-
- libpq-compat.c
|
36
|
-
- Makefile
|
37
|
-
- MANIFEST
|
38
|
-
- mkmf.log
|
39
|
-
- postgres.c
|
40
|
-
- postgres.o
|
41
|
-
- postgres.so
|
42
|
-
- README
|
43
|
-
- README.ja
|
44
|
-
- ruby-postgres
|
45
|
-
-
|
46
|
-
-
|
47
|
-
-
|
48
|
-
-
|
49
|
-
- doc/postgres.html
|
50
|
-
-
|
51
|
-
- sample/
|
52
|
-
- sample/
|
53
|
-
- sample/
|
54
|
-
- sample/
|
55
|
-
- sample/
|
56
|
-
-
|
57
|
-
- tests/tc_postgres.rb
|
30
|
+
- ChangeLog
|
31
|
+
- Contributors
|
32
|
+
- doc
|
33
|
+
- extconf.rb
|
34
|
+
- libpq-compat.c
|
35
|
+
- Makefile
|
36
|
+
- MANIFEST
|
37
|
+
- mkmf.log
|
38
|
+
- postgres.c
|
39
|
+
- postgres.o
|
40
|
+
- postgres.so
|
41
|
+
- README
|
42
|
+
- README.ja
|
43
|
+
- ruby-postgres.gemspec
|
44
|
+
- sample
|
45
|
+
- tests
|
46
|
+
- type-oids.h
|
47
|
+
- doc/postgres.html
|
48
|
+
- doc/postgres.jp.html
|
49
|
+
- sample/losample.rb
|
50
|
+
- sample/psql.rb
|
51
|
+
- sample/psqlHelp.rb
|
52
|
+
- sample/test1.rb
|
53
|
+
- sample/test2.rb
|
54
|
+
- sample/test4.rb
|
55
|
+
- tests/tc_postgres.rb
|
58
56
|
test_files: []
|
59
|
-
|
60
57
|
rdoc_options: []
|
61
|
-
|
62
58
|
extra_rdoc_files: []
|
63
|
-
|
64
59
|
executables: []
|
65
|
-
|
66
60
|
extensions: []
|
67
|
-
|
68
61
|
requirements:
|
69
|
-
- PostgreSQL libpq library and headers
|
70
|
-
dependencies: []
|
71
|
-
|
62
|
+
- PostgreSQL libpq library and headers
|
63
|
+
dependencies: []
|
Binary file
|