fmk Mon Feb 10 20:24:08 2003 EDT
Modified files:
/php4/ext/mssql php_mssql.c
Log:
Bug #20426. Convert SMALLDATETIME correct
Index: php4/ext/mssql/php_mssql.c
diff -u php4/ext/mssql/php_mssql.c:1.106 php4/ext/mssql/php_mssql.c:1.107
--- php4/ext/mssql/php_mssql.c:1.106 Sun Feb 9 07:15:05 2003
+++ php4/ext/mssql/php_mssql.c Mon Feb 10 20:24:07 2003
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_mssql.c,v 1.106 2003/02/09 12:15:05 derick Exp $ */
+/* $Id: php_mssql.c,v 1.107 2003/02/11 01:24:07 fmk Exp $ */
#ifdef COMPILE_DL_MSSQL
#define HAVE_MSSQL 1
@@ -822,7 +822,7 @@
DBDATEREC dateinfo;
int res_length = dbdatlen(mssql_ptr->link,offset);
- if ((column_type != SQLDATETIME) ||
MS_SQL_G(datetimeconvert)) {
+ if ((column_type != SQLDATETIME && column_type !=
+SQLDATETIM4) || MS_SQL_G(datetimeconvert)) {
if (column_type == SQLDATETIM4) res_length +=
14;
if (column_type == SQLDATETIME) res_length +=
10;
@@ -830,7 +830,14 @@
res_buf = (unsigned char *)
emalloc(res_length+1);
res_length =
dbconvert(NULL,coltype(offset),dbdata(mssql_ptr->link,offset), res_length,
SQLCHAR,res_buf,-1);
} else {
- dbdatecrack(mssql_ptr->link, &dateinfo,
(DBDATETIME *) dbdata(mssql_ptr->link,offset));
+ if (column_type == SQLDATETIM4) {
+ DBDATETIME temp;
+
+ dbconvert(NULL, SQLDATETIM4,
+dbdata(mssql_ptr->link,offset), -1, SQLDATETIME, (LPBYTE) &temp, -1);
+ dbdatecrack(mssql_ptr->link,
+&dateinfo, &temp);
+ } else {
+ dbdatecrack(mssql_ptr->link,
+&dateinfo, (DBDATETIME *) dbdata(mssql_ptr->link,offset));
+ }
res_length = 19;
res_buf = (unsigned char *)
emalloc(res_length+1);
@@ -875,7 +882,7 @@
DBDATEREC dateinfo;
int res_length = dbdatlen(mssql_ptr->link,offset);
- if ((column_type != SQLDATETIME) || MS_SQL_G(datetimeconvert)) {
+ if ((column_type != SQLDATETIME && column_type != SQLDATETIM4) ||
+MS_SQL_G(datetimeconvert)) {
if (column_type == SQLDATETIM4) res_length += 14;
if (column_type == SQLDATETIME) res_length += 10;
@@ -884,7 +891,14 @@
res_length =
dbconvert(NULL,coltype(offset),dbdata(mssql_ptr->link,offset), res_length, SQLCHAR,
res_buf, -1);
} else {
- dbdatecrack(mssql_ptr->link, &dateinfo, (DBDATETIME *)
dbdata(mssql_ptr->link,offset));
+ if (column_type == SQLDATETIM4) {
+ DBDATETIME temp;
+
+ dbconvert(NULL, SQLDATETIM4,
+dbdata(mssql_ptr->link,offset), -1, SQLDATETIME, (LPBYTE) &temp, -1);
+ dbdatecrack(mssql_ptr->link, &dateinfo, &temp);
+ } else {
+ dbdatecrack(mssql_ptr->link, &dateinfo, (DBDATETIME *)
+dbdata(mssql_ptr->link,offset));
+ }
res_length = 19;
res_buf = (unsigned char *) emalloc(res_length+1);
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php