swift-db-postgres 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cc766e16cbc7b9e12a4d7d2b4279ab7367abd1fb
4
+ data.tar.gz: 93df7185b55a780878477a44188c103ff4be7a83
5
+ SHA512:
6
+ metadata.gz: 04e72c8d3cd07ba18bcd643566819e2fcf44e63aded792b365a48f607c69243d534dd3292b27ed4985013a653433aa264ee2124e4a5311e0d7ca4819f9fe5214
7
+ data.tar.gz: 596140d12a9a7b8de1ba2361cee3ef1c660926a640ca89d6010810fa0d16bab18f004012077c194e721098a72ee84a288bac56b7b9848b7b8b56c02f36f56f30
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.3.1 (2015-03-22)
2
+
3
+ * prepared statement uuid overflow fix.
4
+
1
5
  == 0.3.0 (2013-02-19)
2
6
 
3
7
  * supports encoding option while connecting.
data/README.md CHANGED
@@ -10,6 +10,18 @@ MRI adapter for PostgreSQL
10
10
  * Asynchronous support using PQsendQuery family of functions
11
11
  * Nested transactions
12
12
 
13
+ ## Requirements
14
+
15
+ * postgresql client deveopment libraries (libpq-dev)
16
+ * uuid development libraries (uuid-dev)
17
+
18
+ ## Building
19
+
20
+ ```
21
+ git submodule update --init
22
+ rake
23
+ ```
24
+
13
25
  ## API
14
26
 
