diff --git a/ext/mssql/php_mssql.c b/ext/mssql/php_mssql.c index 57b4e6631b9..7e1b7a10be0 100644 --- a/ext/mssql/php_mssql.c +++ b/ext/mssql/php_mssql.c @@ -800,6 +800,15 @@ static void php_mssql_get_column_content_with_type(mssql_link *mssql_ptr,int off Z_DVAL_P(result) = (double) floatcol8(offset); Z_TYPE_P(result) = IS_DOUBLE; break; +#ifdef SQLUNIQUE + case SQLUNIQUE: { + char *data = charcol(offset); + + /* uniqueidentifier is a 16-byte binary number */ + ZVAL_STRINGL(result, data, 16, 1); + } + break; +#endif case SQLVARBINARY: case SQLBINARY: case SQLIMAGE: { @@ -1468,6 +1477,11 @@ static char *php_mssql_get_field_name(int type) case SQLIMAGE: return "image"; break; +#ifdef SQLUNIQUE + case SQLUNIQUE: + return "uniqueidentifier"; + break; +#endif default: return "unknown"; break; diff --git a/ext/mssql/php_mssql.h b/ext/mssql/php_mssql.h index 49b3b6c1638..c39ad5de71f 100644 --- a/ext/mssql/php_mssql.h +++ b/ext/mssql/php_mssql.h @@ -59,6 +59,9 @@ #define SQLIMAGE SYBIMAGE #define SQLBINARY SYBBINARY #define SQLVARBINARY SYBVARBINARY +#ifdef SQLUNIQUE /* FreeTSD 0.61+ */ +#define SQLUNIQUE SYBUNIQUE +#endif #define DBERRHANDLE(a, b) dberrhandle(b) #define DBMSGHANDLE(a, b) dbmsghandle(b) #define DBSETOPT(a, b, c) dbsetopt(a, b, c, -1)