swift 0.11.0 → 0.12.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.
data/API.rdoc CHANGED
@@ -40,6 +40,7 @@ Public API minus the optional stuff like Pool, IdentityMap, Migrations etc.
40
40
  Statement
41
41
  .new #=> Statement
42
42
  #execute #=> Result
43
+ #command #=> String # The SQL command executed or to be executed
43
44
 
44
45
  Scheme
45
46
  .attribute #=> Type
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.11.0
1
+ 0.12.0
data/ext/adapter.cc CHANGED
@@ -276,6 +276,7 @@ static VALUE adapter_prepare(int argc, VALUE *argv, VALUE self) {
276
276
  statement = handle->conn()->prepare(CSTRING(sql));
277
277
  prepared = statement_wrap_handle(cSwiftStatement, self, statement);
278
278
  rb_iv_set(prepared, "@scheme", scheme);
279
+ rb_iv_set(prepared, "@sql", sql);
279
280
  return prepared;
280
281
  }
281
282
  CATCH_DBI_EXCEPTIONS();
data/ext/statement.cc CHANGED
@@ -98,6 +98,10 @@ VALUE statement_initialize(VALUE self, VALUE adapter, VALUE sql) {
98
98
  return Qnil;
99
99
  }
100
100
 
101
+ VALUE statement_command(VALUE self) {
102
+ return rb_iv_get(self, "@sql");
103
+ }
104
+
101
105
  void init_swift_statement() {
102
106
  VALUE mSwift = rb_define_module("Swift");
103
107
 
@@ -105,5 +109,8 @@ void init_swift_statement() {
105
109
  rb_define_method(cSwiftStatement, "execute", RUBY_METHOD_FUNC(statement_execute), -1);
106
110
  rb_define_method(cSwiftStatement, "initialize", RUBY_METHOD_FUNC(statement_initialize), 2);
107
111
  rb_define_method(cSwiftStatement, "insert_id", RUBY_METHOD_FUNC(statement_insert_id), 0);
112
+ rb_define_method(cSwiftStatement, "command", RUBY_METHOD_FUNC(statement_command), 0);
113
+
114
+ rb_define_alias(cSwiftStatement, "to_s", "command");
108
115
  rb_define_alloc_func(cSwiftStatement, statement_alloc);
109
116
  }
data/swift.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{swift}
8
- s.version = "0.11.0"
8
+ s.version = "0.12.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Shane Hanna}, %q{Bharanee 'Barney' Rathna}]
12
- s.date = %q{2011-09-30}
12
+ s.date = %q{2011-10-13}
13
13
  s.description = %q{A rational rudimentary database abstraction.}
14
14
  s.email = [%q{shane.hanna@gmail.com}, %q{deepfryed@gmail.com}]
15
15
  s.extensions = [%q{ext/extconf.rb}]
data/test/test_adapter.rb CHANGED
@@ -47,6 +47,12 @@ describe 'Adapter' do
47
47
  assert @db.prepare(%q{insert into users (name) values ('Apple Arthurton')}).execute
48
48
  end
49
49
 
50
+ it 'returns the command' do
51
+ sql = 'select * from users where id = ?'
52
+ assert_equal sql, @db.prepare(sql).command
53
+ assert_equal sql, @db.prepare(sql).to_s
54
+ end
55
+
50
56
  it 'executes with bind values' do
51
57
  assert @db.prepare(%q{insert into users (name) values (?)}).execute('Apple Arthurton')
52
58
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swift
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-09-30 00:00:00.000000000Z
13
+ date: 2011-10-13 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: minitest
17
- requirement: &10219940 !ruby/object:Gem::Requirement
17
+ requirement: &12101760 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 1.7.0
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: *10219940
25
+ version_requirements: *12101760
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: eventmachine
28
- requirement: &10219160 !ruby/object:Gem::Requirement
28
+ requirement: &12101200 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *10219160
36
+ version_requirements: *12101200
37
37
  description: A rational rudimentary database abstraction.
38
38
  email:
39
39
  - shane.hanna@gmail.com