15
27
  ```
@@ -12,11 +12,12 @@ VALUE rb_uuid_string() {
12
12
  char uuid_hex[sizeof(uuid_t) * 2 + 1];
13
13
 
14
14
  uuid_generate(uuid);
15
+
16
+ memset(uuid_hex, 0, sizeof(uuid_hex));
15
17
  for (n = 0; n < sizeof(uuid_t); n++)
16
- sprintf(uuid_hex + n * 2 + 1, "%02x", uuid[n]);
18
+ sprintf(uuid_hex + n * 2, "%02x", uuid[n]);
17
19
 
18
- uuid_hex[0] = 'u';
19
- return rb_str_new(uuid_hex, sizeof(uuid_t) * 2 + 1);
20
+ return rb_str_new(uuid_hex, sizeof(uuid_t) * 2);
20
21
  }
21
22
 
22
23
  /* NOTE: very naive, no regex etc. */
@@ -1,6 +1,11 @@
1
1
  #include "datetime.h"
2
+ #include <time.h>
2
3
  #include <ctype.h>
3
4
 
5
+ #define CONST_GET(scope, constant) rb_funcall(scope, rb_intern("const_get"), 1, rb_str_new2(constant))
6
+ #define TO_S(v) rb_funcall(v, rb_intern("to_s"), 0)
7
+ #define CSTRING(v) RSTRING_PTR(TO_S(v))
8
+
4
9
  extern VALUE dtformat;
5
10
 
6
11
  VALUE cSwiftDateTime, day_seconds;
@@ -1,8 +1,11 @@
1
1
  #pragma once
2
2
 
3
- #include "common.h"
4
- #include <math.h>
3
+ #include <ruby.h>
4
+ #include <stdlib.h>
5
+ #include <stdint.h>
6
+ #include <string.h>
7
+ #include <stdbool.h>
5
8
 
6
- DLL_PRIVATE extern VALUE cSwiftDateTime;
7
- DLL_PRIVATE void init_swift_datetime();
8
- DLL_PRIVATE VALUE datetime_parse(VALUE klass, const char *data, size_t size);
9
+ extern VALUE cSwiftDateTime;
10
+ void init_swift_datetime();
11
+ VALUE datetime_parse(VALUE klass, const char *data, size_t size);
@@ -2,33 +2,34 @@ require 'helper'
2
2
 
3
3
  describe 'async operations' do
4
4
  it 'can query async and call block with result when ready' do
5
- rows = []
6
- pool = 3.times.map {Swift::DB::Postgres.new(db: 'swift_test')}
5
+ rows = []
6
+ threads = []
7
+ pool = 3.times.map {Swift::DB::Postgres.new(db: 'swift_test')}
7
8
 
8
9
  3.times do |n|
9
- Thread.new do
10
+ threads << Thread.new do
10
11
  pool[n].query("select pg_sleep(#{(3 - n) / 10.0}), #{n + 1} as query_id") {|row| rows << row[:query_id]}
11
12
  end
12
13
  end
13
14
 
14
- Thread.list.reject {|thread| Thread.current == thread}.each(&:join)
15
+ threads.each(&:join)
15
16
  assert_equal [3, 2, 1], rows
16
17
  end
17
18
 
18
19
  it 'returns and allows IO poll on connection file descriptor' do
19
-
20
- rows = []
21
- pool = 3.times.map {Swift::DB::Postgres.new(db: 'swift_test')}
20
+ rows = []
21
+ threads = []
22
+ pool = 3.times.map {Swift::DB::Postgres.new(db: 'swift_test')}
22
23
 
23
24
  3.times do |n|
24
- Thread.new do
25
+ threads << Thread.new do
25
26
  pool[n].query("select pg_sleep(#{(3 - n) / 10.0}), #{n + 1} as query_id")
26
27
  IO.select([IO.for_fd(pool[n].fileno)], [], [])
27
28
  rows << pool[n].result.first[:query_id]
28
29
  end
29
30
  end
30
31
 
31
- Thread.list.reject {|thread| Thread.current == thread}.each(&:join)
32
+ threads.each(&:join)
32
33
  assert_equal [3, 2, 1], rows
33
34
  end
34
35
  end
metadata CHANGED
@@ -1,30 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swift-db-postgres
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
5
- prerelease:
4
+ version: 0.3.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Bharanee Rathna
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-19 00:00:00.000000000 Z
11
+ date: 2015-03-22 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rake
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  description: Swift adapter for PostgreSQL database
@@ -35,53 +32,53 @@ extensions:
35
32
  - ext/swift/db/postgres/extconf.rb
36
33
  extra_rdoc_files: []
37
34
  files:
38
- - ext/swift/db/postgres/datetime.c
39
- - ext/swift/db/postgres/result.c
35
+ - CHANGELOG
36
+ - README.md
40
37
  - ext/swift/db/postgres/adapter.c
41
- - ext/swift/db/postgres/typecast.c
38
+ - ext/swift/db/postgres/adapter.h
42
39
  - ext/swift/db/postgres/common.c
43
- - ext/swift/db/postgres/main.c
44
- - ext/swift/db/postgres/statement.c
45
- - ext/swift/db/postgres/typecast.h
40
+ - ext/swift/db/postgres/common.h
41
+ - ext/swift/db/postgres/datetime.c
46
42
  - ext/swift/db/postgres/datetime.h
47
- - ext/swift/db/postgres/result.h
43
+ - ext/swift/db/postgres/extconf.rb
48
44
  - ext/swift/db/postgres/gvl.h
45
+ - ext/swift/db/postgres/main.c
46
+ - ext/swift/db/postgres/result.c
47
+ - ext/swift/db/postgres/result.h
48
+ - ext/swift/db/postgres/statement.c
49
49
  - ext/swift/db/postgres/statement.h
50
- - ext/swift/db/postgres/adapter.h
51
- - ext/swift/db/postgres/common.h
52
- - ext/swift/db/postgres/extconf.rb
53
- - test/test_ssl.rb
50
+ - ext/swift/db/postgres/typecast.c
51
+ - ext/swift/db/postgres/typecast.h
52
+ - lib/swift-db-postgres.rb
53
+ - lib/swift/db/postgres.rb
54
+ - test/helper.rb
54
55
  - test/test_adapter.rb
55
- - test/test_encoding.rb
56
56
  - test/test_async.rb
57
- - test/helper.rb
58
- - lib/swift/db/postgres.rb
59
- - lib/swift-db-postgres.rb
60
- - README.md
61
- - CHANGELOG
57
+ - test/test_encoding.rb
58
+ - test/test_ssl.rb
62
59
  homepage: http://github.com/deepfryed/swift-db-postgres
63
60
  licenses: []
61
+ metadata: {}
64
62
  post_install_message:
65
63
  rdoc_options: []
66
64
  require_paths:
67
65
  - lib
68
66
  - ext
69
67
  required_ruby_version: !ruby/object:Gem::Requirement
70
- none: false
71
68
  requirements:
72
- - - ! '>='
69
+ - - ">="
73
70
  - !ruby/object:Gem::Version
74
71
  version: '0'
75
72
  required_rubygems_version: !ruby/object:Gem::Requirement
76
- none: false
77
73
  requirements:
78
- - - ! '>='
74
+ - - ">="
79
75
  - !ruby/object:Gem::Version
80
76
  version: '0'
81
77
  requirements: []
82
78
  rubyforge_project:
83
- rubygems_version: 1.8.24
79
+ rubygems_version: 2.2.0
84
80
  signing_key:
85
- specification_version: 3
81
+ specification_version: 4
86
82
  summary: Swift postgres adapter
87
83
  test_files: []
84
+ has_rdoc: