-
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
sql variant support #399
sql variant support #399
Conversation
| ||
SQLSTATE[22018]: [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Operand type clash: nvarchar(max) is incompatible with sql_variant | ||
SQLSTATE[22018]: [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Operand type clash: nvarchar(max) is incompatible with sql_variant | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where did nvarchar(max) come from?? The error messages don't make sense here...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the initialized data is php string that will fall into sql varchar* type group, in the core stmt when binding output parameters the size is assigned to max to avoid silent truncation. so when it is passed to ODBC the type is max, and the server receives the max char type. For error handling in this part we're benefiting from server side errors, as we cannot identify the type of the variant column beforehand (the same reason why we cannot support output parameters), and we can't constraint the error SQLSTATE[22018]
to only variant, and it might occur when querying other columns than variant.
@@ -0,0 +1,194 @@ | |||
--TEST-- | |||
Test simple insert and fetch sql_variants as strings using inputs of various data types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test looks so much similar to sqlsrv/sqlsrv_simple_fetch_variants.phpt? What's the difference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, accidentally checked this in 😃
|
||
echo "Insert all columns from row $c1_int into one column of type sql_variant\n"; | ||
$stmtOriginal->bindValue(':row', $c1_int, PDO::PARAM_INT); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the user calls bindValue() without specifying the type? Will there be an error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will there be a test with query like select ? = name from...
Limitation