2017-05-04 19:16:29 +03:00
|
|
|
--TEST--
|
|
|
|
Extended ASCII column name with UTF8 w/o BOM file encoding
|
|
|
|
--SKIPIF--
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
|
2017-10-05 00:22:56 +03:00
|
|
|
require_once("MsCommon.inc");
|
2017-05-04 19:16:29 +03:00
|
|
|
$tableName = "UnicodeColNameTest";
|
|
|
|
|
2017-10-05 00:22:56 +03:00
|
|
|
$conn = connect(array( 'CharacterSet'=>'UTF-8' ));
|
2017-05-04 19:16:29 +03:00
|
|
|
|
|
|
|
$tableName = "UnicodeColNameTest";
|
|
|
|
|
2017-10-05 00:22:56 +03:00
|
|
|
dropTable($conn, $tableName);
|
2017-05-04 19:16:29 +03:00
|
|
|
|
|
|
|
// Column names array
|
|
|
|
$colName = ['C1', "C2", "C3"]; // WORKING REFERENCE
|
2017-10-05 00:22:56 +03:00
|
|
|
$colName = ["C1Ð", "CÐÐÆØ", str_repeat("CÐÆØ", 32)];
|
2017-05-04 19:16:29 +03:00
|
|
|
|
|
|
|
// Create table
|
|
|
|
$stmt = sqlsrv_query($conn, "create table ".$tableName
|
2017-10-05 00:22:56 +03:00
|
|
|
." ($colName[0] VARCHAR(10), $colName[1] VARCHAR(20), $colName[2] INT)");
|
|
|
|
if ($stmt === false) {
|
|
|
|
die(print_r(sqlsrv_errors(), true));
|
|
|
|
}
|
2017-05-04 19:16:29 +03:00
|
|
|
|
|
|
|
// Prepare the statement
|
|
|
|
$query = "SELECT * FROM ".$tableName;
|
|
|
|
$stmt = sqlsrv_prepare($conn, $query);
|
|
|
|
|
|
|
|
// Get field metadata
|
2017-10-05 00:22:56 +03:00
|
|
|
foreach (sqlsrv_field_metadata($stmt) as $fieldMetadata) {
|
|
|
|
$res = $fieldMetadata;
|
|
|
|
var_dump($res['Name']);
|
2017-05-04 19:16:29 +03:00
|
|
|
}
|
2017-10-05 00:22:56 +03:00
|
|
|
dropTable($conn, $tableName);
|
2017-05-04 19:16:29 +03:00
|
|
|
// Close connection
|
2017-10-05 00:22:56 +03:00
|
|
|
sqlsrv_free_stmt($stmt);
|
2017-05-04 19:16:29 +03:00
|
|
|
sqlsrv_close($conn);
|
|
|
|
print "Done";
|
|
|
|
?>
|
|
|
|
|
|
|
|
--EXPECT--
|
|
|
|
string(4) "C1Ð"
|
|
|
|
string(9) "CÐÐÆØ"
|
|
|
|
string(224) "CÐÆØCÐÆØCÐÆØCÐÆØCÐÆØCÐÆØCÐÆØCÐÆØCÐÆØCÐÆØCÐÆØCÐÆØCÐÆØCÐÆØCÐÆØCÐÆØCÐÆØCÐÆØCÐÆØCÐÆØCÐÆØCÐÆØCÐÆØCÐÆØCÐÆØCÐÆØCÐÆØCÐÆØCÐÆØCÐÆØCÐÆØCÐÆØ"
|
|
|
|
Done
|