ruby-postgres 0.7.1.2005.11.27 → 0.7.1.2005.12.19
Sign up to get free protection for your applications and to get access to all the features.
- data/postgres.c +101 -19
- data/ruby-postgres.gemspec +35 -35
- data/tests/tc_postgres.rb +7 -15
- metadata +41 -37
- data/Makefile +0 -139
- data/mkmf.log +0 -154
data/postgres.c
CHANGED
@@ -78,7 +78,8 @@ static VALUE rb_cPGlarge;
|
|
78
78
|
static VALUE rb_cPGrow;
|
79
79
|
|
80
80
|
static VALUE pgconn_lastval _((VALUE));
|
81
|
-
|
81
|
+
static VALUE pgresult_fields _((VALUE));
|
82
|
+
static VALUE pgresult_clear _((VALUE));
|
82
83
|
static VALUE pgresult_result_with_clear _((VALUE));
|
83
84
|
static VALUE pgresult_new _((PGresult*));
|
84
85
|
|
@@ -252,8 +253,8 @@ format_array_element(obj)
|
|
252
253
|
VALUE obj;
|
253
254
|
{
|
254
255
|
if (TYPE(obj) == T_STRING) {
|
255
|
-
obj = rb_funcall(obj, rb_intern("gsub"), 2, rb_reg_new("(?=[\\\\\"])", 9, 0), "\\");
|
256
|
-
return rb_funcall(obj, rb_intern("gsub!"), 2, rb_reg_new("^|$", 3, 0), "\"");
|
256
|
+
obj = rb_funcall(obj, rb_intern("gsub"), 2, rb_reg_new("(?=[\\\\\"])", 9, 0), rb_str_new2("\\"));
|
257
|
+
return rb_funcall(obj, rb_intern("gsub!"), 2, rb_reg_new("^|$", 3, 0), rb_str_new2("\""));
|
257
258
|
}
|
258
259
|
else {
|
259
260
|
return pgconn_s_format(NULL, obj);
|
@@ -546,7 +547,7 @@ pgconn_exec(argc, argv, obj)
|
|
546
547
|
result = PQexecParams(conn, StringValuePtr(command), len, NULL, values, NULL, NULL, 0);
|
547
548
|
#else
|
548
549
|
for (i = 0; i < len; i++) {
|
549
|
-
|
550
|
+
rb_ary_push(params, pgconn_s_quote(NULL, rb_ary_entry(params, i)));
|
550
551
|
}
|
551
552
|
result = PQexecParams_compat(conn, command, params);
|
552
553
|
#endif
|
@@ -1277,6 +1278,86 @@ pgresult_status(obj)
|
|
1277
1278
|
* Returns an array of tuples (rows, which are themselves arrays) that represent the query result.
|
1278
1279
|
*/
|
1279
1280
|
|
1281
|
+
static VALUE
|
1282
|
+
fetch_pgrow(self, fields, row_num)
|
1283
|
+
VALUE self, fields;
|
1284
|
+
int row_num;
|
1285
|
+
{
|
1286
|
+
PGresult *result = get_pgresult(self);
|
1287
|
+
VALUE row = rb_funcall(rb_cPGrow, rb_intern("new"), 1, fields);
|
1288
|
+
int field_num;
|
1289
|
+
for (field_num = 0; field_num < RARRAY(fields)->len; field_num++) {
|
1290
|
+
rb_ary_push(row, fetch_pgresult(result, row_num, field_num));
|
1291
|
+
}
|
1292
|
+
return row;
|
1293
|
+
}
|
1294
|
+
|
1295
|
+
/*
|
1296
|
+
* call-seq:
|
1297
|
+
* conn.select_one(query, *bind_values)
|
1298
|
+
*
|
1299
|
+
* Return the first row of the query results.
|
1300
|
+
* Equivalent to conn.query(query, *bind_values).first
|
1301
|
+
*/
|
1302
|
+
static VALUE
|
1303
|
+
pgconn_select_one(argc, argv, self)
|
1304
|
+
int argc;
|
1305
|
+
VALUE *argv;
|
1306
|
+
VALUE self;
|
1307
|
+
{
|
1308
|
+
VALUE result = pgconn_exec(argc, argv, self);
|
1309
|
+
VALUE row = fetch_pgrow(result, pgresult_fields(self), 0);
|
1310
|
+
pgresult_clear(result);
|
1311
|
+
return row;
|
1312
|
+
}
|
1313
|
+
|
1314
|
+
/*
|
1315
|
+
* call-seq:
|
1316
|
+
* conn.select_value(query, *bind_values)
|
1317
|
+
*
|
1318
|
+
* Return the first value of the first row of the query results.
|
1319
|
+
* Equivalent to conn.query(query, *bind_values).first.first
|
1320
|
+
*/
|
1321
|
+
static VALUE
|
1322
|
+
pgconn_select_value(argc, argv, self)
|
1323
|
+
int argc;
|
1324
|
+
VALUE *argv;
|
1325
|
+
VALUE self;
|
1326
|
+
{
|
1327
|
+
PGresult *result = get_pgresult(pgconn_exec(argc, argv, self));
|
1328
|
+
VALUE value = fetch_pgresult(result, 0, 0);
|
1329
|
+
PQclear(result);
|
1330
|
+
return value;
|
1331
|
+
}
|
1332
|
+
|
1333
|
+
/*
|
1334
|
+
* call-seq:
|
1335
|
+
* conn.select_values(query, *bind_values)
|
1336
|
+
*
|
1337
|
+
* Equivalent to conn.query(query, *bind_values).flatten
|
1338
|
+
*/
|
1339
|
+
static VALUE
|
1340
|
+
pgconn_select_values(argc, argv, self)
|
1341
|
+
int argc;
|
1342
|
+
VALUE *argv;
|
1343
|
+
VALUE self;
|
1344
|
+
{
|
1345
|
+
PGresult *result = get_pgresult(pgconn_exec(argc, argv, self));
|
1346
|
+
int ntuples = PQntuples(result);
|
1347
|
+
int nfields = PQnfields(result);
|
1348
|
+
|
1349
|
+
VALUE values = rb_ary_new2(ntuples * nfields);
|
1350
|
+
int row_num, field_num;
|
1351
|
+
for (row_num = 0; row_num < ntuples; row_num++) {
|
1352
|
+
for (field_num = 0; field_num < nfields; field_num++) {
|
1353
|
+
rb_ary_push(values, fetch_pgresult(result, row_num, field_num));
|
1354
|
+
}
|
1355
|
+
}
|
1356
|
+
|
1357
|
+
PQclear(result);
|
1358
|
+
return values;
|
1359
|
+
}
|
1360
|
+
|
1280
1361
|
/*
|
1281
1362
|
* call-seq:
|
1282
1363
|
* res.each{ |tuple| ... }
|
@@ -1289,21 +1370,13 @@ static VALUE
|
|
1289
1370
|
pgresult_each(self)
|
1290
1371
|
VALUE self;
|
1291
1372
|
{
|
1292
|
-
int i, j;
|
1293
|
-
|
1294
1373
|
PGresult *result = get_pgresult(self);
|
1295
|
-
int
|
1296
|
-
|
1297
|
-
VALUE fields[1] = { rb_ary_new2(nf) };
|
1298
|
-
|
1299
|
-
for (i = 0; i < nf; i++)
|
1300
|
-
rb_ary_push(fields[0], rb_tainted_str_new2(PQfname(result, i)));
|
1374
|
+
int row_count = PQntuples(result);
|
1375
|
+
VALUE fields = pgresult_fields(self);
|
1301
1376
|
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1305
|
-
rb_ary_store(row, j, fetch_pgresult(result, i, j));
|
1306
|
-
}
|
1377
|
+
int row_num;
|
1378
|
+
for (row_num = 0; row_num < row_count; row_num++) {
|
1379
|
+
VALUE row = fetch_pgrow(self, fields, row_num);
|
1307
1380
|
rb_yield(row);
|
1308
1381
|
}
|
1309
1382
|
|
@@ -2261,8 +2334,13 @@ pgrow_aref(argc, argv, self)
|
|
2261
2334
|
{
|
2262
2335
|
if (TYPE(argv[0]) == T_STRING) {
|
2263
2336
|
VALUE keys = pgrow_keys(self);
|
2264
|
-
|
2265
|
-
|
2337
|
+
VALUE index = rb_funcall(keys, rb_intern("index"), 1, argv[0]);
|
2338
|
+
if (index == Qnil) {
|
2339
|
+
rb_raise(rb_ePGError, "%s: field not found", StringValuePtr(argv[0]));
|
2340
|
+
}
|
2341
|
+
else {
|
2342
|
+
return rb_ary_entry(self, NUM2INT(index));
|
2343
|
+
}
|
2266
2344
|
}
|
2267
2345
|
else {
|
2268
2346
|
return rb_call_super(argc, argv);
|
@@ -2418,6 +2496,7 @@ Init_postgres()
|
|
2418
2496
|
rb_cDateTime = RUBY_CLASS("DateTime");
|
2419
2497
|
|
2420
2498
|
rb_ePGError = rb_define_class("PGError", rb_eStandardError);
|
2499
|
+
rb_define_alias(rb_ePGError, "error", "message");
|
2421
2500
|
|
2422
2501
|
rb_cPGconn = rb_define_class("PGconn", rb_cObject);
|
2423
2502
|
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
|
@@ -2456,6 +2535,9 @@ Init_postgres()
|
|
2456
2535
|
rb_define_method(rb_cPGconn, "untrace", pgconn_untrace, 0);
|
2457
2536
|
rb_define_method(rb_cPGconn, "exec", pgconn_exec, -1);
|
2458
2537
|
rb_define_method(rb_cPGconn, "query", pgconn_query, -1);
|
2538
|
+
rb_define_method(rb_cPGconn, "select_one", pgconn_select_one, -1);
|
2539
|
+
rb_define_method(rb_cPGconn, "select_value", pgconn_select_value, -1);
|
2540
|
+
rb_define_method(rb_cPGconn, "select_values", pgconn_select_values, -1);
|
2459
2541
|
rb_define_method(rb_cPGconn, "async_exec", pgconn_async_exec, 1);
|
2460
2542
|
rb_define_method(rb_cPGconn, "async_query", pgconn_async_query, 1);
|
2461
2543
|
rb_define_method(rb_cPGconn, "get_notify", pgconn_get_notify, 0);
|
data/ruby-postgres.gemspec
CHANGED
@@ -1,35 +1,35 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'date'
|
3
|
-
|
4
|
-
SPEC = Gem::Specification.new do |s|
|
5
|
-
s.name = 'ruby-postgres'
|
6
|
-
s.rubyforge_project = 'ruby-postgres'
|
7
|
-
s.version = "0.7.1.#{Date.today
|
8
|
-
s.summary = 'Ruby extension for PostgreSQL database coordination'
|
9
|
-
s.author = 'Yukihiro Matsumoto, Eiji Matsumoto, Noboru Saitou, Dave Lee'
|
10
|
-
s.email = 'davelee.com@gmail.com'
|
11
|
-
s.homepage = 'http://ruby.scripting.ca/postgres/'
|
12
|
-
s.requirements = 'PostgreSQL libpq library and headers'
|
13
|
-
s.has_rdoc = true
|
14
|
-
s.require_path = '.'
|
15
|
-
s.autorequire = 'postgres'
|
16
|
-
|
17
|
-
if File.exists? 'postgres.so' and PLATFORM =~ /mingw|mswin/
|
18
|
-
s.platform = Gem::Platform::WIN32
|
19
|
-
else
|
20
|
-
s.platform = Gem::Platform::RUBY
|
21
|
-
s.extensions = 'extconf.rb'
|
22
|
-
end
|
23
|
-
|
24
|
-
if File.exists? '_darcs'
|
25
|
-
s.files = Dir.chdir('_darcs/current') { Dir['**/*'] }
|
26
|
-
else
|
27
|
-
s.files = Dir['**/*']
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
|
32
|
-
if $0 == __FILE__
|
33
|
-
Gem::manage_gems
|
34
|
-
Gem::Builder.new(SPEC).build
|
35
|
-
end
|
1
|
+
require 'rubygems'
|
2
|
+
require 'date'
|
3
|
+
|
4
|
+
SPEC = Gem::Specification.new do |s|
|
5
|
+
s.name = 'ruby-postgres'
|
6
|
+
s.rubyforge_project = 'ruby-postgres'
|
7
|
+
s.version = "0.7.1.#{Date.today}".tr('-', '.')
|
8
|
+
s.summary = 'Ruby extension for PostgreSQL database coordination'
|
9
|
+
s.author = 'Yukihiro Matsumoto, Eiji Matsumoto, Noboru Saitou, Dave Lee'
|
10
|
+
s.email = 'davelee.com@gmail.com'
|
11
|
+
s.homepage = 'http://ruby.scripting.ca/postgres/'
|
12
|
+
s.requirements = 'PostgreSQL libpq library and headers'
|
13
|
+
s.has_rdoc = true
|
14
|
+
s.require_path = '.'
|
15
|
+
s.autorequire = 'postgres'
|
16
|
+
|
17
|
+
if File.exists? 'postgres.so' and PLATFORM =~ /mingw|mswin/
|
18
|
+
s.platform = Gem::Platform::WIN32
|
19
|
+
else
|
20
|
+
s.platform = Gem::Platform::RUBY
|
21
|
+
s.extensions = 'extconf.rb'
|
22
|
+
end
|
23
|
+
|
24
|
+
if File.exists? '_darcs'
|
25
|
+
s.files = Dir.chdir('_darcs/current') { Dir['**/*'] }
|
26
|
+
else
|
27
|
+
s.files = Dir['**/*']
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
if $0 == __FILE__
|
33
|
+
Gem::manage_gems
|
34
|
+
Gem::Builder.new(SPEC).build
|
35
|
+
end
|
data/tests/tc_postgres.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'postgres'
|
2
|
-
require 'date'
|
3
2
|
require 'test/unit'
|
4
3
|
|
5
4
|
class PostgresTestCase < Test::Unit::TestCase
|
@@ -16,33 +15,26 @@ class PostgresTestCase < Test::Unit::TestCase
|
|
16
15
|
query = <<-EOT
|
17
16
|
select true as true_value,
|
18
17
|
false as false_value,
|
19
|
-
|
18
|
+
$1::bytea as bytea_value,
|
20
19
|
'2005-11-30'::date as date_value,
|
21
20
|
'12:00:00'::time as time_value,
|
22
|
-
|
21
|
+
'2005-11-30 12:00:00'::timestamp as date_time_value,
|
23
22
|
1.5::float as float_value,
|
24
23
|
12345.5678::numeric as numeric_value,
|
25
24
|
1234.56::numeric(10) as numeric_10_value,
|
26
25
|
12345.12345::numeric(10,5) as numeric_10_5_value
|
27
26
|
EOT
|
28
|
-
res = @conn.exec(query)
|
27
|
+
res = @conn.exec(query, '12345\111\000\111TEST')
|
29
28
|
assert_equal(res.num_tuples, 1)
|
30
29
|
assert_equal(res.num_fields, 10)
|
31
|
-
tuple = res.result
|
32
|
-
puts tuple
|
30
|
+
tuple = res.result.first
|
33
31
|
assert_equal(true, tuple['true_value'])
|
34
32
|
assert_equal(false, tuple['false_value'])
|
35
|
-
assert_equal("
|
36
|
-
puts PGconn.escape_bytea(tuple['bytea_value'])
|
37
|
-
assert_equal("12345I\\\\000ITEST", PGconn.escape_bytea(tuple['bytea_value']))
|
33
|
+
assert_equal("12345I\000ITEST", tuple['bytea_value'])
|
38
34
|
assert_equal(Date.parse('2005-11-30'), tuple['date_value'])
|
39
|
-
|
40
|
-
|
41
|
-
puts tuple['time_value']
|
42
|
-
assert_kind_of(DateTime, tuple['date_time_value'])
|
43
|
-
puts tuple['date_time_value']
|
35
|
+
assert_equal(Time.parse('12:00:00'), tuple['time_value'])
|
36
|
+
assert_equal(DateTime.parse('2005-11-30 12:00:00'), tuple['date_time_value'])
|
44
37
|
assert_equal(1.5, tuple['float_value'])
|
45
|
-
puts PGconn.quote(tuple['numeric_value'])
|
46
38
|
assert_equal(BigDecimal("12345.5678"), tuple['numeric_value'])
|
47
39
|
assert_equal(1235, tuple['numeric_10_value'])
|
48
40
|
assert_kind_of(Integer, tuple['numeric_10_value'])
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
|
2
|
-
rubygems_version: 0.8.
|
1
|
+
!ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.8.11
|
3
3
|
specification_version: 1
|
4
4
|
name: ruby-postgres
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.7.1.2005.
|
7
|
-
date: 2005-
|
6
|
+
version: 0.7.1.2005.12.19
|
7
|
+
date: 2005-12-19 00:00:00 -07:00
|
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,45 +18,49 @@ bindir: bin
|
|
18
18
|
has_rdoc: true
|
19
19
|
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
20
|
requirements:
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
version: 0.0.0
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.0
|
25
24
|
version:
|
26
25
|
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
27
28
|
authors:
|
28
|
-
|
29
|
+
- Yukihiro Matsumoto, Eiji Matsumoto, Noboru Saitou, Dave Lee
|
29
30
|
files:
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
- sample/test4.rb
|
53
|
-
- tests/tc_postgres.rb
|
31
|
+
- ChangeLog
|
32
|
+
- Contributors
|
33
|
+
- doc
|
34
|
+
- extconf.rb
|
35
|
+
- libpq-compat.c
|
36
|
+
- MANIFEST
|
37
|
+
- postgres.c
|
38
|
+
- README
|
39
|
+
- README.ja
|
40
|
+
- ruby-postgres.gemspec
|
41
|
+
- sample
|
42
|
+
- tests
|
43
|
+
- type-oids.h
|
44
|
+
- doc/postgres.html
|
45
|
+
- doc/postgres.jp.html
|
46
|
+
- sample/losample.rb
|
47
|
+
- sample/psql.rb
|
48
|
+
- sample/psqlHelp.rb
|
49
|
+
- sample/test1.rb
|
50
|
+
- sample/test2.rb
|
51
|
+
- sample/test4.rb
|
52
|
+
- tests/tc_postgres.rb
|
54
53
|
test_files: []
|
54
|
+
|
55
55
|
rdoc_options: []
|
56
|
+
|
56
57
|
extra_rdoc_files: []
|
58
|
+
|
57
59
|
executables: []
|
60
|
+
|
58
61
|
extensions:
|
59
|
-
|
62
|
+
- extconf.rb
|
60
63
|
requirements:
|
61
|
-
|
62
|
-
dependencies: []
|
64
|
+
- PostgreSQL libpq library and headers
|
65
|
+
dependencies: []
|
66
|
+
|
data/Makefile
DELETED
@@ -1,139 +0,0 @@
|
|
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
|
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/mkmf.log
DELETED
@@ -1,154 +0,0 @@
|
|
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
|
-
|