From: Frank M. Kromann Date: Fri, 20 Oct 2000 20:49:35 +0000 (+0000) Subject: Fixing bug #6000 X-Git-Tag: php-4.0.4RC3~599 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2c874f745d8e1f7a548a2a14e4965ef03747f452;p=php Fixing bug #6000 Return the full content for datetime colums --- diff --git a/ext/mssql/php_mssql.c b/ext/mssql/php_mssql.c index 94e2a40b1c..8523dfd59f 100644 --- a/ext/mssql/php_mssql.c +++ b/ext/mssql/php_mssql.c @@ -698,7 +698,7 @@ static void php_mssql_get_column_content_with_type(mssql_link *mssql_ptr,int off char *data = charcol(offset); length=dbdatlen(mssql_ptr->link,offset); - while (length>0 && charcol(offset)[length-1] == ' ') { /* nuke trailing whitespace */ + while (length>0 && data[length-1] == ' ') { /* nuke trailing whitespace */ length--; } result->value.str.val = estrndup(data,length); @@ -713,13 +713,14 @@ static void php_mssql_get_column_content_with_type(mssql_link *mssql_ptr,int off } case SQLNUMERIC: default: { - if (dbwillconvert(coltype(offset),SQLCHAR)) { + if (dbwillconvert(column_type,SQLCHAR)) { char *res_buf; - int res_length = dbdatlen(mssql_ptr->link,offset); + int res_length = dbdatlen(mssql_ptr->link,offset) + 1; + if (column_type == SQLDATETIME) res_length += 10; - 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); + res_buf = (char *) emalloc(res_length); + memset(res_buf, 0, res_length); + dbconvert(NULL,column_type,dbdata(mssql_ptr->link,offset), res_length,SQLCHAR,res_buf,-1); result->value.str.len = res_length; result->value.str.val = res_buf;