0
require File.dirname(__FILE__) + '/spec_helper'
0
-describe "DO::Command" do
0
- it_should_behave_like "Connectable"
0
- cmd = @c.create_command("DELETE from table1 where id=3")
0
- cmd.execute_non_query.should == 1
0
- it "should be able to be executed if it's a select" do
0
- cmd = @c.create_command("select * from table1")
0
- r = cmd.execute_reader
0
- r.has_rows.should be_true
0
- it "should be able to be executed if it's not a select" do
0
- cmd = @c.create_command("INSERT into table1(#{$escaped_columns}) VALUES(3, NULL, NULL, NULL, NULL)")
0
- cmd.execute_non_query.should == 1
0
- it "should throw an error if a select is passed to execute_non_query" do
0
- cmd = @c.create_command("SELECT * from table1")
0
- lambda { cmd.execute_non_query }.should raise_error(DataObject::QueryError)
0
- it "should immediately close the reader and populate records_affected if a modification is passed to execute_reader" do
0
- if $adapter_module.to_s == "DataObject::Postgres"
0
- cmd = @c.create_command("INSERT into table1(#{$escaped_columns}) VALUES(3, NULL, now(), false, now())")
0
- cmd = @c.create_command("INSERT into table1(#{$escaped_columns}) VALUES(3, NULL, CURRENT_TIME, 0, CURRENT_DATE)")
0
- r = cmd.execute_reader
0
- r.records_affected.should == 1
0
- lambda { r.name(0) }.should raise_error(DataObject::ReaderClosed)
0
-describe "DO::Reader" do
0
- @c = $adapter_module::Connection.new($connection_string)
0
- cmd = @c.create_command("select * from table1")
0
- @r = cmd.execute_reader
0
- it "should be able to get the field count" do
0
- @r.field_count.should == 5
0
- it "should be able to get field names" do
0
- @r.name(0).should == "id"
0
- @r.name(1).should == "int"
0
- @r.name(2).should == "time"
0
- @r.name(3).should == "bool"
0
- @r.name(4).should == "date"
0
- @r.name(5).should == nil
0
- it "should be able to get field indexes" do
0
- @r.get_index("id").should == 0
0
- @r.get_index("int").should == 1
0
- @r.get_index("time").should == 2
0
- @r.get_index("bool").should == 3
0
- @r.get_index("date").should == 4
0
- @r.get_index("foo").should == nil
0
- it "should be able to determine whether a particular field is null" do
0
- @r.null?(0).should == false
0
- @r.null?(1).should == true
0
- it "should be able to get a typecasted version of a particular field" do
0
- case $adapter_module.to_s
0
- when "DataObject::Sqlite3"
0
- @r.item(0).should == 1
0
- @r.item(1).should == nil
0
- @r.item(2).class.should == String
0
- @r.item(3).should == 0
0
- @r.item(4).class.should == String
0
- when "DataObject::Mysql"
0
- @r.item(0).should == 1
0
- @r.item(1).should == nil
0
- @r.item(2).class.should == DateTime
0
- @r.item(3).should == false
0
- @r.item(4).class.should == Date
0
- it "should be able to get to the next row" do
0
- @r.next.should == true
0
- @r.item(0).should == 2
0
- it "should return nil and close the reader when the cursor reaches the end" do
0
- lambda { @r.name(0) }.should raise_error(DataObject::ReaderClosed)
0
\ No newline at end of file
0
+# describe "DO::Command" do
0
+# cmd = @c.create_command("DELETE from table1 where id=3")
0
+# cmd.execute_non_query.should == 1
0
+# it "should be able to be executed if it's a select" do
0
+# cmd = @c.create_command("select * from table1")
0
+# r = cmd.execute_reader
0
+# r.has_rows.should be_true
0
+# it "should be able to be executed if it's not a select" do
0
+# cmd = @c.create_command("INSERT into table1(#{$escaped_columns}) VALUES(3, NULL, NULL, NULL, NULL)")
0
+# cmd.execute_non_query.should == 1
0
+# it "should throw an error if a select is passed to execute_non_query" do
0
+# cmd = @c.create_command("SELECT * from table1")
0
+# lambda { cmd.execute_non_query }.should raise_error(DataObject::QueryError)
0
+# it "should immediately close the reader and populate records_affected if a modification is passed to execute_reader" do
0
+# if $adapter_module.to_s == "DataObject::Postgres"
0
+# cmd = @c.create_command("INSERT into table1(#{$escaped_columns}) VALUES(3, NULL, now(), false, now())")
0
+# cmd = @c.create_command("INSERT into table1(#{$escaped_columns}) VALUES(3, NULL, CURRENT_TIME, 0, CURRENT_DATE)")
0
+# r = cmd.execute_reader
0
+# r.records_affected.should == 1
0
+# lambda { r.name(0) }.should raise_error(DataObject::ReaderClosed)
0
+# describe "DO::Reader" do
0
+# @c = $adapter_module::Connection.new($connection_string)
0
+# cmd = @c.create_command("select * from table1")
0
+# @r = cmd.execute_reader
0
+# it "should be able to get the field count" do
0
+# @r.field_count.should == 5
0
+# it "should be able to get field names" do
0
+# @r.name(0).should == "id"
0
+# @r.name(1).should == "int"
0
+# @r.name(2).should == "time"
0
+# @r.name(3).should == "bool"
0
+# @r.name(4).should == "date"
0
+# @r.name(5).should == nil
0
+# it "should be able to get field indexes" do
0
+# @r.get_index("id").should == 0
0
+# @r.get_index("int").should == 1
0
+# @r.get_index("time").should == 2
0
+# @r.get_index("bool").should == 3
0
+# @r.get_index("date").should == 4
0
+# @r.get_index("foo").should == nil
0
+# it "should be able to determine whether a particular field is null" do
0
+# @r.null?(0).should == false
0
+# @r.null?(1).should == true
0
+# it "should be able to get a typecasted version of a particular field" do
0
+# case $adapter_module.to_s
0
+# when "DataObject::Sqlite3"
0
+# @r.item(0).should == 1
0
+# @r.item(1).should == nil
0
+# @r.item(2).class.should == String
0
+# @r.item(3).should == 0
0
+# @r.item(4).class.should == String
0
+# when "DataObject::Mysql"
0
+# @r.item(0).should == 1
0
+# @r.item(1).should == nil
0
+# @r.item(2).class.should == DateTime
0
+# @r.item(3).should == false
0
+# @r.item(4).class.should == Date
0
+# it "should be able to get to the next row" do
0
+# @r.next.should == true
0
+# @r.item(0).should == 2
0
+# it "should return nil and close the reader when the cursor reaches the end" do
0
+# @r.next.should == nil
0
+# lambda { @r.name(0) }.should raise_error(DataObject::ReaderClosed)
0
\ No newline at end of file
Comments
No one has commented yet.