コード例 #1
0
ファイル: MySqlDatabase.cs プロジェクト: roji/AdoNetApiTest
        public static void CreateSelectValueTable(IDbFactoryFixture factoryFixture)
        {
            Utility.ExecuteNonQuery(factoryFixture, @"drop table if exists select_value;
create table select_value
(
	Id int not null primary key,
	`Binary` blob,
	Boolean bool,
	Byte tinyint unsigned,
	SByte tinyint,
	Int16 smallint,
	UInt16 smallint unsigned,
	Int32 int,
	UInt32 int unsigned,
	Int64 bigint,
	UInt64 bigint unsigned,
	Single float,
	`Double` double,
	`Decimal` decimal(57,28),
	String text,
	Guid char(36),
	`Date` date,
	`DateTime` datetime(3),
	`Time` time(3)
);
insert into select_value values
(0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null),
(1, X'', null, null, null, null, null, null, null, null, null, null, null, null, '', '', null, null, null),
(2, X'00', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', '00000000-0000-0000-0000-000000000000', null, null, '00:00:00'),
(3, X'11', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, '1', '11111111-1111-1111-1111-111111111111', '1111-11-11', '1111-11-11 11:11:11.111', '11:11:11.111'),
(4, null, false, 0, -128, -32768, 0, -2147483648, 0, -9223372036854775808, 0, 1.18e-38, 2.23e-308, 0.000000000000001, null, '33221100-5544-7766-9988-aabbccddeeff', '1000-01-01', '1000-01-01 00:00:00', '-838:59:59'),
(5, null, true, 255, 127, 32767, 65535, 2147483647, 4294967295, 9223372036854775807, 18446744073709551615, 3.40e38, 1.79e308, 99999999999999999999.999999999999999, null, 'ccddeeff-aabb-8899-7766-554433221100', '9999-12-31', '9999-12-31 23:59:59.999', '838:59:59');
");
        }
コード例 #2
0
        public static void CreateSelectValueTable(IDbFactoryFixture factoryFixture)
        {
            Utility.ExecuteNonQuery(factoryFixture, @"drop table if exists select_value;
create table select_value
(
	Id integer not null primary key,
	""Binary"" bytea,
	""Boolean"" boolean,
	""Date"" date,
	""DateTime"" timestamp,
	""DateTimeOffset"" timestamp with time zone,
	""Decimal"" numeric(57,28),
	""Double"" double precision,
	""Guid"" uuid,
	""Int16"" smallint,
	""Int32"" integer,
	""Int64"" bigint,
	""Single"" real,
	""String"" varchar,
	""Time"" time
);
insert into select_value values
(0, null, null, null, null, null, null, null, null, null, null, null, null, null, null),
(1, E''::bytea, null, null, null, null, null, null, null, null, null, null, null, '', null),
(2, E'\\000'::bytea, false, null, null, null, 0, 0, '00000000-0000-0000-0000-000000000000', 0, 0, 0, 0, '0', '00:00:00'),
(3, E'\\021'::bytea, true, '1111-11-11', '1111-11-11 11:11:11.111', '1111-11-11 11:11:11.111 +11:11', 1, 1, '11111111-1111-1111-1111-111111111111', 1, 1, 1, 1, '1', '11:11:11.111'),
(4, null, false, '0001-01-01', '0001-01-01', '0001-01-01', 0.000000000000001, 2.23e-308, '33221100-5544-7766-9988-aabbccddeeff', -32768, -2147483648, -9223372036854775808, 1.18e-38, null, '00:00:00'),
(5, null, true, '9999-12-31', '9999-12-31 23:59:59.999', '9999-12-31 23:59:59.999 +14:00', 99999999999999999999.999999999999999, 1.79e308, 'ccddeeff-aabb-8899-7766-554433221100', 32767, 2147483647, 9223372036854775807, 3.40e38, null, '23:59:59.999');
");
        }
コード例 #3
0
        public static void CreateSelectValueTable(IDbFactoryFixture factoryFixture)
        {
            Utility.ExecuteNonQuery(factoryFixture, @"drop table if exists select_value;
create table select_value
(
	Id integer not null primary key,
	Binary blob,
	Boolean bool,
	Byte tinyint,
	""DateTime"" datetime,
	""Decimal"" decimal,
	Double real,
	""Guid"" guid,
	Int16 smallint,
	Int32 int,
	Int64 integer,
	""Single"" single,
	String text
);
insert into select_value values
(0, null, null, null, null, null, null, null, null, null, null, null, null),
(1, X'', null, null, null, null, null, null, null, null, null, null, ''),
(2, X'00', 0, 0, null, 0, 0, '00000000-0000-0000-0000-000000000000', 0, 0, 0, 0, '0'),
(3, X'11', 1, 1, '1111-11-11 11:11:11.111', 1, 1, '11111111-1111-1111-1111-111111111111', 1, 1, 1, 1, '1'),
(4, null, 0, 0, '0001-01-01', 0.000000000000001, 2.23e-308, '33221100-5544-7766-9988-aabbccddeeff', -32768, -2147483648, -9223372036854775808, 1.18e-38, null),
(5, null, 1, 255, '9999-12-31 23:59:59.999', 99999999999999999999.999999999999999, 1.79e308, 'ccddeeff-aabb-8899-7766-554433221100', 32767, 2147483647, 9223372036854775807, 3.40e38, null);
");
        }
コード例 #4
0
        public static void CreateSelectValueTable(IDbFactoryFixture factoryFixture)
        {
            Utility.ExecuteNonQuery(factoryFixture, @"drop table if exists select_value;
create table select_value
(
	Id int not null primary key,
	[Binary] varbinary(max),
	Boolean bit,
	Byte tinyint,
	Currency money,
	[Date] date,
	[DateTime] datetime2,
	[DateTimeOffset] datetimeoffset,
	[Decimal] decimal(38,18),
	[Double] float,
	Guid uniqueidentifier,
	Int16 smallint,
	Int32 int,
	Int64 bigint,
	Single real,
	String nvarchar(max),
	[Time] time
);
insert into select_value values
(0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null),
(1, 0x, null, null, null, null, null, null, null, null, null, null, null, null, null, '', null),
(2, 0x00, 0, 0, 0, null, null, null, 0, 0, '00000000-0000-0000-0000-000000000000', 0, 0, 0, 0, '0', '00:00:00'),
(3, 0x11, 1, 1, 1, '1111-11-11', '1111-11-11 11:11:11.111', '1111-11-11 11:11:11.111 +11:11', 1, 1, '11111111-1111-1111-1111-111111111111', 1, 1, 1, 1, '1', '11:11:11.111'),
(4, null, 0, 0, -922337203685477.5808, '0001-01-1', '0001-01-01', '0001-01-01', 0.000000000000001, 2.23e-308, '33221100-5544-7766-9988-aabbccddeeff', -32768, -2147483648, -9223372036854775808, 1.18e-38, null, '00:00:00'),
(5, null, 1, 255, 922337203685477.5807, '9999-12-31', '9999-12-31 23:59:59.999', '9999-12-31 23:59:59.999 +14:00', 99999999999999999999.999999999999999, 1.79e308, 'ccddeeff-aabb-8899-7766-554433221100', 32767, 2147483647, 9223372036854775807, 3.40e38, null, '23:59:59.999');
");
        }
コード例 #5
0
ファイル: Utility.cs プロジェクト: roji/AdoNetApiTest
        public static void ExecuteNonQuery(IDbFactoryFixture factoryFixture, string sql)
        {
            using (var connection = factoryFixture.Factory.CreateConnection())
            {
                connection.ConnectionString = Environment.GetEnvironmentVariable("ConnectionString") ?? factoryFixture.ConnectionString;
                connection.Open();

                using (var command = connection.CreateCommand())
                {
                    command.CommandText = sql;
                    command.ExecuteNonQuery();
                }
            }
        }
コード例 #6
0
ファイル: Utility.cs プロジェクト: Octonica/npgsql
        public static void ExecuteNonQuery(IDbFactoryFixture factoryFixture, string sql)
        {
            using (var connection = factoryFixture.Factory.CreateConnection() !)
            {
                connection.ConnectionString = factoryFixture.ConnectionString;
                connection.Open();

                using (var command = connection.CreateCommand())
                {
                    command.CommandText = sql;
                    command.ExecuteNonQuery();
                }
            }
        }
コード例 #7
0
 public static void DropSelectValueTable(IDbFactoryFixture factoryFixture) => Utility.ExecuteNonQuery(factoryFixture, "drop table if exists select_value;");
コード例 #8
0
 public void DropSelectValueTable(IDbFactoryFixture factoryFixture) => ExecuteNonQuery("drop table if exists select_value;");