-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP Fatal error: Unexpected SQL type encountered in calc_string_size #127
Comments
I use the scripts https://github.com/xalopp/vagrant-php7sqlsrv/blob/master/tests/pdo_sqlsrv_query.php and https://github.com/xalopp/vagrant-php7sqlsrv/blob/master/tests/sqlsrv_query.php for testing.
|
Hello @xalopp, We are trying to repro this in our test lab with no luck. Can you add $count to your script and share your results? $count = 0; |
The program still fails at the line containg while ($row = sqlsrv_fetch_array($result, SQLSRV_FETCH_ASSOC)) { I forgeot to mention I'm using:
|
<?php
$serverName = getenv('MSSQL_SERVERNAME') ?: '192.168.56.102';
$database = getenv('MSSQL_DATABASE') ?: 'AdventureWorks2016CTP3';
$username = getenv('MSSQL_USERNAME') ?: 'test';
$password = getenv('MSSQL_PASSWORD') ?: 'test';
$sqlStatement = getenv('MSSQL_SQL') ?: 'select current_value from sys.sequences';
$conn = sqlsrv_connect($serverName, ['Database' => $database, 'Uid' => $username, 'PWD' => $password]);
$result = sqlsrv_query($conn, $sqlStatement);
$row = sqlsrv_fetch_array($result, SQLSRV_FETCH_ASSOC);
sqlsrv_free_stmt($result); Chaing the query to
will work. But it should work without CASTing, like the |
The drivers doesn't support the SQL data type The easiest way to reproduce this: sqlsrv_query($conn, "DECLARE @v1 sql_variant; SET @v1 = 'ABC'; SELECT @v1;"); |
@xalopp we added sql_variant support in the 4.2.0-preview, could you confirm that this issue if fixed? |
@Hadis-Fard I successfully tested the query with 4.2.0-preview. Thanks! |
On Linux, I get with the
sqlsrv
driver a Fatal error with following Fatal errorwhen I execute this query:
The same query works well with the PDO driver
pdo_sqlsrv
.Linux Version: Ubuntu 16.04, PHP installed as package.
PHP Version:
PHP 7.0.9-1+deb.sury.org~xenial+1 (cli) ( NTS )
pdo_sqlsrv
ExtensionVer => 4.0.2.0
sqlsrv
ExtensionVer => 4.0.2.0
The text was updated successfully, but these errors were encountered: