diff options
author | Fabio Bas <ctrlaltca@gmail.com> | 2016-03-25 17:55:51 +0100 |
---|---|---|
committer | Fabio Bas <ctrlaltca@gmail.com> | 2016-03-25 17:55:51 +0100 |
commit | a3388622287e218beddfa14a47ed677d4307b36b (patch) | |
tree | 1b4c7ac8597b1cc798b6683d4a81c90d38de12f6 /tests/unit/Data/SqlMap/scripts | |
parent | c7fd3e1167b6f2fa7746edbd0fb8f8c1694c61f9 (diff) |
Removed simpletest and moved all tests in the unit tree
Tests are executed now, but a lot of them need fixing.
Diffstat (limited to 'tests/unit/Data/SqlMap/scripts')
32 files changed, 1563 insertions, 0 deletions
diff --git a/tests/unit/Data/SqlMap/scripts/mssql/DBCreation.sql b/tests/unit/Data/SqlMap/scripts/mssql/DBCreation.sql new file mode 100644 index 00000000..b4e017d7 --- /dev/null +++ b/tests/unit/Data/SqlMap/scripts/mssql/DBCreation.sql @@ -0,0 +1,89 @@ +-- MSQL DATABASE + +IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'IBatisNet') + DROP DATABASE [IBatisNet] +GO + +CREATE DATABASE [IBatisNet] + COLLATE Latin1_General_CI_AS +GO + +exec sp_dboption N'IBatisNet', N'autoclose', N'true' +GO + +exec sp_dboption N'IBatisNet', N'bulkcopy', N'false' +GO + +exec sp_dboption N'IBatisNet', N'trunc. log', N'true' +GO + +exec sp_dboption N'IBatisNet', N'torn page detection', N'true' +GO + +exec sp_dboption N'IBatisNet', N'read only', N'false' +GO + +exec sp_dboption N'IBatisNet', N'dbo use', N'false' +GO + +exec sp_dboption N'IBatisNet', N'single', N'false' +GO + +exec sp_dboption N'IBatisNet', N'autoshrink', N'true' +GO + +exec sp_dboption N'IBatisNet', N'ANSI null default', N'false' +GO + +exec sp_dboption N'IBatisNet', N'recursive triggers', N'false' +GO + +exec sp_dboption N'IBatisNet', N'ANSI nulls', N'false' +GO + +exec sp_dboption N'IBatisNet', N'concat null yields null', N'false' +GO + +exec sp_dboption N'IBatisNet', N'cursor close on commit', N'false' +GO + +exec sp_dboption N'IBatisNet', N'default to local cursor', N'false' +GO + +exec sp_dboption N'IBatisNet', N'quoted identifier', N'false' +GO + +exec sp_dboption N'IBatisNet', N'ANSI warnings', N'false' +GO + +exec sp_dboption N'IBatisNet', N'auto create statistics', N'true' +GO + +exec sp_dboption N'IBatisNet', N'auto update statistics', N'true' +GO + +if( ( (@@microsoftversion / power(2, 24) = 8) and (@@microsoftversion & 0xffff >= 724) ) or ( (@@microsoftversion / power(2, 24) = 7) and (@@microsoftversion & 0xffff >= 1082) ) ) + exec sp_dboption N'IBatisNet', N'db chaining', N'false' +GO + +if exists (select * from master.dbo.syslogins where loginname = N'IBatisNet') + exec sp_droplogin N'IBatisNet' +GO + +use [IBatisNet] +GO + +if not exists (select * from master.dbo.syslogins where loginname = N'IBatisNet') +BEGIN + declare @logindb nvarchar(132), @loginpass nvarchar(132), @loginlang nvarchar(132) + select @logindb = N'IBatisNet', @loginpass=N'test', @loginlang = N'us_english' + exec sp_addlogin N'IBatisNet', @loginpass, @logindb, @loginlang +END +GO + +if not exists (select * from dbo.sysusers where name = N'IBatisNet' and uid < 16382) + EXEC sp_grantdbaccess N'IBatisNet', N'IBatisNet' +GO + +exec sp_addrolemember N'db_owner', N'IBatisNet' +GO
\ No newline at end of file diff --git a/tests/unit/Data/SqlMap/scripts/mssql/DataBase.sql b/tests/unit/Data/SqlMap/scripts/mssql/DataBase.sql new file mode 100644 index 00000000..75a1f974 --- /dev/null +++ b/tests/unit/Data/SqlMap/scripts/mssql/DataBase.sql @@ -0,0 +1,179 @@ +-- MSQL DATABASE 'IBatisNet' + +IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'IBatisNet') + DROP DATABASE [IBatisNet] +GO + +CREATE DATABASE [IBatisNet] + COLLATE Latin1_General_CI_AS +GO + +exec sp_dboption N'IBatisNet', N'autoclose', N'true' +GO + +exec sp_dboption N'IBatisNet', N'bulkcopy', N'false' +GO + +exec sp_dboption N'IBatisNet', N'trunc. log', N'true' +GO + +exec sp_dboption N'IBatisNet', N'torn page detection', N'true' +GO + +exec sp_dboption N'IBatisNet', N'read only', N'false' +GO + +exec sp_dboption N'IBatisNet', N'dbo use', N'false' +GO + +exec sp_dboption N'IBatisNet', N'single', N'false' +GO + +exec sp_dboption N'IBatisNet', N'autoshrink', N'true' +GO + +exec sp_dboption N'IBatisNet', N'ANSI null default', N'false' +GO + +exec sp_dboption N'IBatisNet', N'recursive triggers', N'false' +GO + +exec sp_dboption N'IBatisNet', N'ANSI nulls', N'false' +GO + +exec sp_dboption N'IBatisNet', N'concat null yields null', N'false' +GO + +exec sp_dboption N'IBatisNet', N'cursor close on commit', N'false' +GO + +exec sp_dboption N'IBatisNet', N'default to local cursor', N'false' +GO + +exec sp_dboption N'IBatisNet', N'quoted identifier', N'false' +GO + +exec sp_dboption N'IBatisNet', N'ANSI warnings', N'false' +GO + +exec sp_dboption N'IBatisNet', N'auto create statistics', N'true' +GO + +exec sp_dboption N'IBatisNet', N'auto update statistics', N'true' +GO + +if( ( (@@microsoftversion / power(2, 24) = 8) and (@@microsoftversion & 0xffff >= 724) ) or ( (@@microsoftversion / power(2, 24) = 7) and (@@microsoftversion & 0xffff >= 1082) ) ) + exec sp_dboption N'IBatisNet', N'db chaining', N'false' +GO + +if exists (select * from master.dbo.syslogins where loginname = N'IBatisNet') + exec sp_droplogin N'IBatisNet' +GO + +use [IBatisNet] +GO + +if not exists (select * from master.dbo.syslogins where loginname = N'IBatisNet') +BEGIN + declare @logindb nvarchar(132), @loginpass nvarchar(132), @loginlang nvarchar(132) + select @logindb = N'IBatisNet', @loginpass=N'test', @loginlang = N'us_english' + exec sp_addlogin N'IBatisNet', @loginpass, @logindb, @loginlang +END +GO + +if not exists (select * from dbo.sysusers where name = N'IBatisNet' and uid < 16382) + EXEC sp_grantdbaccess N'IBatisNet', N'IBatisNet' +GO + +exec sp_addrolemember N'db_owner', N'IBatisNet' +GO + +-- MSQL DATABASE 'NHibernate' + +IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'NHibernate') + DROP DATABASE [NHibernate] +GO + +CREATE DATABASE [NHibernate] + COLLATE Latin1_General_CI_AS +GO + +exec sp_dboption N'NHibernate', N'autoclose', N'true' +GO + +exec sp_dboption N'NHibernate', N'bulkcopy', N'false' +GO + +exec sp_dboption N'NHibernate', N'trunc. log', N'true' +GO + +exec sp_dboption N'NHibernate', N'torn page detection', N'true' +GO + +exec sp_dboption N'NHibernate', N'read only', N'false' +GO + +exec sp_dboption N'NHibernate', N'dbo use', N'false' +GO + +exec sp_dboption N'NHibernate', N'single', N'false' +GO + +exec sp_dboption N'NHibernate', N'autoshrink', N'true' +GO + +exec sp_dboption N'NHibernate', N'ANSI null default', N'false' +GO + +exec sp_dboption N'NHibernate', N'recursive triggers', N'false' +GO + +exec sp_dboption N'NHibernate', N'ANSI nulls', N'false' +GO + +exec sp_dboption N'NHibernate', N'concat null yields null', N'false' +GO + +exec sp_dboption N'NHibernate', N'cursor close on commit', N'false' +GO + +exec sp_dboption N'NHibernate', N'default to local cursor', N'false' +GO + +exec sp_dboption N'NHibernate', N'quoted identifier', N'false' +GO + +exec sp_dboption N'NHibernate', N'ANSI warnings', N'false' +GO + +exec sp_dboption N'NHibernate', N'auto create statistics', N'true' +GO + +exec sp_dboption N'NHibernate', N'auto update statistics', N'true' +GO + +if( ( (@@microsoftversion / power(2, 24) = 8) and (@@microsoftversion & 0xffff >= 724) ) or ( (@@microsoftversion / power(2, 24) = 7) and (@@microsoftversion & 0xffff >= 1082) ) ) + exec sp_dboption N'NHibernate', N'db chaining', N'false' +GO + +if exists (select * from master.dbo.syslogins where loginname = N'NHibernate') + exec sp_droplogin N'NHibernate' +GO + +use [NHibernate] +GO + +if not exists (select * from master.dbo.syslogins where loginname = N'NHibernate') +BEGIN + declare @logindb nvarchar(132), @loginpass nvarchar(132), @loginlang nvarchar(132) + select @logindb = N'NHibernate', @loginpass=N'test', @loginlang = N'us_english' + exec sp_addlogin N'NHibernate', @loginpass, @logindb, @loginlang +END +GO + +if not exists (select * from dbo.sysusers where name = N'NHibernate' and uid < 16382) + EXEC sp_grantdbaccess N'NHibernate', N'NHibernate' +GO + +exec sp_addrolemember N'db_owner', N'NHibernate' +GO
\ No newline at end of file diff --git a/tests/unit/Data/SqlMap/scripts/mssql/README-embed-param.txt b/tests/unit/Data/SqlMap/scripts/mssql/README-embed-param.txt new file mode 100644 index 00000000..639e61a8 --- /dev/null +++ b/tests/unit/Data/SqlMap/scripts/mssql/README-embed-param.txt @@ -0,0 +1,8 @@ +Technique for creating large sample test data from: + +http://www.sql-server-performance.com/jc_large_data_operations.asp + +Make sure you have enough space and have either enough processing power or +enough patience to run the Embed Parameters in Statement tests. + +Run embed-parameters-setup-init.sql prior to running tests. diff --git a/tests/unit/Data/SqlMap/scripts/mssql/account-init.sql b/tests/unit/Data/SqlMap/scripts/mssql/account-init.sql new file mode 100644 index 00000000..4b8e3ece --- /dev/null +++ b/tests/unit/Data/SqlMap/scripts/mssql/account-init.sql @@ -0,0 +1,47 @@ +-- Creating Table + +use [IBatisNet] + +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Accounts]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) +BEGIN + if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Orders_Accounts]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) + ALTER TABLE [dbo].[Orders] DROP CONSTRAINT FK_Orders_Accounts + + drop table [dbo].[Accounts] +END + +CREATE TABLE [dbo].[Accounts] ( + [Account_ID] [int] NOT NULL , + [Account_FirstName] [varchar] (32) NOT NULL , + [Account_LastName] [varchar] (32) NOT NULL , + [Account_Email] [varchar] (128) NULL, + [Account_Banner_Option] [varchar] (255), + [Account_Cart_Option] [int] +) ON [PRIMARY] + +ALTER TABLE [dbo].[Accounts] WITH NOCHECK ADD + CONSTRAINT [PK_Account] PRIMARY KEY CLUSTERED + ( + [Account_ID] + ) ON [PRIMARY] + +-- Creating Test Data + +INSERT INTO [dbo].[Accounts] VALUES(1,'Joe', 'Dalton', 'Joe.Dalton@somewhere.com', 'Oui', 200); +INSERT INTO [dbo].[Accounts] VALUES(2,'Averel', 'Dalton', 'Averel.Dalton@somewhere.com', 'Oui', 200); +INSERT INTO [dbo].[Accounts] VALUES(3,'William', 'Dalton', null, 'Non', 100); +INSERT INTO [dbo].[Accounts] VALUES(4,'Jack', 'Dalton', 'Jack.Dalton@somewhere.com', 'Non', 100); +INSERT INTO [dbo].[Accounts] VALUES(5,'Gilles', 'Bayon', null, 'Oui', 100); + +-- Store procedure + +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ps_InsertAccount]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[ps_InsertAccount] + +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ps_SelectAccount]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[ps_SelectAccount] + +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ps_swap_email_address]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[ps_swap_email_address] + + diff --git a/tests/unit/Data/SqlMap/scripts/mssql/account-procedure.sql b/tests/unit/Data/SqlMap/scripts/mssql/account-procedure.sql new file mode 100644 index 00000000..fdb5c3d9 --- /dev/null +++ b/tests/unit/Data/SqlMap/scripts/mssql/account-procedure.sql @@ -0,0 +1,12 @@ +CREATE PROCEDURE dbo.[ps_InsertAccount] +@Account_ID [int], +@Account_FirstName [nvarchar] (40), +@Account_LastName [varchar] (32), +@Account_Email [varchar] (128), +@Account_Banner_Option [varchar] (255), +@Account_Cart_Option [int] +AS +insert into Accounts + (Account_ID, Account_FirstName, Account_LastName, Account_Email, Account_Banner_Option, Account_Cart_Option) +values + (@Account_ID, @Account_FirstName, @Account_LastName, @Account_Email, @Account_Banner_Option, @Account_Cart_Option) diff --git a/tests/unit/Data/SqlMap/scripts/mssql/category-init.sql b/tests/unit/Data/SqlMap/scripts/mssql/category-init.sql new file mode 100644 index 00000000..d7a7cfa5 --- /dev/null +++ b/tests/unit/Data/SqlMap/scripts/mssql/category-init.sql @@ -0,0 +1,17 @@ +-- Creating Table + +use [IBatisNet] + +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Categories]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) +drop table [dbo].[Categories] + +CREATE TABLE [dbo].[Categories] ( + [Category_Id] [int] IDENTITY (1, 1) NOT NULL , + [Category_Name] [varchar] (32) NULL, + [Category_Guid] [uniqueidentifier] NULL +) ON [PRIMARY] + +-- Store procedure + +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ps_InsertCategorie]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[ps_InsertCategorie] diff --git a/tests/unit/Data/SqlMap/scripts/mssql/category-procedure.sql b/tests/unit/Data/SqlMap/scripts/mssql/category-procedure.sql new file mode 100644 index 00000000..bf565e87 --- /dev/null +++ b/tests/unit/Data/SqlMap/scripts/mssql/category-procedure.sql @@ -0,0 +1,10 @@ +CREATE PROCEDURE dbo.[ps_InsertCategorie] +@Category_Id [int] output, +@Category_Name [varchar] (32), +@Category_Guid [uniqueidentifier] +AS +insert into Categories + (Category_Name, Category_Guid ) +values + (@Category_Name, @Category_Guid) +SELECT @Category_Id = SCOPE_IDENTITY()
\ No newline at end of file diff --git a/tests/unit/Data/SqlMap/scripts/mssql/documents-init.sql b/tests/unit/Data/SqlMap/scripts/mssql/documents-init.sql new file mode 100644 index 00000000..b268c258 --- /dev/null +++ b/tests/unit/Data/SqlMap/scripts/mssql/documents-init.sql @@ -0,0 +1,34 @@ +-- Creating Table + +use [IBatisNet] + +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Documents]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) +BEGIN + if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_LineItems_Orders]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) + ALTER TABLE [dbo].[LineItems] DROP CONSTRAINT FK_LineItems_Orders + + drop table [dbo].[Documents] +END + +CREATE TABLE [dbo].[Documents] ( + [Document_ID] [int] NOT NULL , + [Document_Title] [varchar] (32) NULL , + [Document_Type] [varchar] (32) NULL , + [Document_PageNumber] [int] NULL , + [Document_City] [varchar] (32) NULL +) ON [PRIMARY] + +ALTER TABLE [dbo].[Documents] WITH NOCHECK ADD + CONSTRAINT [PK_Documents] PRIMARY KEY CLUSTERED + ( + [Document_ID] + ) ON [PRIMARY] + +-- Creating Test Data + +INSERT INTO [dbo].[Documents] VALUES (1, 'The World of Null-A', 'Book', 55, null); +INSERT INTO [dbo].[Documents] VALUES (2, 'Le Progres de Lyon', 'Newspaper', null , 'Lyon'); +INSERT INTO [dbo].[Documents] VALUES (3, 'Lord of the Rings', 'Book', 3587, null); +INSERT INTO [dbo].[Documents] VALUES (4, 'Le Canard enchaine', 'Tabloid', null , 'Paris'); +INSERT INTO [dbo].[Documents] VALUES (5, 'Le Monde', 'Broadsheet', null , 'Paris'); +INSERT INTO [dbo].[Documents] VALUES (6, 'Foundation', 'Monograph', 557, null); diff --git a/tests/unit/Data/SqlMap/scripts/mssql/embed-param-setup-init.sql b/tests/unit/Data/SqlMap/scripts/mssql/embed-param-setup-init.sql new file mode 100644 index 00000000..c0bf20e8 --- /dev/null +++ b/tests/unit/Data/SqlMap/scripts/mssql/embed-param-setup-init.sql @@ -0,0 +1,94 @@ +-- Technique for creating large sample test data from +-- http://www.sql-server-performance.com/jc_large_data_operations.asp + +use [IBatisNet] + +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ManyRecords]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) +drop table [dbo].[ManyRecords] + +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ManyRecordsTest]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) +drop table [dbo].[ManyRecordsTest] + + + +-- Create Data Storage Table +CREATE TABLE [dbo].[ManyRecords] ( + [Many_FirstID] [int] NOT NULL, + [Many_SecondID] [int] NOT NULL, + [Many_ThirdID] [int] NOT NULL, + [Many_FourthID] [int] NOT NULL, + [Many_FifthID] [int] NOT NULL, + [Many_SequenceID] [int] NOT NULL, + [Many_DistributedID] [int] NOT NULL, + [Many_SampleCharValue] [char] (10) NOT NULL, + [Many_SampleDecimal] [decimal] (9,4) NOT NULL, + [Many_SampleMoney] [money] NOT NULL, + [Many_SampleDate] [datetime] NOT NULL, + [Many_SequenceDate] [datetime] NOT NULL ) +ON [PRIMARY] + + + +-- Create Sample Data of 1 million records (increase if needed) +BEGIN TRANSACTION + DECLARE @intIndex int, @rowCount int, @seqCount int, @distValue int + SELECT @intIndex = 1, @rowCount = 1000000, @seqCount = 10000 + SELECT @distValue = @rowCount/10000 + + WHILE @intIndex <= @rowCount + BEGIN + INSERT INTO [dbo].[ManyRecords] ( + [Many_FirstID], + [Many_SecondID], + [Many_ThirdID], + [Many_FourthID], + [Many_FifthID], + [Many_SequenceID], + [Many_DistributedID], + [Many_SampleCharValue], + [Many_SampleDecimal], + [Many_SampleMoney], + [Many_SampleDate], + [Many_SequenceDate] ) + VALUES ( + @intIndex, -- First + @intIndex/2, -- Second + @intIndex/4, -- Third + @intIndex/10, -- Fourth + @intIndex/20, -- Fifth + (@intIndex-1)/@seqCount + 1, -- Sequential value + (@intIndex-1)%(@distValue) + 1, -- Distributed value + CHAR(65 + 26*rand())+CHAR(65 + 26*rand())+CHAR(65 + 26*rand())+CONVERT(char(6),CONVERT(int,100000*(9.0*rand()+1.0)))+CHAR(65 + 26*rand()), -- Char Value + 10000*rand(), -- Decimal value + 10000*rand(), -- Money value + DATEADD(hour,100000*rand(),'1990-01-01'), -- Date value + DATEADD(hour,@intIndex/5,'1990-01-01') ) -- Sequential date value + + SET @intIndex = @intIndex + 1 + END +COMMIT TRANSACTION + + + +-- Create Test table using storage table sample data +SELECT + [Many_FirstID], + [Many_SecondID], + [Many_ThirdID], + [Many_FourthID], + [Many_FifthID], + [Many_SequenceID], + [Many_DistributedID], + [Many_SampleCharValue], + [Many_SampleDecimal], + [Many_SampleMoney], + [Many_SampleDate], + [Many_SequenceDate] +INTO [dbo].[ManyRecordsTest] +FROM [dbo].[ManyRecords] + + + +-- Create Test table indexes +CREATE INDEX [IDX_ManyRecordsTest_Seq] ON [dbo].[ManyRecordsTest] ([Many_SequenceID]) WITH SORT_IN_TEMPDB +CREATE INDEX [IDX_ManyRecordsTest_Dist] ON [dbo].[ManyRecordsTest] ([Many_DistributedID]) WITH SORT_IN_TEMPDB
\ No newline at end of file diff --git a/tests/unit/Data/SqlMap/scripts/mssql/embed-param-test-init.sql b/tests/unit/Data/SqlMap/scripts/mssql/embed-param-test-init.sql new file mode 100644 index 00000000..f776b158 --- /dev/null +++ b/tests/unit/Data/SqlMap/scripts/mssql/embed-param-test-init.sql @@ -0,0 +1,32 @@ +-- Technique for creating large sample test data from +-- http://www.sql-server-performance.com/jc_large_data_operations.asp + +use [IBatisNet] + +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ManyRecordsTest]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) +drop table [dbo].[ManyRecordsTest] + + + +-- Create Test table using storage table sample data +SELECT + [Many_FirstID], + [Many_SecondID], + [Many_ThirdID], + [Many_FourthID], + [Many_FifthID], + [Many_SequenceID], + [Many_DistributedID], + [Many_SampleCharValue], + [Many_SampleDecimal], + [Many_SampleMoney], + [Many_SampleDate], + [Many_SequenceDate] +INTO [dbo].[ManyRecordsTest] +FROM [dbo].[ManyRecords] + + + +-- Create Test table indexes +CREATE INDEX [IDX_ManyRecordsTest_Seq] ON [dbo].[ManyRecordsTest] ([Many_SequenceID]) WITH SORT_IN_TEMPDB +CREATE INDEX [IDX_ManyRecordsTest_Dist] ON [dbo].[ManyRecordsTest] ([Many_DistributedID]) WITH SORT_IN_TEMPDB
\ No newline at end of file diff --git a/tests/unit/Data/SqlMap/scripts/mssql/enumeration-init.sql b/tests/unit/Data/SqlMap/scripts/mssql/enumeration-init.sql new file mode 100644 index 00000000..65b1e26f --- /dev/null +++ b/tests/unit/Data/SqlMap/scripts/mssql/enumeration-init.sql @@ -0,0 +1,30 @@ +-- Creating Table + +use [IBatisNet] + +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Enumerations]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) +BEGIN + drop table [dbo].[Enumerations] +END + +CREATE TABLE [dbo].[Enumerations] ( + [Enum_ID] [int] NOT NULL , + [Enum_Day] [int] NOT NULL , + [Enum_Color] [int] NOT NULL, + [Enum_Month] [int] NULL +) ON [PRIMARY] + +ALTER TABLE [dbo].[Enumerations] WITH NOCHECK ADD + CONSTRAINT [PK_Enum] PRIMARY KEY CLUSTERED + ( + [Enum_ID] + ) ON [PRIMARY] + +-- Creating Test Data + +INSERT INTO [dbo].[Enumerations] VALUES(1, 1, 1, 128); +INSERT INTO [dbo].[Enumerations] VALUES(2, 2, 2, 2048); +INSERT INTO [dbo].[Enumerations] VALUES(3, 3, 4, 256); +INSERT INTO [dbo].[Enumerations] VALUES(4, 4, 8, null); + + diff --git a/tests/unit/Data/SqlMap/scripts/mssql/line-item-init.sql b/tests/unit/Data/SqlMap/scripts/mssql/line-item-init.sql new file mode 100644 index 00000000..e25a49dd --- /dev/null +++ b/tests/unit/Data/SqlMap/scripts/mssql/line-item-init.sql @@ -0,0 +1,53 @@ +-- Creating Table + +use [IBatisNet] + +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[LineItems]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) +drop table [dbo].[LineItems] + +CREATE TABLE [dbo].[LineItems] ( + [LineItem_ID] [int] NOT NULL , + [Order_ID] [int] NOT NULL , + [LineItem_Code] [varchar] (32) NOT NULL , + [LineItem_Quantity] [int] NOT NULL , + [LineItem_Price] [decimal](18, 2) NULL, + [LineItem_Picture] [image] null +) ON [PRIMARY] + +ALTER TABLE [dbo].[LineItems] WITH NOCHECK ADD + CONSTRAINT [PK_LinesItem] PRIMARY KEY CLUSTERED + ( + [LineItem_ID], + [Order_ID] + ) ON [PRIMARY] + +ALTER TABLE [dbo].[LineItems] ADD + CONSTRAINT [FK_LineItems_Orders] FOREIGN KEY + ( + [Order_ID] + ) REFERENCES [dbo].[Orders] ( + [Order_ID] + ) +-- Creating Test Data + +INSERT INTO [dbo].[LineItems] VALUES (1, 10, 'ESM-34', 1, 45.43, null); +INSERT INTO [dbo].[LineItems] VALUES (2, 10, 'QSM-98', 8, 8.40, null); +INSERT INTO [dbo].[LineItems] VALUES (1, 9, 'DSM-78', 2, 45.40, null); +INSERT INTO [dbo].[LineItems] VALUES (2, 9, 'TSM-12', 2, 32.12, null); +INSERT INTO [dbo].[LineItems] VALUES (1, 8, 'DSM-16', 4, 41.30, null); +INSERT INTO [dbo].[LineItems] VALUES (2, 8, 'GSM-65', 1, 2.20, null); +INSERT INTO [dbo].[LineItems] VALUES (1, 7, 'WSM-27', 7, 52.10, null); +INSERT INTO [dbo].[LineItems] VALUES (2, 7, 'ESM-23', 2, 123.34, null); +INSERT INTO [dbo].[LineItems] VALUES (1, 6, 'QSM-39', 9, 12.12, null); +INSERT INTO [dbo].[LineItems] VALUES (2, 6, 'ASM-45', 6, 78.77, null); +INSERT INTO [dbo].[LineItems] VALUES (1, 5, 'ESM-48', 3, 43.87, null); +INSERT INTO [dbo].[LineItems] VALUES (2, 5, 'WSM-98', 7, 5.40, null); +INSERT INTO [dbo].[LineItems] VALUES (1, 4, 'RSM-57', 2, 78.90, null); +INSERT INTO [dbo].[LineItems] VALUES (2, 4, 'XSM-78', 9, 2.34, null); +INSERT INTO [dbo].[LineItems] VALUES (1, 3, 'DSM-59', 3, 5.70, null); +INSERT INTO [dbo].[LineItems] VALUES (2, 3, 'DSM-53', 3, 98.78, null); +INSERT INTO [dbo].[LineItems] VALUES (1, 2, 'DSM-37', 4, 7.80, null); +INSERT INTO [dbo].[LineItems] VALUES (2, 2, 'FSM-12', 2, 55.78, null); +INSERT INTO [dbo].[LineItems] VALUES (1, 1, 'ESM-48', 8, 87.60, null); +INSERT INTO [dbo].[LineItems] VALUES (2, 1, 'ESM-23', 1, 55.40, null); + diff --git a/tests/unit/Data/SqlMap/scripts/mssql/more-account-records.sql b/tests/unit/Data/SqlMap/scripts/mssql/more-account-records.sql new file mode 100644 index 00000000..e526309d --- /dev/null +++ b/tests/unit/Data/SqlMap/scripts/mssql/more-account-records.sql @@ -0,0 +1,11 @@ + + + +-- Creating Test Data + +INSERT INTO [dbo].[Accounts] VALUES(6,'Jane', 'Calamity', 'Jane.Calamity@somewhere.com', 'Oui', 200); +INSERT INTO [dbo].[Accounts] VALUES(7,'Lucky', 'Luke', 'Lucky.Luke@somewhere.com', 'Oui', 200); +INSERT INTO [dbo].[Accounts] VALUES(8,'Ming', 'Li Foo', null, 'Non', 100); +INSERT INTO [dbo].[Accounts] VALUES(9,'O''Hara', 'Steve', 'Jack.OHara@somewhere.com', 'Oui', 200); +INSERT INTO [dbo].[Accounts] VALUES(10,'Robert', 'O''Timmins', null, 'Non', 100); + diff --git a/tests/unit/Data/SqlMap/scripts/mssql/order-init.sql b/tests/unit/Data/SqlMap/scripts/mssql/order-init.sql new file mode 100644 index 00000000..0f1e2438 --- /dev/null +++ b/tests/unit/Data/SqlMap/scripts/mssql/order-init.sql @@ -0,0 +1,54 @@ +-- Creating Table + +use [IBatisNet] + +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Orders]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) +BEGIN + if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_LineItems_Orders]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) + ALTER TABLE [dbo].[LineItems] DROP CONSTRAINT FK_LineItems_Orders + + drop table [dbo].[Orders] +END + +CREATE TABLE [dbo].[Orders] ( + [Order_ID] [int] NOT NULL , + [Account_ID] [int] NULL , + [Order_Date] [datetime] NULL , + [Order_CardType] [varchar] (32) NULL , + [Order_CardNumber] [varchar] (32) NULL , + [Order_CardExpiry] [varchar] (32) NULL , + [Order_Street] [varchar] (32) NULL , + [Order_City] [varchar] (32) NULL , + [Order_Province] [varchar] (32) NULL , + [Order_PostalCode] [varchar] (32) NULL , + [Order_FavouriteLineItem] [int] NULL +) ON [PRIMARY] + +ALTER TABLE [dbo].[Orders] WITH NOCHECK ADD + CONSTRAINT [PK_Orders] PRIMARY KEY CLUSTERED + ( + [Order_ID] + ) ON [PRIMARY] + + +ALTER TABLE [dbo].[Orders] ADD + CONSTRAINT [FK_Orders_Accounts] FOREIGN KEY + ( + [Account_ID] + ) REFERENCES [dbo].[Accounts] ( + [Account_ID] + ) +-- Creating Test Data -- 2003-02-15 8:15:00/ 2003-02-15 8:15:00 + +INSERT INTO [dbo].[Orders] VALUES (1, 1, '2003-02-15 8:15:00', 'VISA', '999999999999', '05/03', '11 This Street', 'Victoria', 'BC', 'C4B 4F4',2); +INSERT INTO [dbo].[Orders] VALUES (2, 4, '2003-02-15 8:15:00', 'MC', '888888888888', '06/03', '222 That Street', 'Edmonton', 'AB', 'X4K 5Y4',1); +INSERT INTO [dbo].[Orders] VALUES (3, 3, '2003-02-15 8:15:00', 'AMEX', '777777777777', '07/03', '333 Other Street', 'Regina', 'SK', 'Z4U 6Y4',2); +INSERT INTO [dbo].[Orders] VALUES (4, 2, '2003-02-15 8:15:00', 'MC', '666666666666', '08/03', '444 His Street', 'Toronto', 'ON', 'K4U 3S4',1); +INSERT INTO [dbo].[Orders] VALUES (5, 5, '2003-02-15 8:15:00', 'VISA', '555555555555', '09/03', '555 Her Street', 'Calgary', 'AB', 'J4J 7S4',2); +INSERT INTO [dbo].[Orders] VALUES (6, 5, '2003-02-15 8:15:00', 'VISA', '999999999999', '10/03', '6 Their Street', 'Victoria', 'BC', 'T4H 9G4',1); +INSERT INTO [dbo].[Orders] VALUES (7, 4, '2003-02-15 8:15:00', 'MC', '888888888888', '11/03', '77 Lucky Street', 'Edmonton', 'AB', 'R4A 0Z4',2); +INSERT INTO [dbo].[Orders] VALUES (8, 3, '2003-02-15 8:15:00', 'AMEX', '777777777777', '12/03', '888 Our Street', 'Regina', 'SK', 'S4S 7G4',1); +INSERT INTO [dbo].[Orders] VALUES (9, 2, '2003-02-15 8:15:00', 'MC', '666666666666', '01/04', '999 Your Street', 'Toronto', 'ON', 'G4D 9F4',2); +INSERT INTO [dbo].[Orders] VALUES (10, 1, '2003-02-15 8:15:00', 'VISA', '555555555555', '02/04', '99 Some Street', 'Calgary', 'AB', 'W4G 7A4',1); +INSERT INTO [dbo].[Orders] VALUES (11, null, '2003-02-15 8:15:00', 'VISA', '555555555555', '02/04', 'Null order', 'Calgary', 'ZZ', 'XXX YYY',1); + diff --git a/tests/unit/Data/SqlMap/scripts/mssql/other-init.sql b/tests/unit/Data/SqlMap/scripts/mssql/other-init.sql new file mode 100644 index 00000000..645a6eea --- /dev/null +++ b/tests/unit/Data/SqlMap/scripts/mssql/other-init.sql @@ -0,0 +1,145 @@ +-- Creating Table + +use [IBatisNet] + +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Others]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) +BEGIN + drop table [dbo].[Others] +END + +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[A]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) +BEGIN + drop table [dbo].[A] +END +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[B]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) +BEGIN + drop table [dbo].[B] +END +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[C]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) +BEGIN + drop table [dbo].[C] +END +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[D]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) +BEGIN + drop table [dbo].[D] +END +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[E]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) +BEGIN + drop table [dbo].[E] +END +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[F]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) +BEGIN + drop table [dbo].[F] +END + + +CREATE TABLE [dbo].[Others] ( + [Other_Int] [int] NULL , + [Other_Long] [BigInt] NULL, + [Other_Bit] [Bit] NOT NULL DEFAULT (0), + [Other_String] [varchar] (32) NOT NULL +) ON [PRIMARY] + +CREATE TABLE [dbo].[F] ( + [ID] [varchar] (50) NOT NULL , + [F_Libelle] [varchar] (50) NULL , + CONSTRAINT [PK_F] PRIMARY KEY CLUSTERED + ( + [ID] + ) ON [PRIMARY] +) ON [PRIMARY] + +CREATE TABLE [dbo].[E] ( + [ID] [varchar] (50) NOT NULL , + [E_Libelle] [varchar] (50) NULL , + CONSTRAINT [PK_E] PRIMARY KEY CLUSTERED + ( + [ID] + ) ON [PRIMARY] +) ON [PRIMARY] + +CREATE TABLE [dbo].[D] ( + [ID] [varchar] (50) NOT NULL , + [D_Libelle] [varchar] (50) NULL , + CONSTRAINT [PK_D] PRIMARY KEY CLUSTERED + ( + [ID] + ) ON [PRIMARY] +) ON [PRIMARY] + +CREATE TABLE [dbo].[C] ( + [ID] [varchar] (50) NOT NULL , + [C_Libelle] [varchar] (50) NULL , + CONSTRAINT [PK_C] PRIMARY KEY CLUSTERED + ( + [ID] + ) ON [PRIMARY] +) ON [PRIMARY] + + +CREATE TABLE [dbo].[B] ( + [ID] [varchar] (50) NOT NULL , + [C_ID] [varchar] (50) NULL , + [D_ID] [varchar] (50) NULL , + [B_Libelle] [varchar] (50) NULL , + CONSTRAINT [PK_B] PRIMARY KEY CLUSTERED + ( + [ID] + ) ON [PRIMARY] , + CONSTRAINT [FK_B_C] FOREIGN KEY + ( + [C_ID] + ) REFERENCES [C] ( + [ID] + ), + CONSTRAINT [FK_B_D] FOREIGN KEY + ( + [D_ID] + ) REFERENCES [D] ( + [ID] + ) +) ON [PRIMARY] + + +CREATE TABLE [dbo].[A] ( + [Id] [varchar] (50) NOT NULL , + [B_ID] [varchar] (50) NULL , + [E_ID] [varchar] (50) NULL , + [F_ID] [varchar] (50) NULL , + [A_Libelle] [varchar] (50) NULL + CONSTRAINT [PK_A] PRIMARY KEY CLUSTERED + ( + [Id] + ) ON [PRIMARY] , + CONSTRAINT [FK_A_B] FOREIGN KEY + ( + [B_ID] + ) REFERENCES [B] ( + [ID] + ), + CONSTRAINT [FK_A_E] FOREIGN KEY + ( + [E_ID] + ) REFERENCES [E] ( + [ID] + ), + CONSTRAINT [FK_A_F] FOREIGN KEY + ( + [F_ID] + ) REFERENCES [F] ( + [ID] + ) +) ON [PRIMARY] + + +-- Creating Test Data + +INSERT INTO [dbo].[Others] VALUES(1, 8888888, 0, 'Oui'); +INSERT INTO [dbo].[Others] VALUES(2, 9999999999, 1, 'Non'); + +INSERT INTO [dbo].[F] VALUES('f', 'fff'); +INSERT INTO [dbo].[E] VALUES('e', 'eee'); +INSERT INTO [dbo].[D] VALUES('d', 'ddd'); +INSERT INTO [dbo].[C] VALUES('c', 'ccc'); +INSERT INTO [dbo].[B] VALUES('b', 'c', null, 'bbb'); +INSERT INTO [dbo].[A] VALUES('a', 'b', 'e', null, 'aaa');
\ No newline at end of file diff --git a/tests/unit/Data/SqlMap/scripts/mssql/ps_SelectAccount.sql b/tests/unit/Data/SqlMap/scripts/mssql/ps_SelectAccount.sql new file mode 100644 index 00000000..bf3ae13d --- /dev/null +++ b/tests/unit/Data/SqlMap/scripts/mssql/ps_SelectAccount.sql @@ -0,0 +1,10 @@ +CREATE PROCEDURE dbo.[ps_SelectAccount] +@Account_ID [int] +AS +select + Account_ID as Id, + Account_FirstName as FirstName, + Account_LastName as LastName, + Account_Email as EmailAddress +from Accounts +where Account_ID = @Account_ID
\ No newline at end of file diff --git a/tests/unit/Data/SqlMap/scripts/mssql/swap-procedure.sql b/tests/unit/Data/SqlMap/scripts/mssql/swap-procedure.sql new file mode 100644 index 00000000..981ffc5f --- /dev/null +++ b/tests/unit/Data/SqlMap/scripts/mssql/swap-procedure.sql @@ -0,0 +1,34 @@ +CREATE PROCEDURE dbo.[ps_swap_email_address] +@First_Email [nvarchar] (64) output, +@Second_Email [nvarchar] (64) output +AS + +Declare @ID1 int +Declare @ID2 int + +Declare @Email1 [nvarchar] (64) +Declare @Email2 [nvarchar] (64) + + SELECT @ID1 = Account_ID, @Email1 = Account_Email + from Accounts + where Account_Email = @First_Email + + SELECT @ID2 = Account_ID, @Email2 = Account_Email + from Accounts + where Account_Email = @Second_Email + + UPDATE Accounts + set Account_Email = @Email2 + where Account_ID = @ID1 + + UPDATE Accounts + set Account_Email = @Email1 + where Account_ID = @ID2 + + SELECT @First_Email = Account_Email + from Accounts + where Account_ID = @ID1 + + SELECT @Second_Email = Account_Email + from Accounts + where Account_ID = @ID2 diff --git a/tests/unit/Data/SqlMap/scripts/mssql/user-init.sql b/tests/unit/Data/SqlMap/scripts/mssql/user-init.sql new file mode 100644 index 00000000..7551da42 --- /dev/null +++ b/tests/unit/Data/SqlMap/scripts/mssql/user-init.sql @@ -0,0 +1,17 @@ +-- Creating Table + +use [NHibernate] + +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Users]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) +BEGIN + drop table [dbo].[Users] +END + +CREATE TABLE [dbo].[Users] ( + LogonID nvarchar(20) NOT NULL default '0', + Name nvarchar(40) default NULL, + Password nvarchar(20) default NULL, + EmailAddress nvarchar(40) default NULL, + LastLogon datetime default NULL, + PRIMARY KEY (LogonID) +) diff --git a/tests/unit/Data/SqlMap/scripts/mysql/DataBase.sql b/tests/unit/Data/SqlMap/scripts/mysql/DataBase.sql new file mode 100644 index 00000000..159b1f4a --- /dev/null +++ b/tests/unit/Data/SqlMap/scripts/mysql/DataBase.sql @@ -0,0 +1,356 @@ +-- +-- Table structure for table `A` +-- + +DROP TABLE IF EXISTS `A`; +CREATE TABLE `A` ( + `ID` varchar(50) NOT NULL, + `B_ID` varchar(50) default NULL, + `E_ID` varchar(50) default NULL, + `F_ID` varchar(50) default NULL, + `A_Libelle` varchar(50) default NULL, + PRIMARY KEY (`ID`), + KEY `FK_A_B` (`B_ID`), + KEY `FK_A_E` (`E_ID`), + KEY `FK_A_F` (`F_ID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Dumping data for table `A` +-- + +INSERT INTO `A` (`ID`, `B_ID`, `E_ID`, `F_ID`, `A_Libelle`) VALUES ('a', 'b', 'e', NULL, 'aaa'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `Accounts` +-- + +DROP TABLE IF EXISTS `Accounts`; +CREATE TABLE `Accounts` ( + `Account_Id` int(11) NOT NULL, + `Account_FirstName` varchar(32) NOT NULL, + `Account_LastName` varchar(32) NOT NULL, + `Account_Email` varchar(128) default NULL, + `Account_Banner_Option` varchar(255) default NULL, + `Account_Cart_Option` int(11) default NULL, + PRIMARY KEY (`Account_Id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Dumping data for table `Accounts` +-- + +INSERT INTO `Accounts` (`Account_Id`, `Account_FirstName`, `Account_LastName`, `Account_Email`, `Account_Banner_Option`, `Account_Cart_Option`) VALUES (1, 'Joe', 'Dalton', 'Joe.Dalton@somewhere.com', 'Oui', 200), +(2, 'Averel', 'Dalton', 'Averel.Dalton@somewhere.com', 'Oui', 200), +(3, 'William', 'Dalton', NULL, 'Non', 100), +(4, 'Jack', 'Dalton', 'Jack.Dalton@somewhere.com', 'Non', 100), +(5, 'Gilles', 'Bayon', NULL, 'Oui', 100); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `B` +-- + +DROP TABLE IF EXISTS `B`; +CREATE TABLE `B` ( + `ID` varchar(50) NOT NULL, + `C_ID` varchar(50) default NULL, + `D_ID` varchar(50) default NULL, + `B_Libelle` varchar(50) default NULL, + PRIMARY KEY (`ID`), + KEY `FK_B_C` (`C_ID`), + KEY `FK_B_D` (`D_ID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Dumping data for table `B` +-- + +INSERT INTO `B` (`ID`, `C_ID`, `D_ID`, `B_Libelle`) VALUES ('b', 'c', NULL, 'bbb'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `C` +-- + +DROP TABLE IF EXISTS `C`; +CREATE TABLE `C` ( + `ID` varchar(50) NOT NULL, + `C_Libelle` varchar(50) default NULL, + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Dumping data for table `C` +-- + +INSERT INTO `C` (`ID`, `C_Libelle`) VALUES ('c', 'ccc'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `Categories` +-- + +DROP TABLE IF EXISTS `Categories`; +CREATE TABLE `Categories` ( + `Category_Id` int(11) NOT NULL auto_increment, + `Category_Name` varchar(32) default NULL, + `Category_Guid` varchar(36) default NULL, + PRIMARY KEY (`Category_Id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; + +-- +-- Dumping data for table `Categories` +-- + + +-- -------------------------------------------------------- + +-- +-- Table structure for table `D` +-- + +DROP TABLE IF EXISTS `D`; +CREATE TABLE `D` ( + `ID` varchar(50) NOT NULL, + `D_Libelle` varchar(50) default NULL, + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Dumping data for table `D` +-- + +INSERT INTO `D` (`ID`, `D_Libelle`) VALUES ('d', 'ddd'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `Documents` +-- + +DROP TABLE IF EXISTS `Documents`; +CREATE TABLE `Documents` ( + `Document_Id` int(11) NOT NULL, + `Document_Title` varchar(32) default NULL, + `Document_Type` varchar(32) default NULL, + `Document_PageNumber` int(11) default NULL, + `Document_City` varchar(32) default NULL, + PRIMARY KEY (`Document_Id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Dumping data for table `Documents` +-- + +INSERT INTO `Documents` (`Document_Id`, `Document_Title`, `Document_Type`, `Document_PageNumber`, `Document_City`) VALUES (1, 'The World of Null-A', 'Book', 55, NULL), +(2, 'Le Progres de Lyon', 'Newspaper', NULL, 'Lyon'), +(3, 'Lord of the Rings', 'Book', 3587, NULL), +(4, 'Le Canard enchaine', 'Tabloid', NULL, 'Paris'), +(5, 'Le Monde', 'Broadsheet', NULL, 'Paris'), +(6, 'Foundation', 'Monograph', 557, NULL); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `E` +-- + +DROP TABLE IF EXISTS `E`; +CREATE TABLE `E` ( + `ID` varchar(50) NOT NULL, + `E_Libelle` varchar(50) default NULL, + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Dumping data for table `E` +-- + +INSERT INTO `E` (`ID`, `E_Libelle`) VALUES ('e', 'eee'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `Enumerations` +-- + +DROP TABLE IF EXISTS `Enumerations`; +CREATE TABLE `Enumerations` ( + `Enum_Id` int(11) NOT NULL, + `Enum_Day` int(11) NOT NULL, + `Enum_Color` int(11) NOT NULL, + `Enum_Month` int(11) default NULL, + PRIMARY KEY (`Enum_Id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Dumping data for table `Enumerations` +-- + + +-- -------------------------------------------------------- + +-- +-- Table structure for table `F` +-- + +DROP TABLE IF EXISTS `F`; +CREATE TABLE `F` ( + `ID` varchar(50) NOT NULL, + `F_Libelle` varchar(50) default NULL, + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Dumping data for table `F` +-- + +INSERT INTO `F` (`ID`, `F_Libelle`) VALUES ('f', 'fff'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `LineItems` +-- + +DROP TABLE IF EXISTS `LineItems`; +CREATE TABLE `LineItems` ( + `LineItem_Id` int(11) NOT NULL, + `Order_Id` int(11) NOT NULL, + `LineItem_Code` varchar(32) NOT NULL, + `LineItem_Quantity` int(11) NOT NULL, + `LineItem_Price` decimal(18,2) default NULL, + `LineItem_Picture` blob, + PRIMARY KEY (`Order_Id`,`LineItem_Id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Dumping data for table `LineItems` +-- + +INSERT INTO `LineItems` (`LineItem_Id`, `Order_Id`, `LineItem_Code`, `LineItem_Quantity`, `LineItem_Price`, `LineItem_Picture`) VALUES (1, 1, 'ESM-48', 8, 87.60, NULL), +(2, 1, 'ESM-23', 1, 55.40, NULL), +(1, 2, 'DSM-37', 4, 7.80, NULL), +(2, 2, 'FSM-12', 2, 55.78, NULL), +(1, 3, 'DSM-59', 3, 5.70, NULL), +(2, 3, 'DSM-53', 3, 98.78, NULL), +(1, 4, 'RSM-57', 2, 78.90, NULL), +(2, 4, 'XSM-78', 9, 2.34, NULL), +(1, 5, 'ESM-48', 3, 43.87, NULL), +(2, 5, 'WSM-98', 7, 5.40, NULL), +(1, 6, 'QSM-39', 9, 12.12, NULL), +(2, 6, 'ASM-45', 6, 78.77, NULL), +(1, 7, 'WSM-27', 7, 52.10, NULL), +(2, 7, 'ESM-23', 2, 123.34, NULL), +(1, 8, 'DSM-16', 4, 41.30, NULL), +(2, 8, 'GSM-65', 1, 2.20, NULL), +(1, 9, 'DSM-78', 2, 45.40, NULL), +(2, 9, 'TSM-12', 2, 32.12, NULL), +(1, 10, 'ESM-34', 1, 45.43, NULL), +(2, 10, 'QSM-98', 8, 8.40, NULL); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `Orders` +-- + +DROP TABLE IF EXISTS `Orders`; +CREATE TABLE `Orders` ( + `Order_Id` int(11) NOT NULL, + `Account_Id` int(11) default NULL, + `Order_Date` datetime default NULL, + `Order_CardType` varchar(32) default NULL, + `Order_CardNumber` varchar(32) default NULL, + `Order_CardExpiry` varchar(32) default NULL, + `Order_Street` varchar(32) default NULL, + `Order_City` varchar(32) default NULL, + `Order_Province` varchar(32) default NULL, + `Order_PostalCode` varchar(32) default NULL, + `Order_FavouriteLineItem` int(11) default NULL, + PRIMARY KEY (`Order_Id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Dumping data for table `Orders` +-- + +INSERT INTO `Orders` (`Order_Id`, `Account_Id`, `Order_Date`, `Order_CardType`, `Order_CardNumber`, `Order_CardExpiry`, `Order_Street`, `Order_City`, `Order_Province`, `Order_PostalCode`, `Order_FavouriteLineItem`) VALUES (1, 1, '2003-02-15 08:15:00', 'VISA', '999999999999', '05/03', '11 This Street', 'Victoria', 'BC', 'C4B 4F4', 2), +(2, 4, '2003-02-15 08:15:00', 'MC', '888888888888', '06/03', '222 That Street', 'Edmonton', 'AB', 'X4K 5Y4', 1), +(3, 3, '2003-02-15 08:15:00', 'AMEX', '777777777777', '07/03', '333 Other Street', 'Regina', 'SK', 'Z4U 6Y4', 2), +(4, 2, '2003-02-15 08:15:00', 'MC', '666666666666', '08/03', '444 His Street', 'Toronto', 'ON', 'K4U 3S4', 1), +(5, 5, '2003-02-15 08:15:00', 'VISA', '555555555555', '09/03', '555 Her Street', 'Calgary', 'AB', 'J4J 7S4', 2), +(6, 5, '2003-02-15 08:15:00', 'VISA', '999999999999', '10/03', '6 Their Street', 'Victoria', 'BC', 'T4H 9G4', 1), +(7, 4, '2003-02-15 08:15:00', 'MC', '888888888888', '11/03', '77 Lucky Street', 'Edmonton', 'AB', 'R4A 0Z4', 2), +(8, 3, '2003-02-15 08:15:00', 'AMEX', '777777777777', '12/03', '888 Our Street', 'Regina', 'SK', 'S4S 7G4', 1), +(9, 2, '2003-02-15 08:15:00', 'MC', '666666666666', '01/04', '999 Your Street', 'Toronto', 'ON', 'G4D 9F4', 2), +(10, 1, '2003-02-15 08:15:00', 'VISA', '555555555555', '02/04', '99 Some Street', 'Calgary', 'AB', 'W4G 7A4', 1), +(11, NULL, '2003-02-15 08:15:00', 'VISA', '555555555555', '02/04', 'Null order', 'Calgary', 'ZZ', 'XXX YYY', 1); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `Others` +-- + +DROP TABLE IF EXISTS `Others`; +CREATE TABLE `Others` ( + `Other_Int` int(11) default NULL, + `Other_Long` bigint(20) default NULL, + `Other_Bit` bit(1) NOT NULL default '\0', + `Other_String` varchar(32) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Dumping data for table `Others` +-- + +INSERT INTO `Others` (`Other_Int`, `Other_Long`, `Other_Bit`, `Other_String`) VALUES (1, 8888888, '\0', 'Oui'), +(2, 9999999999, '', 'Non'), +(99, 1966, '', 'Non'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `Users` +-- + +DROP TABLE IF EXISTS `Users`; +CREATE TABLE `Users` ( + `LogonId` varchar(20) NOT NULL default '0', + `Name` varchar(40) default NULL, + `Password` varchar(20) default NULL, + `EmailAddress` varchar(40) default NULL, + `LastLogon` datetime default NULL, + PRIMARY KEY (`LogonId`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Dumping data for table `Users` +-- + + +-- +-- Constraints for dumped tables +-- + +-- +-- Constraints for table `A` +-- +ALTER TABLE `A` + ADD CONSTRAINT `FK_A_B` FOREIGN KEY (`B_ID`) REFERENCES `B` (`ID`), + ADD CONSTRAINT `FK_A_E` FOREIGN KEY (`E_ID`) REFERENCES `E` (`ID`), + ADD CONSTRAINT `FK_A_F` FOREIGN KEY (`F_ID`) REFERENCES `F` (`ID`); + +-- +-- Constraints for table `B` +-- +ALTER TABLE `B` + ADD CONSTRAINT `FK_B_C` FOREIGN KEY (`C_ID`) REFERENCES `C` (`ID`), + ADD CONSTRAINT `FK_B_D` FOREIGN KEY (`D_ID`) REFERENCES `D` (`ID`); diff --git a/tests/unit/Data/SqlMap/scripts/mysql/account-init.sql b/tests/unit/Data/SqlMap/scripts/mysql/account-init.sql new file mode 100644 index 00000000..6b102597 --- /dev/null +++ b/tests/unit/Data/SqlMap/scripts/mysql/account-init.sql @@ -0,0 +1,7 @@ +TRUNCATE `Accounts`; + +INSERT INTO Accounts VALUES(1,'Joe', 'Dalton', 'Joe.Dalton@somewhere.com', 'Oui', 200); +INSERT INTO Accounts VALUES(2,'Averel', 'Dalton', 'Averel.Dalton@somewhere.com', 'Oui', 200); +INSERT INTO Accounts VALUES(3,'William', 'Dalton', null, 'Non', 100); +INSERT INTO Accounts VALUES(4,'Jack', 'Dalton', 'Jack.Dalton@somewhere.com', 'Non', 100); +INSERT INTO Accounts VALUES(5,'Gilles', 'Bayon', null, 'Oui', 100);
\ No newline at end of file diff --git a/tests/unit/Data/SqlMap/scripts/mysql/account-procedure.sql b/tests/unit/Data/SqlMap/scripts/mysql/account-procedure.sql new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/tests/unit/Data/SqlMap/scripts/mysql/account-procedure.sql @@ -0,0 +1 @@ + diff --git a/tests/unit/Data/SqlMap/scripts/mysql/category-init.sql b/tests/unit/Data/SqlMap/scripts/mysql/category-init.sql new file mode 100644 index 00000000..0c2b447f --- /dev/null +++ b/tests/unit/Data/SqlMap/scripts/mysql/category-init.sql @@ -0,0 +1 @@ +TRUNCATE `Categories`; diff --git a/tests/unit/Data/SqlMap/scripts/mysql/category-procedure.sql b/tests/unit/Data/SqlMap/scripts/mysql/category-procedure.sql new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/tests/unit/Data/SqlMap/scripts/mysql/category-procedure.sql diff --git a/tests/unit/Data/SqlMap/scripts/mysql/documents-init.sql b/tests/unit/Data/SqlMap/scripts/mysql/documents-init.sql new file mode 100644 index 00000000..258ae532 --- /dev/null +++ b/tests/unit/Data/SqlMap/scripts/mysql/documents-init.sql @@ -0,0 +1,8 @@ +TRUNCATE `Documents`; + +INSERT INTO Documents VALUES (1, 'The World of Null-A', 'Book', 55, null); +INSERT INTO Documents VALUES (2, 'Le Progres de Lyon', 'Newspaper', null , 'Lyon'); +INSERT INTO Documents VALUES (3, 'Lord of the Rings', 'Book', 3587, null); +INSERT INTO Documents VALUES (4, 'Le Canard enchaine', 'Tabloid', null , 'Paris'); +INSERT INTO Documents VALUES (5, 'Le Monde', 'Broadsheet', null , 'Paris'); +INSERT INTO Documents VALUES (6, 'Foundation', 'Monograph', 557, null); diff --git a/tests/unit/Data/SqlMap/scripts/mysql/enumeration-init.sql b/tests/unit/Data/SqlMap/scripts/mysql/enumeration-init.sql new file mode 100644 index 00000000..4c0a7dee --- /dev/null +++ b/tests/unit/Data/SqlMap/scripts/mysql/enumeration-init.sql @@ -0,0 +1,6 @@ +TRUNCATE `Enumerations`; + +INSERT INTO Enumerations VALUES(1, 1, 1, 128); +INSERT INTO Enumerations VALUES(2, 2, 2, 2048); +INSERT INTO Enumerations VALUES(3, 3, 4, 256); +INSERT INTO Enumerations VALUES(4, 4, 8, null); diff --git a/tests/unit/Data/SqlMap/scripts/mysql/line-item-init.sql b/tests/unit/Data/SqlMap/scripts/mysql/line-item-init.sql new file mode 100644 index 00000000..9a96d525 --- /dev/null +++ b/tests/unit/Data/SqlMap/scripts/mysql/line-item-init.sql @@ -0,0 +1,24 @@ + +TRUNCATE `LineItems`; + +INSERT INTO LineItems VALUES (1, 10, 'ESM-34', 1, 45.43, null); +INSERT INTO LineItems VALUES (2, 10, 'QSM-98', 8, 8.40, null); +INSERT INTO LineItems VALUES (1, 9, 'DSM-78', 2, 45.40, null); +INSERT INTO LineItems VALUES (2, 9, 'TSM-12', 2, 32.12, null); +INSERT INTO LineItems VALUES (1, 8, 'DSM-16', 4, 41.30, null); +INSERT INTO LineItems VALUES (2, 8, 'GSM-65', 1, 2.20, null); +INSERT INTO LineItems VALUES (1, 7, 'WSM-27', 7, 52.10, null); +INSERT INTO LineItems VALUES (2, 7, 'ESM-23', 2, 123.34, null); +INSERT INTO LineItems VALUES (1, 6, 'QSM-39', 9, 12.12, null); +INSERT INTO LineItems VALUES (2, 6, 'ASM-45', 6, 78.77, null); +INSERT INTO LineItems VALUES (1, 5, 'ESM-48', 3, 43.87, null); +INSERT INTO LineItems VALUES (2, 5, 'WSM-98', 7, 5.40, null); +INSERT INTO LineItems VALUES (1, 4, 'RSM-57', 2, 78.90, null); +INSERT INTO LineItems VALUES (2, 4, 'XSM-78', 9, 2.34, null); +INSERT INTO LineItems VALUES (1, 3, 'DSM-59', 3, 5.70, null); +INSERT INTO LineItems VALUES (2, 3, 'DSM-53', 3, 98.78, null); +INSERT INTO LineItems VALUES (1, 2, 'DSM-37', 4, 7.80, null); +INSERT INTO LineItems VALUES (2, 2, 'FSM-12', 2, 55.78, null); +INSERT INTO LineItems VALUES (1, 1, 'ESM-48', 8, 87.60, null); +INSERT INTO LineItems VALUES (2, 1, 'ESM-23', 1, 55.40, null); + diff --git a/tests/unit/Data/SqlMap/scripts/mysql/more-account-records.sql b/tests/unit/Data/SqlMap/scripts/mysql/more-account-records.sql new file mode 100644 index 00000000..de33a256 --- /dev/null +++ b/tests/unit/Data/SqlMap/scripts/mysql/more-account-records.sql @@ -0,0 +1,7 @@ + +INSERT INTO Accounts VALUES(6,'Jane', 'Calamity', 'Jane.Calamity@somewhere.com', 'Oui', 200); +INSERT INTO Accounts VALUES(7,'Lucky', 'Luke', 'Lucky.Luke@somewhere.com', 'Oui', 200); +INSERT INTO Accounts VALUES(8,'Ming', 'Li Foo', null, 'Non', 100); +INSERT INTO Accounts VALUES(9,'O''Hara', 'Steve', 'Jack.OHara@somewhere.com', 'Oui', 200); +INSERT INTO Accounts VALUES(10,'Robert', 'O''Timmins', null, 'Non', 100); + diff --git a/tests/unit/Data/SqlMap/scripts/mysql/order-init.sql b/tests/unit/Data/SqlMap/scripts/mysql/order-init.sql new file mode 100644 index 00000000..2af33cb2 --- /dev/null +++ b/tests/unit/Data/SqlMap/scripts/mysql/order-init.sql @@ -0,0 +1,15 @@ +TRUNCATE `Orders`; + + +INSERT INTO Orders VALUES (1, 1, '2003-02-15 8:15:00', 'VISA', '999999999999', '05/03', '11 This Street', 'Victoria', 'BC', 'C4B 4F4',2); +INSERT INTO Orders VALUES (2, 4, '2003-02-15 8:15:00', 'MC', '888888888888', '06/03', '222 That Street', 'Edmonton', 'AB', 'X4K 5Y4',1); +INSERT INTO Orders VALUES (3, 3, '2003-02-15 8:15:00', 'AMEX', '777777777777', '07/03', '333 Other Street', 'Regina', 'SK', 'Z4U 6Y4',2); +INSERT INTO Orders VALUES (4, 2, '2003-02-15 8:15:00', 'MC', '666666666666', '08/03', '444 His Street', 'Toronto', 'ON', 'K4U 3S4',1); +INSERT INTO Orders VALUES (5, 5, '2003-02-15 8:15:00', 'VISA', '555555555555', '09/03', '555 Her Street', 'Calgary', 'AB', 'J4J 7S4',2); +INSERT INTO Orders VALUES (6, 5, '2003-02-15 8:15:00', 'VISA', '999999999999', '10/03', '6 Their Street', 'Victoria', 'BC', 'T4H 9G4',1); +INSERT INTO Orders VALUES (7, 4, '2003-02-15 8:15:00', 'MC', '888888888888', '11/03', '77 Lucky Street', 'Edmonton', 'AB', 'R4A 0Z4',2); +INSERT INTO Orders VALUES (8, 3, '2003-02-15 8:15:00', 'AMEX', '777777777777', '12/03', '888 Our Street', 'Regina', 'SK', 'S4S 7G4',1); +INSERT INTO Orders VALUES (9, 2, '2003-02-15 8:15:00', 'MC', '666666666666', '01/04', '999 Your Street', 'Toronto', 'ON', 'G4D 9F4',2); +INSERT INTO Orders VALUES (10, 1, '2003-02-15 8:15:00', 'VISA', '555555555555', '02/04', '99 Some Street', 'Calgary', 'AB', 'W4G 7A4',1); +INSERT INTO Orders VALUES (11, null, '2003-02-15 8:15:00', 'VISA', '555555555555', '02/04', 'Null order', 'Calgary', 'ZZ', 'XXX YYY',1); + diff --git a/tests/unit/Data/SqlMap/scripts/mysql/other-init.sql b/tests/unit/Data/SqlMap/scripts/mysql/other-init.sql new file mode 100644 index 00000000..409de6d3 --- /dev/null +++ b/tests/unit/Data/SqlMap/scripts/mysql/other-init.sql @@ -0,0 +1,18 @@ + +TRUNCATE `Others`; +TRUNCATE `A`; +TRUNCATE `B`; +TRUNCATE `C`; +TRUNCATE `D`; +TRUNCATE `E`; +TRUNCATE `F`; + +INSERT INTO Others VALUES(1, 8888888, 0, 'Oui'); +INSERT INTO Others VALUES(2, 9999999999, 1, 'Non'); + +INSERT INTO F VALUES('f', 'fff'); +INSERT INTO E VALUES('e', 'eee'); +INSERT INTO D VALUES('d', 'ddd'); +INSERT INTO C VALUES('c', 'ccc'); +INSERT INTO B VALUES('b', 'c', null, 'bbb'); +INSERT INTO A VALUES('a', 'b', 'e', null, 'aaa');
\ No newline at end of file diff --git a/tests/unit/Data/SqlMap/scripts/mysql/swap-procedure.sql b/tests/unit/Data/SqlMap/scripts/mysql/swap-procedure.sql new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/tests/unit/Data/SqlMap/scripts/mysql/swap-procedure.sql diff --git a/tests/unit/Data/SqlMap/scripts/mysql/user-init.sql b/tests/unit/Data/SqlMap/scripts/mysql/user-init.sql new file mode 100644 index 00000000..fe9c0c67 --- /dev/null +++ b/tests/unit/Data/SqlMap/scripts/mysql/user-init.sql @@ -0,0 +1,2 @@ + +TRUNCATE `users`; diff --git a/tests/unit/Data/SqlMap/scripts/sqlite/database.sql b/tests/unit/Data/SqlMap/scripts/sqlite/database.sql new file mode 100644 index 00000000..6bef6f4c --- /dev/null +++ b/tests/unit/Data/SqlMap/scripts/sqlite/database.sql @@ -0,0 +1,242 @@ +# +# : A +# +DROP TABLE A; + +CREATE TABLE A +( + ID VARCHAR(50) NOT NULL PRIMARY KEY, + B_ID VARCHAR(50), + E_ID VARCHAR(50), + F_ID VARCHAR(50), + A_Libelle VARCHAR(50) +); + +INSERT INTO A VALUES ('a', 'b', 'e', NULL, 'aaa'); + + +# +# : Accounts +# +DROP TABLE Accounts; +CREATE TABLE Accounts +( + Account_Id INTEGER NOT NULL PRIMARY KEY, + Account_FirstName VARCHAR(32) NOT NULL, + Account_LastName VARCHAR(32) NOT NULL, + Account_Email VARCHAR(128), + Account_Banner_Option VARCHAR(255), + Account_Cart_Option INT +); + +INSERT INTO Accounts VALUES ('1', 'Joe', 'Dalton', 'Joe.Dalton@somewhere.com', 'Oui', '200'); +INSERT INTO Accounts VALUES ('2', 'Averel', 'Dalton', 'Averel.Dalton@somewhere.com', 'Oui', '200'); +INSERT INTO Accounts VALUES ('3', 'William', 'Dalton', NULL, 'Non', '100'); +INSERT INTO Accounts VALUES ('4', 'Jack', 'Dalton', 'Jack.Dalton@somewhere.com', 'Non', '100'); +INSERT INTO Accounts VALUES ('5', 'Gilles', 'Bayon', NULL, 'Oui', '100'); + + +# +# : B +# +DROP TABLE B; +CREATE TABLE B +( + ID VARCHAR(50) NOT NULL PRIMARY KEY, + C_ID VARCHAR(50), + D_ID VARCHAR(50), + B_Libelle VARCHAR(50) +); + +INSERT INTO B VALUES ('b', 'c', NULL, 'bbb'); + + +# +# : C +# +DROP TABLE C; +CREATE TABLE C +( + ID VARCHAR(50) NOT NULL PRIMARY KEY, + C_Libelle VARCHAR(50) +); + +INSERT INTO C VALUES ('c', 'ccc'); + + +# +# : Categories +# +DROP TABLE Categories; +create table Categories +( + Category_Id INTEGER NOT NULL PRIMARY KEY, + Category_Name varchar(32), + Category_Guid varchar(36) +); + + +# +# : D +# +DROP TABLE D; +CREATE TABLE D +( + ID VARCHAR(50) NOT NULL PRIMARY KEY, + D_Libelle VARCHAR(50) +); + +INSERT INTO D VALUES ('d', 'ddd'); + + +# +# : Documents +# +DROP TABLE Documents; +CREATE TABLE Documents +( + Document_Id INT NOT NULL PRIMARY KEY, + Document_Title VARCHAR(32), + Document_Type VARCHAR(32), + Document_PageNumber INT, + Document_City VARCHAR(32) +); + +INSERT INTO Documents VALUES ('1', 'The World of Null-A', 'Book', '55', NULL); +INSERT INTO Documents VALUES ('2', 'Le Progres de Lyon', 'Newspaper', NULL, 'Lyon'); +INSERT INTO Documents VALUES ('3', 'Lord of the Rings', 'Book', '3587', NULL); +INSERT INTO Documents VALUES ('4', 'Le Canard enchaine', 'Tabloid', NULL, 'Paris'); +INSERT INTO Documents VALUES ('5', 'Le Monde', 'Broadsheet', NULL, 'Paris'); +INSERT INTO Documents VALUES ('6', 'Foundation', 'Monograph', '557', NULL); + + +# +# : E +# +DROP TABLE E; +CREATE TABLE E +( + ID VARCHAR(50) NOT NULL PRIMARY KEY, + E_Libelle VARCHAR(50) +); + + +INSERT INTO E VALUES ('e', 'eee'); + + +# +# : Enumerations +# +DROP TABLE Enumerations; +create table Enumerations +( + Enum_Id int not null, + Enum_Day int not null, + Enum_Color int not null, + Enum_Month int +); + + +INSERT INTO Enumerations VALUES ('1', '1', '1', '128'); +INSERT INTO Enumerations VALUES ('2', '2', '2', '2048'); +INSERT INTO Enumerations VALUES ('3', '3', '4', '256'); +INSERT INTO Enumerations VALUES ('4', '4', '8', NULL); + + +# +# : F +# +DROP TABLE F; +CREATE TABLE F +( + ID VARCHAR(50) NOT NULL PRIMARY KEY, + F_Libelle VARCHAR(50) +); + +INSERT INTO F VALUES ('f', 'fff'); + + +# +# : LineItems +# +DROP TABLE LineItems; +CREATE TABLE LineItems +( + LineItem_Id INTEGER NOT NULL, + Order_Id INT NOT NULL, + LineItem_Code VARCHAR(32) NOT NULL, + LineItem_Quantity INT NOT NULL, + LineItem_Price DECIMAL(18,2), + LineItem_Picture BLOB +); + + +INSERT INTO LineItems VALUES ('1', '10', 'ESM-34', '1', '45.43', NULL); +INSERT INTO LineItems VALUES ('2', '10', 'QSM-98', '8', '8.40', NULL); +INSERT INTO LineItems VALUES ('1', '9', 'DSM-78', '2', '45.40', NULL); +INSERT INTO LineItems VALUES ('2', '9', 'TSM-12', '2', '32.12', NULL); +INSERT INTO LineItems VALUES ('1', '8', 'DSM-16', '4', '41.30', NULL); +INSERT INTO LineItems VALUES ('2', '8', 'GSM-65', '1', '2.20', NULL); +INSERT INTO LineItems VALUES ('1', '7', 'WSM-27', '7', '52.10', NULL); +INSERT INTO LineItems VALUES ('2', '7', 'ESM-23', '2', '123.34', NULL); +INSERT INTO LineItems VALUES ('1', '6', 'QSM-39', '9', '12.12', NULL); +INSERT INTO LineItems VALUES ('2', '6', 'ASM-45', '6', '78.77', NULL); +INSERT INTO LineItems VALUES ('1', '5', 'ESM-48', '3', '43.87', NULL); +INSERT INTO LineItems VALUES ('2', '5', 'WSM-98', '7', '5.40', NULL); +INSERT INTO LineItems VALUES ('1', '4', 'RSM-57', '2', '78.90', NULL); +INSERT INTO LineItems VALUES ('2', '4', 'XSM-78', '9', '2.34', NULL); +INSERT INTO LineItems VALUES ('1', '3', 'DSM-59', '3', '5.70', NULL); +INSERT INTO LineItems VALUES ('2', '3', 'DSM-53', '3', '98.78', NULL); +INSERT INTO LineItems VALUES ('1', '2', 'DSM-37', '4', '7.80', NULL); +INSERT INTO LineItems VALUES ('2', '2', 'FSM-12', '2', '55.78', NULL); +INSERT INTO LineItems VALUES ('1', '1', 'ESM-48', '8', '87.60', NULL); +INSERT INTO LineItems VALUES ('2', '1', 'ESM-23', '1', '55.40', NULL); + + +# +# : Orders +# +DROP TABLE Orders; +CREATE TABLE Orders +( + Order_Id INTEGER NOT NULL PRIMARY KEY, + Account_Id INT, + Order_Date DATETIME, + Order_CardType VARCHAR(32), + Order_CardNumber VARCHAR(32), + Order_CardExpiry VARCHAR(32), + Order_Street VARCHAR(32), + Order_City VARCHAR(32), + Order_Province VARCHAR(32), + Order_PostalCode VARCHAR(32), + Order_FavouriteLineItem INT +); + +INSERT INTO Orders VALUES ('1', '1', '2003-02-15 8:15:00', 'VISA', '999999999999', '05/03', '11 This Street', 'Victoria', 'BC', 'C4B 4F4', '2'); +INSERT INTO Orders VALUES ('2', '4', '2003-02-15 8:15:00', 'MC', '888888888888', '06/03', '222 That Street', 'Edmonton', 'AB', 'X4K 5Y4', '1'); +INSERT INTO Orders VALUES ('3', '3', '2003-02-15 8:15:00', 'AMEX', '777777777777', '07/03', '333 Other Street', 'Regina', 'SK', 'Z4U 6Y4', '2'); +INSERT INTO Orders VALUES ('4', '2', '2003-02-15 8:15:00', 'MC', '666666666666', '08/03', '444 His Street', 'Toronto', 'ON', 'K4U 3S4', '1'); +INSERT INTO Orders VALUES ('5', '5', '2003-02-15 8:15:00', 'VISA', '555555555555', '09/03', '555 Her Street', 'Calgary', 'AB', 'J4J 7S4', '2'); +INSERT INTO Orders VALUES ('6', '5', '2003-02-15 8:15:00', 'VISA', '999999999999', '10/03', '6 Their Street', 'Victoria', 'BC', 'T4H 9G4', '1'); +INSERT INTO Orders VALUES ('7', '4', '2003-02-15 8:15:00', 'MC', '888888888888', '11/03', '77 Lucky Street', 'Edmonton', 'AB', 'R4A 0Z4', '2'); +INSERT INTO Orders VALUES ('8', '3', '2003-02-15 8:15:00', 'AMEX', '777777777777', '12/03', '888 Our Street', 'Regina', 'SK', 'S4S 7G4', '1'); +INSERT INTO Orders VALUES ('9', '2', '2003-02-15 8:15:00', 'MC', '666666666666', '01/04', '999 Your Street', 'Toronto', 'ON', 'G4D 9F4', '2'); +INSERT INTO Orders VALUES ('10', '1', '2003-02-15 8:15:00', 'VISA', '555555555555', '02/04', '99 Some Street', 'Calgary', 'AB', 'W4G 7A4', '1'); +INSERT INTO Orders VALUES ('11', NULL, '2003-02-15 8:15:00', 'VISA', '555555555555', '02/04', 'Null order', 'Calgary', 'ZZ', 'XXX YYY', '1'); + + +# +# : Others +# +DROP TABLE Others; +create table Others +( + Other_Int int, + Other_Long bigint, + Other_Bit bit not null default 0, + Other_String varchar(32) not null +); + +INSERT INTO Others VALUES ('1', '8888888', '0', 'Oui'); +INSERT INTO Others VALUES ('2', '9999999999', '1', 'Non'); + |