-
Notifications
You must be signed in to change notification settings - Fork 374
Description
The PDO driver is chocking on SQL_VARIANT types, but this can contain themselves simple types such as char, intenger, etc...
Steps to reproduce:
- Create an UDF:
CREATE FUNCTION [dbo].[GREATEST](@OP1 sql_variant, @OP2 sql_variant) RETURNS sql_variant AS
BEGIN
DECLARE @Result sql_variant
SET @Result = CASE WHEN @OP1 >= @OP2 THEN @OP1 ELSE @OP2 END
RETURN @Result
END
GO
- Run this query through the PDO
SELECT dbo.GREATEST(5, 6)
- Theses are the errors you get:
Without Buffered Queries:
SQLSTATE[IMSSP]: Invalid type.
With Buffered Queries:
Fatal error: Unknown type in sqlsrv_buffered_query::sqlsrv_buffered_query
I can manage to get it to work if I use PDO::PARAM_INT on the column before the fetch, but there is no way that I can infer this informatino from the PDO metadata (getColumnMeta) that is reporting:
sql_srv_type = sql_variant
native_type = string
Possible solutions.....
- At least let me retrieve the data as a string by default, instead of Fatal crashing.