cvs: php4 /ext/mssql php_mssql.c
| From: | Frank M. Kromann | Date: | Fri, 20 Oct 2000 20:49:35 +0000 |
| Subject: | cvs: php4 /ext/mssql php_mssql.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-2172@lists.php.net to get a copy of this message | ||
fmk Fri Oct 20 13:49:35 2000 EDT
Modified files:
/php4/ext/mssql php_mssql.c
Log:
Fixing bug #6000
Return the full content for datetime colums
Index: php4/ext/mssql/php_mssql.c
diff -u php4/ext/mssql/php_mssql.c:1.28 php4/ext/mssql/php_mssql.c:1.29
--- php4/ext/mssql/php_mssql.c:1.28 Fri Oct 20 12:55:03 2000
+++ php4/ext/mssql/php_mssql.c Fri Oct 20 13:49:35 2000
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_mssql.c,v 1.28 2000/10/20 19:55:03 fmk Exp $ */
+/* $Id: php_mssql.c,v 1.29 2000/10/20 20:49:35 fmk Exp $ */
#ifdef COMPILE_DL_MSSQL
#define HAVE_MSSQL 1
@@ -698,7 +698,7 @@
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 @@
}
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;