Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

Commit

Permalink
add clob copy test
Browse files Browse the repository at this point in the history
  • Loading branch information
loveridge committed Aug 17, 2015
1 parent 9d1b58b commit 914b7e5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/src/occi_extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ class Blob {
}
void append(Blob b) native 'OracleBlob_append';

void copy(Blob b) native 'OracleBlob_copy';
void copy(Blob b, int length) native 'OracleBlob_copy';

int length() native 'OracleBlob_length';

Expand Down Expand Up @@ -252,7 +252,7 @@ class Clob {
}
void append(Clob b) native 'OracleClob_append';

void copy(Clob b) native 'OracleClob_copy';
void copy(Clob b, int length) native 'OracleClob_copy';

int length() native 'OracleClob_length';

Expand Down
Binary file added test/.complete_test.dart.swp
Binary file not shown.
27 changes: 25 additions & 2 deletions test/complete_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ main() {
var stmt = con.createStatement("BEGIN EXECUTE IMMEDIATE 'DROP TABLE test_table'; EXCEPTION WHEN OTHERS THEN NULL; END;");
stmt.execute();
con.commit();
stmt = con.createStatement("CREATE TABLE test_table ( test_int int, test_string varchar(255), test_date DATE, test_blob BLOB, test_clob CLOB)");
stmt = con.createStatement("CREATE TABLE test_table ( test_int int, test_string varchar(255), test_date DATE, test_blob BLOB, test_clob CLOB, test_clob2 CLOB)");
stmt.execute();
con.commit();
stmt = con.createStatement("INSERT INTO test_table (test_int,test_string,test_date,test_blob, test_clob) VALUES (:b1, :b2, :b3, EMPTY_BLOB(), EMPTY_CLOB())");
stmt = con.createStatement("INSERT INTO test_table (test_int,test_string,test_date,test_blob, test_clob,test_clob2) VALUES (:b1, :b2, :b3, EMPTY_BLOB(), EMPTY_CLOB(), EMPTY_CLOB())");
stmt.setInt(1,34);
stmt.setString(2,"hello world");
stmt.setDate(3,new DateTime(2012, 12, 19, 34, 35, 36));
Expand Down Expand Up @@ -107,6 +107,29 @@ main() {
expect(dbblob.length(), equals(10));
var rlist = dbblob.read(10,1);
expect(rlist, equals("teststring"));
});

test('test clob copy', (){
var stmt = con.createStatement("SELECT test_clob FROM test_table FOR UPDATE");
var results = stmt.executeQuery();
results.next(1);
oracle.Clob cl = results.getClob(1);
cl.write(10,"teststring",1);
con.commit();
stmt = con.createStatement("SELECT test_clob, test_clob2 FROM test_table FOR UPDATE");
results = stmt.executeQuery();
results.next(1);
cl = results.getClob(1);
oracle.Clob cl2 = results.getClob(2);
cl2.copy(cl, 4);
con.commit();
stmt = con.createStatement("SELECT test_clob2 FROM test_table");
results = stmt.executeQuery();
results.next(1);
var dbblob = results.getClob(1);
expect(dbblob.length(), equals(4));
var rlist = dbblob.read(4,1);
expect(rlist, equals("test"));
});
test('test clob trim', (){
var stmt = con.createStatement("SELECT test_clob FROM test_table FOR UPDATE");
Expand Down

0 comments on commit 914b7e5

Please sign in to comment.