ruby-postgres 0.7.1.2005.12.19 → 0.7.1.2005.12.20
Sign up to get free protection for your applications and to get access to all the features.
- data/Makefile +139 -0
- data/extconf.rb +1 -0
- data/mkmf.log +154 -0
- data/postgres.c +12 -11
- data/ruby-postgres.gemspec +2 -4
- data/tests/tc_postgres.rb +24 -0
- metadata +37 -41
data/Makefile
ADDED
@@ -0,0 +1,139 @@
|
|
1
|
+
|
2
|
+
SHELL = /bin/sh
|
3
|
+
|
4
|
+
#### Start of system configuration section. ####
|
5
|
+
|
6
|
+
srcdir = .
|
7
|
+
topdir = c:/mingw/ruby/lib/ruby/1.8/i386-mingw32
|
8
|
+
hdrdir = $(topdir)
|
9
|
+
VPATH = $(srcdir);$(topdir);$(hdrdir)
|
10
|
+
|
11
|
+
DESTDIR = c:
|
12
|
+
prefix = $(DESTDIR)/mingw/ruby
|
13
|
+
exec_prefix = $(DESTDIR)/mingw/ruby
|
14
|
+
sitedir = $(prefix)/lib/ruby/site_ruby
|
15
|
+
rubylibdir = $(libdir)/ruby/$(ruby_version)
|
16
|
+
archdir = $(rubylibdir)/$(arch)
|
17
|
+
sbindir = $(exec_prefix)/sbin
|
18
|
+
datadir = $(prefix)/share
|
19
|
+
includedir = $(prefix)/include
|
20
|
+
infodir = $(prefix)/info
|
21
|
+
sysconfdir = $(prefix)/etc
|
22
|
+
mandir = $(prefix)/man
|
23
|
+
libdir = $(DESTDIR)/mingw/ruby/lib
|
24
|
+
sharedstatedir = $(prefix)/com
|
25
|
+
oldincludedir = $(DESTDIR)/usr/include
|
26
|
+
sitearchdir = $(sitelibdir)/$(sitearch)
|
27
|
+
bindir = $(exec_prefix)/bin
|
28
|
+
localstatedir = $(prefix)/var
|
29
|
+
sitelibdir = $(sitedir)/$(ruby_version)
|
30
|
+
libexecdir = $(exec_prefix)/libexec
|
31
|
+
|
32
|
+
CC = gcc
|
33
|
+
LIBRUBY = lib$(LIBRUBY_SO).a
|
34
|
+
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
35
|
+
LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
|
36
|
+
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
|
37
|
+
|
38
|
+
CFLAGS = -g -O2 -Wall
|
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
|
+
CXXFLAGS = $(CFLAGS)
|
41
|
+
DLDFLAGS = -Wl,--enable-auto-import,--export-all
|
42
|
+
LDSHARED = gcc -shared -s
|
43
|
+
AR = ar
|
44
|
+
EXEEXT = .exe
|
45
|
+
|
46
|
+
RUBY_INSTALL_NAME = ruby
|
47
|
+
RUBY_SO_NAME = msvcrt-ruby18
|
48
|
+
arch = i386-mingw32
|
49
|
+
sitearch = i386-msvcrt
|
50
|
+
ruby_version = 1.8
|
51
|
+
ruby = c:/mingw/ruby/bin/ruby
|
52
|
+
RUBY = $(ruby)
|
53
|
+
RM = rm -f
|
54
|
+
MAKEDIRS = mkdir -p
|
55
|
+
INSTALL = /bin/install -c
|
56
|
+
INSTALL_PROG = $(INSTALL) -m 0755
|
57
|
+
INSTALL_DATA = $(INSTALL) -m 644
|
58
|
+
COPY = cp
|
59
|
+
|
60
|
+
#### End of system configuration section. ####
|
61
|
+
|
62
|
+
preload =
|
63
|
+
|
64
|
+
libpath = c:/apps/POSTGR~1/8.1/lib $(libdir)
|
65
|
+
LIBPATH = -L"c:/apps/POSTGR~1/8.1/lib" -L"$(libdir)"
|
66
|
+
DEFFILE =
|
67
|
+
|
68
|
+
CLEANFILES =
|
69
|
+
DISTCLEANFILES =
|
70
|
+
|
71
|
+
extout =
|
72
|
+
extout_prefix =
|
73
|
+
target_prefix =
|
74
|
+
LOCAL_LIBS =
|
75
|
+
LIBS = $(LIBRUBYARG_SHARED) -lpq -lwsock32
|
76
|
+
SRCS = postgres.c
|
77
|
+
OBJS = postgres.o
|
78
|
+
TARGET = postgres
|
79
|
+
DLLIB = $(TARGET).so
|
80
|
+
STATIC_LIB =
|
81
|
+
|
82
|
+
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
83
|
+
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
84
|
+
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
85
|
+
|
86
|
+
TARGET_SO = $(DLLIB)
|
87
|
+
CLEANLIBS = $(TARGET).so $(TARGET).il? $(TARGET).tds $(TARGET).map
|
88
|
+
CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
|
89
|
+
|
90
|
+
all: $(DLLIB)
|
91
|
+
static: $(STATIC_LIB)
|
92
|
+
|
93
|
+
clean:
|
94
|
+
@-$(RM) $(CLEANLIBS:/=\) $(CLEANOBJS:/=\) $(CLEANFILES:/=\)
|
95
|
+
|
96
|
+
distclean: clean
|
97
|
+
@-$(RM) Makefile extconf.h conftest.* mkmf.log
|
98
|
+
@-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES:/=\)
|
99
|
+
|
100
|
+
realclean: distclean
|
101
|
+
install: install-so install-rb
|
102
|
+
|
103
|
+
install-so: $(RUBYARCHDIR)
|
104
|
+
install-so: $(RUBYARCHDIR)/$(DLLIB)
|
105
|
+
$(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
|
106
|
+
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
107
|
+
install-rb: pre-install-rb install-rb-default
|
108
|
+
install-rb-default: pre-install-rb-default
|
109
|
+
pre-install-rb pre-install-rb-default: $(RUBYLIBDIR)
|
110
|
+
$(RUBYARCHDIR):
|
111
|
+
$(MAKEDIRS) $@
|
112
|
+
$(RUBYLIBDIR):
|
113
|
+
$(MAKEDIRS) $@
|
114
|
+
|
115
|
+
site-install: site-install-so site-install-rb
|
116
|
+
site-install-so: install-so
|
117
|
+
site-install-rb: install-rb
|
118
|
+
|
119
|
+
.SUFFIXES: .c .m .cc .cxx .cpp .o
|
120
|
+
|
121
|
+
.cc.o:
|
122
|
+
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
|
123
|
+
|
124
|
+
.cxx.o:
|
125
|
+
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
|
126
|
+
|
127
|
+
.cpp.o:
|
128
|
+
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
|
129
|
+
|
130
|
+
.c.o:
|
131
|
+
$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
|
132
|
+
|
133
|
+
$(DLLIB): $(OBJS)
|
134
|
+
@-$(RM) $@
|
135
|
+
$(LDSHARED) $(DLDFLAGS) $(LIBPATH) -o $@ $(OBJS) $(LOCAL_LIBS) $(LIBS)
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
$(OBJS): ruby.h defines.h
|
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/mkmf.log
ADDED
@@ -0,0 +1,154 @@
|
|
1
|
+
have_library: checking for main() in -lpq... -------------------- yes
|
2
|
+
|
3
|
+
"gcc -o conftest -I. -Ic:/mingw/ruby/lib/ruby/1.8/i386-mingw32 -Ic:/apps/POSTGR~1/8.1/include -g -O2 conftest.c -L"c:/apps/POSTGR~1/8.1/lib" -L"c:/mingw/ruby/lib" -lmsvcrt-ruby18-static -lpq -lwsock32 "
|
4
|
+
checked program was:
|
5
|
+
/* begin */
|
6
|
+
|
7
|
+
/*top*/
|
8
|
+
int main() { return 0; }
|
9
|
+
int t() { main(); return 0; }
|
10
|
+
/* end */
|
11
|
+
|
12
|
+
--------------------
|
13
|
+
|
14
|
+
have_header: checking for libpq-fe.h... -------------------- yes
|
15
|
+
|
16
|
+
"gcc -E -I. -Ic:/mingw/ruby/lib/ruby/1.8/i386-mingw32 -Ic:/apps/POSTGR~1/8.1/include -g -O2 conftest.c -o conftest.i"
|
17
|
+
checked program was:
|
18
|
+
/* begin */
|
19
|
+
#include <libpq-fe.h>
|
20
|
+
/* end */
|
21
|
+
|
22
|
+
--------------------
|
23
|
+
|
24
|
+
have_header: checking for libpq/libpq-fs.h... -------------------- yes
|
25
|
+
|
26
|
+
"gcc -E -I. -Ic:/mingw/ruby/lib/ruby/1.8/i386-mingw32 -Ic:/apps/POSTGR~1/8.1/include -g -O2 conftest.c -o conftest.i"
|
27
|
+
checked program was:
|
28
|
+
/* begin */
|
29
|
+
#include <libpq/libpq-fs.h>
|
30
|
+
/* end */
|
31
|
+
|
32
|
+
--------------------
|
33
|
+
|
34
|
+
have_library: checking for main() in -lcrypto... -------------------- no
|
35
|
+
|
36
|
+
"gcc -o conftest -I. -Ic:/mingw/ruby/lib/ruby/1.8/i386-mingw32 -Ic:/apps/POSTGR~1/8.1/include -g -O2 conftest.c -L"c:/apps/POSTGR~1/8.1/lib" -L"c:/mingw/ruby/lib" -lpq -lmsvcrt-ruby18-static -lcrypto -lpq -lwsock32 "
|
37
|
+
c:\mingw\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot find -lcrypto
|
38
|
+
collect2: ld returned 1 exit status
|
39
|
+
checked program was:
|
40
|
+
/* begin */
|
41
|
+
|
42
|
+
/*top*/
|
43
|
+
int main() { return 0; }
|
44
|
+
int t() { main(); return 0; }
|
45
|
+
/* end */
|
46
|
+
|
47
|
+
"gcc -o conftest -I. -Ic:/mingw/ruby/lib/ruby/1.8/i386-mingw32 -Ic:/apps/POSTGR~1/8.1/include -g -O2 conftest.c -L"c:/apps/POSTGR~1/8.1/lib" -L"c:/mingw/ruby/lib" -lpq -lmsvcrt-ruby18-static -lcrypto -lpq -lwsock32 "
|
48
|
+
c:\mingw\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot find -lcrypto
|
49
|
+
collect2: ld returned 1 exit status
|
50
|
+
checked program was:
|
51
|
+
/* begin */
|
52
|
+
#include <windows.h>
|
53
|
+
#include <winsock.h>
|
54
|
+
|
55
|
+
/*top*/
|
56
|
+
int main() { return 0; }
|
57
|
+
int t() { void ((*volatile p)()); p = (void ((*)()))main; return 0; }
|
58
|
+
/* end */
|
59
|
+
|
60
|
+
--------------------
|
61
|
+
|
62
|
+
have_library: checking for main() in -lssl... -------------------- no
|
63
|
+
|
64
|
+
"gcc -o conftest -I. -Ic:/mingw/ruby/lib/ruby/1.8/i386-mingw32 -Ic:/apps/POSTGR~1/8.1/include -g -O2 conftest.c -L"c:/apps/POSTGR~1/8.1/lib" -L"c:/mingw/ruby/lib" -lpq -lmsvcrt-ruby18-static -lssl -lpq -lwsock32 "
|
65
|
+
c:\mingw\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot find -lssl
|
66
|
+
collect2: ld returned 1 exit status
|
67
|
+
checked program was:
|
68
|
+
/* begin */
|
69
|
+
|
70
|
+
/*top*/
|
71
|
+
int main() { return 0; }
|
72
|
+
int t() { main(); return 0; }
|
73
|
+
/* end */
|
74
|
+
|
75
|
+
"gcc -o conftest -I. -Ic:/mingw/ruby/lib/ruby/1.8/i386-mingw32 -Ic:/apps/POSTGR~1/8.1/include -g -O2 conftest.c -L"c:/apps/POSTGR~1/8.1/lib" -L"c:/mingw/ruby/lib" -lpq -lmsvcrt-ruby18-static -lssl -lpq -lwsock32 "
|
76
|
+
c:\mingw\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot find -lssl
|
77
|
+
collect2: ld returned 1 exit status
|
78
|
+
checked program was:
|
79
|
+
/* begin */
|
80
|
+
#include <windows.h>
|
81
|
+
#include <winsock.h>
|
82
|
+
|
83
|
+
/*top*/
|
84
|
+
int main() { return 0; }
|
85
|
+
int t() { void ((*volatile p)()); p = (void ((*)()))main; return 0; }
|
86
|
+
/* end */
|
87
|
+
|
88
|
+
--------------------
|
89
|
+
|
90
|
+
have_func: checking for PQsetClientEncoding()... -------------------- yes
|
91
|
+
|
92
|
+
"gcc -o conftest -I. -Ic:/mingw/ruby/lib/ruby/1.8/i386-mingw32 -Ic:/apps/POSTGR~1/8.1/include -g -O2 conftest.c -L"c:/apps/POSTGR~1/8.1/lib" -L"c:/mingw/ruby/lib" -lpq -lmsvcrt-ruby18-static -lpq -lwsock32 "
|
93
|
+
checked program was:
|
94
|
+
/* begin */
|
95
|
+
|
96
|
+
/*top*/
|
97
|
+
int main() { return 0; }
|
98
|
+
int t() { PQsetClientEncoding(); return 0; }
|
99
|
+
/* end */
|
100
|
+
|
101
|
+
--------------------
|
102
|
+
|
103
|
+
have_func: checking for pg_encoding_to_char()... -------------------- yes
|
104
|
+
|
105
|
+
"gcc -o conftest -I. -Ic:/mingw/ruby/lib/ruby/1.8/i386-mingw32 -Ic:/apps/POSTGR~1/8.1/include -g -O2 conftest.c -L"c:/apps/POSTGR~1/8.1/lib" -L"c:/mingw/ruby/lib" -lpq -lmsvcrt-ruby18-static -lpq -lwsock32 "
|
106
|
+
checked program was:
|
107
|
+
/* begin */
|
108
|
+
|
109
|
+
/*top*/
|
110
|
+
int main() { return 0; }
|
111
|
+
int t() { pg_encoding_to_char(); return 0; }
|
112
|
+
/* end */
|
113
|
+
|
114
|
+
--------------------
|
115
|
+
|
116
|
+
have_func: checking for PQfreemem()... -------------------- yes
|
117
|
+
|
118
|
+
"gcc -o conftest -I. -Ic:/mingw/ruby/lib/ruby/1.8/i386-mingw32 -Ic:/apps/POSTGR~1/8.1/include -g -O2 conftest.c -L"c:/apps/POSTGR~1/8.1/lib" -L"c:/mingw/ruby/lib" -lpq -lmsvcrt-ruby18-static -lpq -lwsock32 "
|
119
|
+
checked program was:
|
120
|
+
/* begin */
|
121
|
+
|
122
|
+
/*top*/
|
123
|
+
int main() { return 0; }
|
124
|
+
int t() { PQfreemem(); return 0; }
|
125
|
+
/* end */
|
126
|
+
|
127
|
+
--------------------
|
128
|
+
|
129
|
+
have_func: checking for PQescapeString()... -------------------- yes
|
130
|
+
|
131
|
+
"gcc -o conftest -I. -Ic:/mingw/ruby/lib/ruby/1.8/i386-mingw32 -Ic:/apps/POSTGR~1/8.1/include -g -O2 conftest.c -L"c:/apps/POSTGR~1/8.1/lib" -L"c:/mingw/ruby/lib" -lpq -lmsvcrt-ruby18-static -lpq -lwsock32 "
|
132
|
+
checked program was:
|
133
|
+
/* begin */
|
134
|
+
|
135
|
+
/*top*/
|
136
|
+
int main() { return 0; }
|
137
|
+
int t() { PQescapeString(); return 0; }
|
138
|
+
/* end */
|
139
|
+
|
140
|
+
--------------------
|
141
|
+
|
142
|
+
have_func: checking for PQexecParams()... -------------------- yes
|
143
|
+
|
144
|
+
"gcc -o conftest -I. -Ic:/mingw/ruby/lib/ruby/1.8/i386-mingw32 -Ic:/apps/POSTGR~1/8.1/include -g -O2 conftest.c -L"c:/apps/POSTGR~1/8.1/lib" -L"c:/mingw/ruby/lib" -lpq -lmsvcrt-ruby18-static -lpq -lwsock32 "
|
145
|
+
checked program was:
|
146
|
+
/* begin */
|
147
|
+
|
148
|
+
/*top*/
|
149
|
+
int main() { return 0; }
|
150
|
+
int t() { PQexecParams(); return 0; }
|
151
|
+
/* end */
|
152
|
+
|
153
|
+
--------------------
|
154
|
+
|
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/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,49 +18,45 @@ 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: ruby
|
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
|
-
-
|
37
|
-
-
|
38
|
-
-
|
39
|
-
-
|
40
|
-
-
|
41
|
-
-
|
42
|
-
-
|
43
|
-
-
|
44
|
-
-
|
45
|
-
-
|
46
|
-
-
|
47
|
-
-
|
48
|
-
- sample/
|
49
|
-
- sample/
|
50
|
-
- sample/
|
51
|
-
- sample/
|
52
|
-
-
|
30
|
+
- ChangeLog
|
31
|
+
- Contributors
|
32
|
+
- doc
|
33
|
+
- extconf.rb
|
34
|
+
- libpq-compat.c
|
35
|
+
- Makefile
|
36
|
+
- MANIFEST
|
37
|
+
- mkmf.log
|
38
|
+
- postgres.c
|
39
|
+
- README
|
40
|
+
- README.ja
|
41
|
+
- ruby-postgres.gemspec
|
42
|
+
- sample
|
43
|
+
- tests
|
44
|
+
- type-oids.h
|
45
|
+
- doc/postgres.html
|
46
|
+
- doc/postgres.jp.html
|
47
|
+
- sample/losample.rb
|
48
|
+
- sample/psql.rb
|
49
|
+
- sample/psqlHelp.rb
|
50
|
+
- sample/test1.rb
|
51
|
+
- sample/test2.rb
|
52
|
+
- sample/test4.rb
|
53
|
+
- tests/tc_postgres.rb
|
53
54
|
test_files: []
|
54
|
-
|
55
55
|
rdoc_options: []
|
56
|
-
|
57
56
|
extra_rdoc_files: []
|
58
|
-
|
59
57
|
executables: []
|
60
|
-
|
61
58
|
extensions:
|
62
|
-
- extconf.rb
|
59
|
+
- extconf.rb
|
63
60
|
requirements:
|
64
|
-
- PostgreSQL libpq library and headers
|
65
|
-
dependencies: []
|
66
|
-
|
61
|
+
- PostgreSQL libpq library and headers
|
62
|
+
dependencies: []
|