Merged 9i specific setup into standard setup since Oracle 8i support is no
longer required; change tabs to spaces; add test for fixed char data types.
This commit is contained in:
parent
16d796d70e
commit
96f7decdce
|
@ -30,9 +30,9 @@ class TestObjectVar(BaseTestCase):
|
||||||
[ ('INTCOL', cx_Oracle.NUMBER, 10, 22, 9, 0, 0),
|
[ ('INTCOL', cx_Oracle.NUMBER, 10, 22, 9, 0, 0),
|
||||||
('OBJECTCOL', cx_Oracle.OBJECT, -1, 2000, 0, 0, 1),
|
('OBJECTCOL', cx_Oracle.OBJECT, -1, 2000, 0, 0, 1),
|
||||||
('ARRAYCOL', cx_Oracle.OBJECT, -1, 2000, 0, 0, 1) ])
|
('ARRAYCOL', cx_Oracle.OBJECT, -1, 2000, 0, 0, 1) ])
|
||||||
self.__TestData(1, (1, 'First row',
|
self.__TestData(1, (1, 'First row', 'First ',
|
||||||
cx_Oracle.Timestamp(2007, 3, 6, 0, 0, 0)), [5, 10, None, 20])
|
cx_Oracle.Timestamp(2007, 3, 6, 0, 0, 0)), [5, 10, None, 20])
|
||||||
self.__TestData(2, None, [3, None, 9, 12, 15])
|
self.__TestData(2, None, [3, None, 9, 12, 15])
|
||||||
self.__TestData(3, (3, 'Third row',
|
self.__TestData(3, (3, 'Third row', 'Third ',
|
||||||
cx_Oracle.Timestamp(2007, 6, 21, 0, 0, 0)), None)
|
cx_Oracle.Timestamp(2007, 6, 21, 0, 0, 0)), None)
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
* and packages necessary for performing the test suite.
|
* and packages necessary for performing the test suite.
|
||||||
*---------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
whenever sqlerror exit failure
|
||||||
|
|
||||||
alter session set nls_date_format = 'YYYY-MM-DD HH24:MI:SS';
|
alter session set nls_date_format = 'YYYY-MM-DD HH24:MI:SS';
|
||||||
alter session set nls_numeric_characters='.,';
|
alter session set nls_numeric_characters='.,';
|
||||||
|
|
||||||
|
@ -20,9 +22,10 @@ to cx_Oracle;
|
||||||
|
|
||||||
-- create types
|
-- create types
|
||||||
create type cx_Oracle.udt_Object as object (
|
create type cx_Oracle.udt_Object as object (
|
||||||
NumberValue number,
|
NumberValue number,
|
||||||
StringValue varchar2(60),
|
StringValue varchar2(60),
|
||||||
DateValue date
|
FixedCharValue char(10),
|
||||||
|
DateValue date
|
||||||
);
|
);
|
||||||
/
|
/
|
||||||
|
|
||||||
|
@ -31,57 +34,63 @@ create type cx_Oracle.udt_Array as varray(10) of number;
|
||||||
|
|
||||||
-- create tables
|
-- create tables
|
||||||
create table cx_Oracle.TestNumbers (
|
create table cx_Oracle.TestNumbers (
|
||||||
IntCol number(9) not null,
|
IntCol number(9) not null,
|
||||||
NumberCol number(9, 2) not null,
|
NumberCol number(9, 2) not null,
|
||||||
FloatCol float not null,
|
FloatCol float not null,
|
||||||
UnconstrainedCol number not null,
|
UnconstrainedCol number not null,
|
||||||
NullableCol number(38)
|
NullableCol number(38)
|
||||||
) tablespace users;
|
) tablespace users;
|
||||||
|
|
||||||
create table cx_Oracle.TestStrings (
|
create table cx_Oracle.TestStrings (
|
||||||
IntCol number(9) not null,
|
IntCol number(9) not null,
|
||||||
StringCol varchar2(20) not null,
|
StringCol varchar2(20) not null,
|
||||||
RawCol raw(30) not null,
|
RawCol raw(30) not null,
|
||||||
FixedCharCol char(40) not null,
|
FixedCharCol char(40) not null,
|
||||||
NullableCol varchar2(50)
|
NullableCol varchar2(50)
|
||||||
) tablespace users;
|
) tablespace users;
|
||||||
|
|
||||||
create table cx_Oracle.TestDates (
|
create table cx_Oracle.TestDates (
|
||||||
IntCol number(9) not null,
|
IntCol number(9) not null,
|
||||||
DateCol date not null,
|
DateCol date not null,
|
||||||
NullableCol date
|
NullableCol date
|
||||||
) tablespace users;
|
) tablespace users;
|
||||||
|
|
||||||
create table cx_Oracle.TestCLOBs (
|
create table cx_Oracle.TestCLOBs (
|
||||||
IntCol number(9) not null,
|
IntCol number(9) not null,
|
||||||
CLOBCol clob not null
|
CLOBCol clob not null
|
||||||
) tablespace users;
|
) tablespace users;
|
||||||
|
|
||||||
create table cx_Oracle.TestBLOBs (
|
create table cx_Oracle.TestBLOBs (
|
||||||
IntCol number(9) not null,
|
IntCol number(9) not null,
|
||||||
BLOBCol blob not null
|
BLOBCol blob not null
|
||||||
) tablespace users;
|
) tablespace users;
|
||||||
|
|
||||||
create table cx_Oracle.TestLongs (
|
create table cx_Oracle.TestLongs (
|
||||||
IntCol number(9) not null,
|
IntCol number(9) not null,
|
||||||
LongCol long not null
|
LongCol long not null
|
||||||
) tablespace users;
|
) tablespace users;
|
||||||
|
|
||||||
create table cx_Oracle.TestLongRaws (
|
create table cx_Oracle.TestLongRaws (
|
||||||
IntCol number(9) not null,
|
IntCol number(9) not null,
|
||||||
LongRawCol long raw not null
|
LongRawCol long raw not null
|
||||||
) tablespace users;
|
) tablespace users;
|
||||||
|
|
||||||
create table cx_Oracle.TestExecuteMany (
|
create table cx_Oracle.TestExecuteMany (
|
||||||
IntCol number(9) not null
|
IntCol number(9) not null
|
||||||
) tablespace users;
|
) tablespace users;
|
||||||
|
|
||||||
create table cx_Oracle.TestObjects (
|
create table cx_Oracle.TestObjects (
|
||||||
IntCol number(9) not null,
|
IntCol number(9) not null,
|
||||||
ObjectCol cx_Oracle.udt_Object,
|
ObjectCol cx_Oracle.udt_Object,
|
||||||
ArrayCol cx_Oracle.udt_Array
|
ArrayCol cx_Oracle.udt_Array
|
||||||
);
|
);
|
||||||
|
|
||||||
|
create table cx_Oracle.TestTimestamps (
|
||||||
|
IntCol number(9) not null,
|
||||||
|
TimestampCol timestamp not null,
|
||||||
|
NullableCol timestamp
|
||||||
|
) tablespace users;
|
||||||
|
|
||||||
alter table cx_Oracle.testexecutemany
|
alter table cx_Oracle.testexecutemany
|
||||||
add constraint testexecutemany_pk
|
add constraint testexecutemany_pk
|
||||||
primary key (
|
primary key (
|
||||||
|
@ -144,8 +153,22 @@ begin
|
||||||
end;
|
end;
|
||||||
/
|
/
|
||||||
|
|
||||||
|
begin
|
||||||
|
for i in 1..10 loop
|
||||||
|
insert into cx_Oracle.TestTimestamps
|
||||||
|
values (i, to_timestamp('20021209', 'YYYYMMDD') +
|
||||||
|
to_dsinterval(to_char(i) || ' 00:00:' || to_char(i * 2) || '.' ||
|
||||||
|
to_char(i * 50)),
|
||||||
|
decode(mod(i, 2), 0, to_timestamp(null, 'YYYYMMDD'),
|
||||||
|
to_timestamp('20021209', 'YYYYMMDD') +
|
||||||
|
to_dsinterval(to_char(i + 1) || ' 00:00:' ||
|
||||||
|
to_char(i * 3) || '.' || to_char(i * 125))));
|
||||||
|
end loop;
|
||||||
|
end;
|
||||||
|
/
|
||||||
|
|
||||||
insert into cx_Oracle.TestObjects values (1,
|
insert into cx_Oracle.TestObjects values (1,
|
||||||
cx_Oracle.udt_Object(1, 'First row',
|
cx_Oracle.udt_Object(1, 'First row', 'First',
|
||||||
to_date(20070306, 'YYYYMMDD')),
|
to_date(20070306, 'YYYYMMDD')),
|
||||||
cx_Oracle.udt_Array(5, 10, null, 20));
|
cx_Oracle.udt_Array(5, 10, null, 20));
|
||||||
|
|
||||||
|
@ -153,16 +176,16 @@ insert into cx_Oracle.TestObjects values (2, null,
|
||||||
cx_Oracle.udt_Array(3, null, 9, 12, 15));
|
cx_Oracle.udt_Array(3, null, 9, 12, 15));
|
||||||
|
|
||||||
insert into cx_Oracle.TestObjects values (3,
|
insert into cx_Oracle.TestObjects values (3,
|
||||||
cx_Oracle.udt_Object(3, 'Third row',
|
cx_Oracle.udt_Object(3, 'Third row', 'Third',
|
||||||
to_date(20070621, 'YYYYMMDD')), null);
|
to_date(20070621, 'YYYYMMDD')), null);
|
||||||
|
|
||||||
commit;
|
commit;
|
||||||
|
|
||||||
-- create procedures for testing callproc()
|
-- create procedures for testing callproc()
|
||||||
create procedure cx_Oracle.proc_Test (
|
create procedure cx_Oracle.proc_Test (
|
||||||
a_InValue varchar2,
|
a_InValue varchar2,
|
||||||
a_InOutValue in out number,
|
a_InOutValue in out number,
|
||||||
a_OutValue out number
|
a_OutValue out number
|
||||||
) as
|
) as
|
||||||
begin
|
begin
|
||||||
a_InOutValue := a_InOutValue * length(a_InValue);
|
a_InOutValue := a_InOutValue * length(a_InValue);
|
||||||
|
@ -178,8 +201,8 @@ end;
|
||||||
|
|
||||||
-- create functions for testing callfunc()
|
-- create functions for testing callfunc()
|
||||||
create function cx_Oracle.func_Test (
|
create function cx_Oracle.func_Test (
|
||||||
a_String varchar2,
|
a_String varchar2,
|
||||||
a_ExtraAmount number
|
a_ExtraAmount number
|
||||||
) return number as
|
) return number as
|
||||||
begin
|
begin
|
||||||
return length(a_String) + a_ExtraAmount;
|
return length(a_String) + a_ExtraAmount;
|
||||||
|
@ -199,18 +222,18 @@ create or replace package cx_Oracle.pkg_TestStringArrays as
|
||||||
type udt_StringList is table of varchar2(100) index by binary_integer;
|
type udt_StringList is table of varchar2(100) index by binary_integer;
|
||||||
|
|
||||||
function TestInArrays (
|
function TestInArrays (
|
||||||
a_StartingLength number,
|
a_StartingLength number,
|
||||||
a_Array udt_StringList
|
a_Array udt_StringList
|
||||||
) return number;
|
) return number;
|
||||||
|
|
||||||
procedure TestInOutArrays (
|
procedure TestInOutArrays (
|
||||||
a_NumElems number,
|
a_NumElems number,
|
||||||
a_Array in out nocopy udt_StringList
|
a_Array in out nocopy udt_StringList
|
||||||
);
|
);
|
||||||
|
|
||||||
procedure TestOutArrays (
|
procedure TestOutArrays (
|
||||||
a_NumElems number,
|
a_NumElems number,
|
||||||
a_Array out nocopy udt_StringList
|
a_Array out nocopy udt_StringList
|
||||||
);
|
);
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
@ -219,10 +242,10 @@ end;
|
||||||
create or replace package body cx_Oracle.pkg_TestStringArrays as
|
create or replace package body cx_Oracle.pkg_TestStringArrays as
|
||||||
|
|
||||||
function TestInArrays (
|
function TestInArrays (
|
||||||
a_StartingLength number,
|
a_StartingLength number,
|
||||||
a_Array udt_StringList
|
a_Array udt_StringList
|
||||||
) return number is
|
) return number is
|
||||||
t_Length number;
|
t_Length number;
|
||||||
begin
|
begin
|
||||||
t_Length := a_StartingLength;
|
t_Length := a_StartingLength;
|
||||||
for i in 1..a_Array.count loop
|
for i in 1..a_Array.count loop
|
||||||
|
@ -232,8 +255,8 @@ create or replace package body cx_Oracle.pkg_TestStringArrays as
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TestInOutArrays (
|
procedure TestInOutArrays (
|
||||||
a_NumElems number,
|
a_NumElems number,
|
||||||
a_Array in out udt_StringList
|
a_Array in out udt_StringList
|
||||||
) is
|
) is
|
||||||
begin
|
begin
|
||||||
for i in 1..a_NumElems loop
|
for i in 1..a_NumElems loop
|
||||||
|
@ -244,8 +267,8 @@ create or replace package body cx_Oracle.pkg_TestStringArrays as
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TestOutArrays (
|
procedure TestOutArrays (
|
||||||
a_NumElems number,
|
a_NumElems number,
|
||||||
a_Array out udt_StringList
|
a_Array out udt_StringList
|
||||||
) is
|
) is
|
||||||
begin
|
begin
|
||||||
for i in 1..a_NumElems loop
|
for i in 1..a_NumElems loop
|
||||||
|
@ -261,18 +284,18 @@ create or replace package cx_Oracle.pkg_TestNumberArrays as
|
||||||
type udt_NumberList is table of number index by binary_integer;
|
type udt_NumberList is table of number index by binary_integer;
|
||||||
|
|
||||||
function TestInArrays (
|
function TestInArrays (
|
||||||
a_StartingValue number,
|
a_StartingValue number,
|
||||||
a_Array udt_NumberList
|
a_Array udt_NumberList
|
||||||
) return number;
|
) return number;
|
||||||
|
|
||||||
procedure TestInOutArrays (
|
procedure TestInOutArrays (
|
||||||
a_NumElems number,
|
a_NumElems number,
|
||||||
a_Array in out nocopy udt_NumberList
|
a_Array in out nocopy udt_NumberList
|
||||||
);
|
);
|
||||||
|
|
||||||
procedure TestOutArrays (
|
procedure TestOutArrays (
|
||||||
a_NumElems number,
|
a_NumElems number,
|
||||||
a_Array out nocopy udt_NumberList
|
a_Array out nocopy udt_NumberList
|
||||||
);
|
);
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
@ -281,10 +304,10 @@ end;
|
||||||
create or replace package body cx_Oracle.pkg_TestNumberArrays as
|
create or replace package body cx_Oracle.pkg_TestNumberArrays as
|
||||||
|
|
||||||
function TestInArrays (
|
function TestInArrays (
|
||||||
a_StartingValue number,
|
a_StartingValue number,
|
||||||
a_Array udt_NumberList
|
a_Array udt_NumberList
|
||||||
) return number is
|
) return number is
|
||||||
t_Value number;
|
t_Value number;
|
||||||
begin
|
begin
|
||||||
t_Value := a_StartingValue;
|
t_Value := a_StartingValue;
|
||||||
for i in 1..a_Array.count loop
|
for i in 1..a_Array.count loop
|
||||||
|
@ -294,8 +317,8 @@ create or replace package body cx_Oracle.pkg_TestNumberArrays as
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TestInOutArrays (
|
procedure TestInOutArrays (
|
||||||
a_NumElems number,
|
a_NumElems number,
|
||||||
a_Array in out udt_NumberList
|
a_Array in out udt_NumberList
|
||||||
) is
|
) is
|
||||||
begin
|
begin
|
||||||
for i in 1..a_NumElems loop
|
for i in 1..a_NumElems loop
|
||||||
|
@ -304,8 +327,8 @@ create or replace package body cx_Oracle.pkg_TestNumberArrays as
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TestOutArrays (
|
procedure TestOutArrays (
|
||||||
a_NumElems number,
|
a_NumElems number,
|
||||||
a_Array out udt_NumberList
|
a_Array out udt_NumberList
|
||||||
) is
|
) is
|
||||||
begin
|
begin
|
||||||
for i in 1..a_NumElems loop
|
for i in 1..a_NumElems loop
|
||||||
|
@ -321,19 +344,19 @@ create or replace package cx_Oracle.pkg_TestDateArrays as
|
||||||
type udt_DateList is table of date index by binary_integer;
|
type udt_DateList is table of date index by binary_integer;
|
||||||
|
|
||||||
function TestInArrays (
|
function TestInArrays (
|
||||||
a_StartingValue number,
|
a_StartingValue number,
|
||||||
a_BaseDate date,
|
a_BaseDate date,
|
||||||
a_Array udt_DateList
|
a_Array udt_DateList
|
||||||
) return number;
|
) return number;
|
||||||
|
|
||||||
procedure TestInOutArrays (
|
procedure TestInOutArrays (
|
||||||
a_NumElems number,
|
a_NumElems number,
|
||||||
a_Array in out nocopy udt_DateList
|
a_Array in out nocopy udt_DateList
|
||||||
);
|
);
|
||||||
|
|
||||||
procedure TestOutArrays (
|
procedure TestOutArrays (
|
||||||
a_NumElems number,
|
a_NumElems number,
|
||||||
a_Array out nocopy udt_DateList
|
a_Array out nocopy udt_DateList
|
||||||
);
|
);
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
@ -342,11 +365,11 @@ end;
|
||||||
create or replace package body cx_Oracle.pkg_TestDateArrays as
|
create or replace package body cx_Oracle.pkg_TestDateArrays as
|
||||||
|
|
||||||
function TestInArrays (
|
function TestInArrays (
|
||||||
a_StartingValue number,
|
a_StartingValue number,
|
||||||
a_BaseDate date,
|
a_BaseDate date,
|
||||||
a_Array udt_DateList
|
a_Array udt_DateList
|
||||||
) return number is
|
) return number is
|
||||||
t_Value number;
|
t_Value number;
|
||||||
begin
|
begin
|
||||||
t_Value := a_StartingValue;
|
t_Value := a_StartingValue;
|
||||||
for i in 1..a_Array.count loop
|
for i in 1..a_Array.count loop
|
||||||
|
@ -356,8 +379,8 @@ create or replace package body cx_Oracle.pkg_TestDateArrays as
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TestInOutArrays (
|
procedure TestInOutArrays (
|
||||||
a_NumElems number,
|
a_NumElems number,
|
||||||
a_Array in out udt_DateList
|
a_Array in out udt_DateList
|
||||||
) is
|
) is
|
||||||
begin
|
begin
|
||||||
for i in 1..a_NumElems loop
|
for i in 1..a_NumElems loop
|
||||||
|
@ -366,8 +389,8 @@ create or replace package body cx_Oracle.pkg_TestDateArrays as
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TestOutArrays (
|
procedure TestOutArrays (
|
||||||
a_NumElems number,
|
a_NumElems number,
|
||||||
a_Array out udt_DateList
|
a_Array out udt_DateList
|
||||||
) is
|
) is
|
||||||
begin
|
begin
|
||||||
for i in 1..a_NumElems loop
|
for i in 1..a_NumElems loop
|
||||||
|
@ -383,8 +406,8 @@ create or replace package cx_Oracle.pkg_TestOutCursors as
|
||||||
type udt_RefCursor is ref cursor;
|
type udt_RefCursor is ref cursor;
|
||||||
|
|
||||||
procedure TestOutCursor (
|
procedure TestOutCursor (
|
||||||
a_MaxIntValue number,
|
a_MaxIntValue number,
|
||||||
a_Cursor out udt_RefCursor
|
a_Cursor out udt_RefCursor
|
||||||
);
|
);
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
@ -393,8 +416,8 @@ end;
|
||||||
create or replace package body cx_Oracle.pkg_TestOutCursors as
|
create or replace package body cx_Oracle.pkg_TestOutCursors as
|
||||||
|
|
||||||
procedure TestOutCursor (
|
procedure TestOutCursor (
|
||||||
a_MaxIntValue number,
|
a_MaxIntValue number,
|
||||||
a_Cursor out udt_RefCursor
|
a_Cursor out udt_RefCursor
|
||||||
) is
|
) is
|
||||||
begin
|
begin
|
||||||
open a_Cursor for
|
open a_Cursor for
|
||||||
|
@ -409,3 +432,5 @@ create or replace package body cx_Oracle.pkg_TestOutCursors as
|
||||||
end;
|
end;
|
||||||
/
|
/
|
||||||
|
|
||||||
|
exit
|
||||||
|
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
/*-----------------------------------------------------------------------------
|
|
||||||
* SetupTest_9i.sql
|
|
||||||
* Additional setup for Oracle 9i databases only.
|
|
||||||
*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
alter session set nls_date_format = 'YYYY-MM-DD HH24:MI:SS';
|
|
||||||
alter session set nls_numeric_characters='.,';
|
|
||||||
|
|
||||||
create table cx_Oracle.TestTimestamps (
|
|
||||||
IntCol number(9) not null,
|
|
||||||
TimestampCol timestamp not null,
|
|
||||||
NullableCol timestamp
|
|
||||||
) tablespace users;
|
|
||||||
|
|
||||||
begin
|
|
||||||
for i in 1..10 loop
|
|
||||||
insert into cx_Oracle.TestTimestamps
|
|
||||||
values (i, to_timestamp('20021209', 'YYYYMMDD') +
|
|
||||||
to_dsinterval(to_char(i) || ' 00:00:' || to_char(i * 2) || '.' ||
|
|
||||||
to_char(i * 50)),
|
|
||||||
decode(mod(i, 2), 0, to_timestamp(null, 'YYYYMMDD'),
|
|
||||||
to_timestamp('20021209', 'YYYYMMDD') +
|
|
||||||
to_dsinterval(to_char(i + 1) || ' 00:00:' ||
|
|
||||||
to_char(i * 3) || '.' || to_char(i * 125))));
|
|
||||||
end loop;
|
|
||||||
end;
|
|
||||||
/
|
|
||||||
|
|
||||||
commit;
|
|
||||||
|
|
Loading…
Reference in New Issue