CVS update: php3/dl/mssql

From: Date: Fri, 12 Feb 1999 15:29:06 +0000
Subject: CVS update: php3/dl/mssql
Groups: php.dev 
Request: Send a blank email to php-dev+get-4067@lists.php.net to get a copy of this message
Date: Friday February 12, 1999 @ 10:29 Author: fmk Update of /repository/php3/dl/mssql In directory asf:/u/temp/cvs-serv16635 Modified Files: mssql.c Log Message: Fixing bug when converting integers when compatobility mode = 0 Index: php3/dl/mssql/mssql.c diff -c php3/dl/mssql/mssql.c:1.12 php3/dl/mssql/mssql.c:1.13 *** php3/dl/mssql/mssql.c:1.12 Wed Jan 6 02:26:47 1999 --- php3/dl/mssql/mssql.c Fri Feb 12 10:29:06 1999 *************** *** 32,38 **** +----------------------------------------------------------------------+ */ ! /* $Id: mssql.c,v 1.12 1999/01/06 07:26:47 fmk Exp $ */ #define IS_EXT_MODULE #ifdef THREAD_SAFE # ifndef PHP_31 --- 32,38 ---- +----------------------------------------------------------------------+ */ ! /* $Id: mssql.c,v 1.13 1999/02/12 15:29:06 fmk Exp $ */ #define IS_EXT_MODULE #ifdef THREAD_SAFE # ifndef PHP_31 *************** *** 748,755 **** case SQLINT1: case SQLINT2: case SQLINT4: ! case SQLINTN: ! case SQLNUMERIC: { result->value.lval = (long) anyintcol(offset); result->type = IS_LONG; break; --- 748,754 ---- case SQLINT1: case SQLINT2: case SQLINT4: ! case SQLINTN: { result->value.lval = (long) anyintcol(offset); result->type = IS_LONG; break; *************** *** 774,797 **** result->type = IS_DOUBLE; break; } default: { if (dbwillconvert(coltype(offset),SQLCHAR)) { char *res_buf; int res_length = dbdatlen(mssql_ptr->link,offset); - register char *p; res_buf = (char *) emalloc(res_length+1); ! memset(res_buf, ' ', res_length+1); dbconvert(NULL,coltype(offset),dbdata(mssql_ptr->link,offset), res_length,SQLCHAR,res_buf,-1); - /* get rid of trailing spaces */ - p = res_buf + res_length; - while (*p == ' ') { - p--; - res_length--; - } - *(++p) = 0; /* put a trailing NULL */ - result->value.str.len = res_length; result->value.str.val = res_buf; result->type = IS_STRING; --- 773,788 ---- result->type = IS_DOUBLE; break; } + case SQLNUMERIC: default: { if (dbwillconvert(coltype(offset),SQLCHAR)) { char *res_buf; int res_length = dbdatlen(mssql_ptr->link,offset); res_buf = (char *) emalloc(res_length+1); ! memset(res_buf, 0, res_length+1); dbconvert(NULL,coltype(offset),dbdata(mssql_ptr->link,offset), res_length,SQLCHAR,res_buf,-1); result->value.str.len = res_length; result->value.str.val = res_buf; result->type = IS_STRING; *************** *** 803,809 **** } } - static void php3_mssql_get_column_content_without_type(mssql_link *mssql_ptr,int offset,pval *result, int column_type) { if (dbdatlen(mssql_ptr->link,offset) == 0) { --- 794,799 ---- *************** *** 812,831 **** } if (dbwillconvert(coltype(offset),SQLCHAR)) { unsigned char *res_buf; ! int res_length = dbdatlen(mssql_ptr->link,offset); ! register char *p; ! ! res_buf = (unsigned char *) emalloc(res_length+1); ! memset(res_buf, ' ', res_length+1); ! dbconvert(NULL,coltype(offset),dbdata(mssql_ptr->link,offset), res_length,SQLCHAR,res_buf,-1); ! /* get rid of trailing spaces */ ! p = res_buf + res_length; ! while (*p == ' ') { ! p--; ! res_length--; ! } ! *(p) = '\0'; /* put a trailing NULL */ result->value.str.len = res_length; result->value.str.val = res_buf; --- 802,812 ---- } if (dbwillconvert(coltype(offset),SQLCHAR)) { unsigned char *res_buf; ! int res_length = dbdatlen(mssql_ptr->link,offset) + 10; ! res_buf = (unsigned char *) emalloc(res_length+1); ! memset(res_buf, 0, res_length+1); ! dbconvert(NULL,coltype(offset),dbdata(mssql_ptr->link,offset), res_length, SQLCHAR,res_buf,-1); result->value.str.len = res_length; result->value.str.val = res_buf; -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#4067) next »