cvs: php4 /ext/mssql php_mssql.c

From: Date: Tue, 01 May 2001 18:01:08 +0000
Subject: cvs: php4 /ext/mssql php_mssql.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-5435@lists.php.net to get a copy of this message
fmk Tue May 1 11:01:08 2001 EDT Modified files: /php4/ext/mssql php_mssql.c Log: Adding support for BINARY, VARBINARY and IMAGE column types. Thanks to Brad LaFountain. Index: php4/ext/mssql/php_mssql.c diff -u php4/ext/mssql/php_mssql.c:1.40 php4/ext/mssql/php_mssql.c:1.41 --- php4/ext/mssql/php_mssql.c:1.40 Tue Mar 13 08:33:39 2001 +++ php4/ext/mssql/php_mssql.c Tue May 1 11:01:08 2001 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_mssql.c,v 1.40 2001/03/13 16:33:39 fmk Exp $ */ +/* $Id: php_mssql.c,v 1.41 2001/05/01 18:01:08 fmk Exp $ */ #ifdef COMPILE_DL_MSSQL #define HAVE_MSSQL 1 @@ -729,6 +729,22 @@ result->type = IS_DOUBLE; break; } + case SQLVARBINARY: + case SQLBINARY: + case SQLIMAGE: { + DBBINARY *bin; + unsigned char *res_buf; + int res_length = dbdatlen(mssql_ptr->link,offset); + + res_buf = (unsigned char *) emalloc(res_length); + memset(res_buf, 0, res_length); + bin = ((DBBINARY *)dbdata(mssql_ptr->link,offset)); + memcpy(res_buf,bin,res_length); + result->value.str.len = res_length; + result->value.str.val = res_buf; + result->type = IS_STRING; + } + break; case SQLNUMERIC: default: { if (dbwillconvert(column_type,SQLCHAR)) { @@ -759,7 +775,22 @@ return; } - if (dbwillconvert(coltype(offset),SQLCHAR)) { + if (column_type == SQLVARBINARY || + column_type == SQLBINARY || + column_type == SQLIMAGE) { + DBBINARY *bin; + unsigned char *res_buf; + int res_length = dbdatlen(mssql_ptr->link,offset); + + res_buf = (unsigned char *) emalloc(res_length); + memset(res_buf, 0, res_length); + bin = ((DBBINARY *)dbdata(mssql_ptr->link,offset)); + memcpy(res_buf,bin,res_length); + result->value.str.len = res_length; + result->value.str.val = res_buf; + result->type = IS_STRING; + } + else if (dbwillconvert(coltype(offset),SQLCHAR)) { unsigned char *res_buf; int res_length = dbdatlen(mssql_ptr->link,offset);

« previous php.cvs (#5435) next »