msphpsql/test/functional/sqlsrv/srv_066_sqlsrv_field_metada...

48 строки
1.3 KiB
Plaintext
Исходник Обычный вид История

2017-05-04 19:16:29 +03:00
--TEST--
Extended ASCII column name with UTF8 w/o BOM file encoding
--SKIPIF--
--FILE--
<?php
require_once("MsCommon.inc");
2017-05-04 19:16:29 +03:00
$tableName = "UnicodeColNameTest";
$conn = connect(array( 'CharacterSet'=>'UTF-8' ));
2017-05-04 19:16:29 +03:00
$tableName = "UnicodeColNameTest";
dropTable($conn, $tableName);
2017-05-04 19:16:29 +03:00
// Column names array
$colName = ['C1', "C2", "C3"]; // WORKING REFERENCE
$colName = ["C1Ð", "CÐÐÆØ", str_repeat("CÐÆØ", 32)];
2017-05-04 19:16:29 +03:00
// Create table
$stmt = sqlsrv_query($conn, "create table ".$tableName
." ($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
foreach (sqlsrv_field_metadata($stmt) as $fieldMetadata) {
$res = $fieldMetadata;
var_dump($res['Name']);
2017-05-04 19:16:29 +03:00
}
dropTable($conn, $tableName);
2017-05-04 19:16:29 +03:00
// Close connection
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