remove odl MsData.inc

This commit is contained in:
v-kaywon 2017-11-07 12:04:19 -08:00
parent b695cc1655
commit 708a29c45d
3 changed files with 1 additions and 359 deletions

View file

@ -12,7 +12,6 @@
// looks like an additional file (in addition to pdo_test_base.inc) may be needed for these PHPTs
// to be runnable from the MSSQL teams' internal proprietary test running system
//
require 'MsData.inc';
function IsAEQualified($conn)
{
@ -35,9 +34,7 @@ function connect($options=array())
require 'MsSetup.inc';
$conn = new PDO( "sqlsrv:Server=$server;database=$databaseName;ConnectionPooling=false;" , $uid, $pwd, $options);
$conn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
create_and_insert_table1($conn);
create_and_insert_table2($conn);
return $conn;
return $conn;
}
catch( PDOException $e )
@ -447,155 +444,6 @@ function is_col_enc()
return true;
}
// Create and insert
function create_and_insert_table1( $conn )
{
global $string_col, $date_col, $large_string_col, $xml_col, $binary_col, $int_col, $decimal_col, $guid_col, $null_col, $comma, $closing_brace, $table1;
try
{
$create_query =
"IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'" . $table1 . "') AND type in (N'U'))
DROP TABLE " . $table1 .
" CREATE TABLE [dbo].[" . $table1 . "](
[IntCol] [int] NULL,
[CharCol] [char](10) NULL,
[NCharCol] [nchar](10) NULL,
[DateTimeCol] [datetime] NULL,
[VarcharCol] [varchar](50) NULL,
[NVarCharCol] [nvarchar](50) NULL,
[FloatCol] [float] NULL,
[XmlCol] [xml] NULL
) ON [PRIMARY]
";
$conn->query( $create_query );
for ($i = 0 ; $i <= 1; ++ $i)
{
$insert_query =
"INSERT INTO PDO_Types_1 VALUES (".
$int_col[$i] . $comma .
$string_col[$i] . $comma .
$string_col[$i] . $comma .
"Convert(datetime, ". $date_col[$i] . ")" . $comma .
$string_col[$i] . $comma .
$string_col[$i] . $comma .
$decimal_col[$i] . $comma .
$xml_col[$i] .
")";
$conn->query ( $insert_query );
}
}
catch(Exception $e)
{
var_dump( $e);
exit;
}
}
function create_and_insert_table2( $conn )
{
try
{
//Timestamp is not present.
//VARIANT is not supported.
global $string_col, $date_col, $large_string_col, $xml_col, $binary_col, $int_col, $decimal_col, $guid_col, $null_col, $comma, $closing_brace, $table1, $table2;
$create_query =
"IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'".$table2."') AND type in (N'U')) DROP TABLE " . $table2 .
" CREATE TABLE " .$table2 . " (
[BigIntCol] [bigint] NULL,
[BinaryCol] [binary](5) NULL,
[BitCol] [bit] NULL,
[CharCol] [char](10) NULL,
[DateCol] [date] NULL,
[DateTimeCol] [datetime] NULL,
[DateTime2Col] [datetime2](7) NULL,
[DTOffsetCol] [datetimeoffset](7) NULL,
[DecimalCol] [decimal](18, 0) NULL,
[FloatCol] [float] NULL,
[ImageCol] [image] NULL,
[IntCol] [int] NULL,
[MoneyCol] [money] NULL,
[NCharCol] [nchar](10) NULL,
[NTextCol] [ntext] NULL,
[NumCol] [numeric](18, 0) NULL,
[NVarCharCol] [nvarchar](50) NULL,
[NVarCharMaxCol] [nvarchar](max) NULL,
[RealCol] [real] NULL,
[SmallDTCol] [smalldatetime] NULL,
[SmallIntCol] [smallint] NULL,
[SmallMoneyCol] [smallmoney] NULL,
[TextCol] [text] NULL,
[TimeCol] [time](7) NULL,
[TinyIntCol] [tinyint] NULL,
[Guidcol] [uniqueidentifier] NULL,
[VarbinaryCol] [varbinary](50) NULL,
[VarbinaryMaxCol] [varbinary](max) NULL,
[VarcharCol] [varchar](50) NULL,
[VarcharMaxCol] [varchar](max) NULL,
[XmlCol] [xml] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
";
$stmt = $conn->query( $create_query );
for ($i =0; $i<= 0 ; ++ $i)
{
$insert_query =
" INSERT INTO " .$table2 . " VALUES (".
$int_col[$i] . $comma .
$binary_col[$i] . $comma .
"0" . $comma .
$string_col[$i] . $comma .
"Convert(date, ". $date_col[$i] . $closing_brace .
"Convert(datetime, ". $date_col[$i] . $closing_brace .
"Convert(datetime2(7),". $date_col[$i] . $closing_brace .
"Convert(datetimeoffset(7)," . $date_col[$i] . $closing_brace .
$decimal_col[$i] . $comma .
$decimal_col[$i] .$comma .
$binary_col[$i] . $comma .
$int_col[$i] . $comma .
$decimal_col[$i] . $comma .
$string_col[$i]. $comma .
$large_string_col[$i]. $comma.
$int_col[$i]. $comma .
$string_col[$i]. $comma .
$large_string_col[$i]. $comma .
$decimal_col[$i]. $comma .
"Convert(smalldatetime, ". $date_col[$i]. $closing_brace .
$int_col[$i]. $comma .
$decimal_col[$i]. $comma .
$large_string_col[$i]. $comma .
"Convert(time(7), ". $date_col[$i] . $closing_brace .
$int_col[$i] . $comma .
$guid_col[$i] . $comma .
$binary_col[$i] . $comma .
$binary_col[$i] . $comma .
$string_col[$i] . $comma .
$large_string_col[$i] . $comma .
$xml_col[$i] .
")";
$stmt = $conn->query ($insert_query );
}
}
catch(Exception $e)
{
var_dump( $e);
exit;
}
}
function teardown()
{
// TBD

View file

@ -12,7 +12,6 @@
// looks like an additional file (in addition to pdo_test_base.inc) may be needed for these PHPTs
// to be runnable from the MSSQL teams' internal proprietary test running system
//
require 'MsData.inc';
function isAEQualified($conn)
{
@ -524,146 +523,6 @@ function isColEncrypted()
}
}
// Create and insert
function create_and_insert_table1($conn)
{
global $string_col, $date_col, $large_string_col, $xml_col, $binary_col, $int_col, $decimal_col, $guid_col, $null_col, $comma, $closing_brace, $table1;
try {
$create_query =
"IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'" . $table1 . "') AND type in (N'U'))
DROP TABLE " . $table1 .
" CREATE TABLE [dbo].[" . $table1 . "](
[IntCol] [int] NULL,
[CharCol] [char](10) NULL,
[NCharCol] [nchar](10) NULL,
[DateTimeCol] [datetime] NULL,
[VarcharCol] [varchar](50) NULL,
[NVarCharCol] [nvarchar](50) NULL,
[FloatCol] [float] NULL,
[XmlCol] [xml] NULL
) ON [PRIMARY]
";
$conn->query($create_query);
for ($i = 0 ; $i <= 1; ++ $i) {
$insert_query =
"INSERT INTO PDO_Types_1 VALUES (".
$int_col[$i] . $comma .
$string_col[$i] . $comma .
$string_col[$i] . $comma .
"Convert(datetime, ". $date_col[$i] . ")" . $comma .
$string_col[$i] . $comma .
$string_col[$i] . $comma .
$decimal_col[$i] . $comma .
$xml_col[$i] .
")";
$conn->query($insert_query);
}
} catch (Exception $e) {
var_dump($e);
exit;
}
}
function create_and_insert_table2($conn)
{
try {
//Timestamp is not present.
//VARIANT is not supported.
global $string_col, $date_col, $large_string_col, $xml_col, $binary_col, $int_col, $decimal_col, $guid_col, $null_col, $comma, $closing_brace, $table1, $table2;
$create_query =
"IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'".$table2."') AND type in (N'U')) DROP TABLE " . $table2 .
" CREATE TABLE " .$table2 . " (
[BigIntCol] [bigint] NULL,
[BinaryCol] [binary](5) NULL,
[BitCol] [bit] NULL,
[CharCol] [char](10) NULL,
[DateCol] [date] NULL,
[DateTimeCol] [datetime] NULL,
[DateTime2Col] [datetime2](7) NULL,
[DTOffsetCol] [datetimeoffset](7) NULL,
[DecimalCol] [decimal](18, 0) NULL,
[FloatCol] [float] NULL,
[ImageCol] [image] NULL,
[IntCol] [int] NULL,
[MoneyCol] [money] NULL,
[NCharCol] [nchar](10) NULL,
[NTextCol] [ntext] NULL,
[NumCol] [numeric](18, 0) NULL,
[NVarCharCol] [nvarchar](50) NULL,
[NVarCharMaxCol] [nvarchar](max) NULL,
[RealCol] [real] NULL,
[SmallDTCol] [smalldatetime] NULL,
[SmallIntCol] [smallint] NULL,
[SmallMoneyCol] [smallmoney] NULL,
[TextCol] [text] NULL,
[TimeCol] [time](7) NULL,
[TinyIntCol] [tinyint] NULL,
[Guidcol] [uniqueidentifier] NULL,
[VarbinaryCol] [varbinary](50) NULL,
[VarbinaryMaxCol] [varbinary](max) NULL,
[VarcharCol] [varchar](50) NULL,
[VarcharMaxCol] [varchar](max) NULL,
[XmlCol] [xml] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
";
$stmt = $conn->query($create_query);
for ($i =0; $i<= 0 ; ++ $i) {
$insert_query =
" INSERT INTO " .$table2 . " VALUES (".
$int_col[$i] . $comma .
$binary_col[$i] . $comma .
"0" . $comma .
$string_col[$i] . $comma .
"Convert(date, ". $date_col[$i] . $closing_brace .
"Convert(datetime, ". $date_col[$i] . $closing_brace .
"Convert(datetime2(7),". $date_col[$i] . $closing_brace .
"Convert(datetimeoffset(7)," . $date_col[$i] . $closing_brace .
$decimal_col[$i] . $comma .
$decimal_col[$i] .$comma .
$binary_col[$i] . $comma .
$int_col[$i] . $comma .
$decimal_col[$i] . $comma .
$string_col[$i]. $comma .
$large_string_col[$i]. $comma.
$int_col[$i]. $comma .
$string_col[$i]. $comma .
$large_string_col[$i]. $comma .
$decimal_col[$i]. $comma .
"Convert(smalldatetime, ". $date_col[$i]. $closing_brace .
$int_col[$i]. $comma .
$decimal_col[$i]. $comma .
$large_string_col[$i]. $comma .
"Convert(time(7), ". $date_col[$i] . $closing_brace .
$int_col[$i] . $comma .
$guid_col[$i] . $comma .
$binary_col[$i] . $comma .
$binary_col[$i] . $comma .
$string_col[$i] . $comma .
$large_string_col[$i] . $comma .
$xml_col[$i] .
")";
$stmt = $conn->query($insert_query);
}
} catch (Exception $e) {
var_dump($e);
exit;
}
}
function teardown()
{
// TBD

View file

@ -1,65 +0,0 @@
<?php
/*
Microsoft SQL Server Driver for PHP - Unit Test Framework
Copyright (c) Microsoft Corporation. All rights reserved.
Description:
Random data generator for INSERT statements.
*/
// globals
$table1 = "PDO_Types_1";
$table2= "PDO_AllTypes";
$large_string = "This is a really large string used to test certain large data types like xml data type. The length of this string is greater than 256 to correctly test a large data type. This is currently used by atleast varchar type and by xml type. The fetch tests are the primary consumer of this string to validate that fetch on large types work fine. The length of this string as counted in terms of number of characters is 417.";
$string_col = array("'STRINGCOL1'", "'STRINGCOL2'");
$date_col = array("'2000-11-11 11:11:11.111'", "'2000-11-11 11:11:11.222'");
$large_string_col = array("' 1 " . $large_string . "'", "' 2 " . $large_string . "'");
$xml_col = array("'<xml> 1 " . $large_string . "</xml>'", "'<xml> 2 " . $large_string . "</xml>'");
$binary_col = array('0x0', '0x0');
$int_col = array ( 1, 2);
$decimal_col = array (111.111, 222.222);
$guid_col = array("'AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA'", "'BBBBBBBB-BBBB-BBBB-BBBB-BBBBBBBBBBBB'");
$null_col = 'null';
$comma = ",";
$closing_brace = "),";
class PDO_Types_1_Class{
var $IntCol;
var $CharCol;
var $NCharCol;
var $DateTimeCol;
var $VarcharCol;
var $NVarCharCol;
var $FloatCol;
var $XmlCol;
function dumpAll()
{
var_dump($this->IntCol);
var_dump($this->CharCol);
var_dump($this->NCharCol);
var_dump($this->DateTimeCol);
var_dump($this->VarcharCol);
var_dump($this->NVarCharCol);
var_dump($this->FloatCol);
var_dump($this->XmlCol);
}
}
$table1_class = 'PDO_Types_1_Class';
?>