summaryrefslogtreecommitdiff
path: root/ext/mssql
diff options
context:
space:
mode:
authorFrank M. Kromann <fmk@php.net>2003-02-11 01:24:07 +0000
committerFrank M. Kromann <fmk@php.net>2003-02-11 01:24:07 +0000
commit08b788dd44eb2ae2bc73df3642f3857f65807514 (patch)
tree463f61565d709b47398e3adb562ee77b32f4ed19 /ext/mssql
parent710b20a528af904ea3d9b1e8bdb8134ee22a0fda (diff)
downloadphp-git-08b788dd44eb2ae2bc73df3642f3857f65807514.tar.gz
Bug #20426. Convert SMALLDATETIME correct
Diffstat (limited to 'ext/mssql')
-rw-r--r--ext/mssql/php_mssql.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/ext/mssql/php_mssql.c b/ext/mssql/php_mssql.c
index 9b86af4a89..2cf940df23 100644
--- a/ext/mssql/php_mssql.c
+++ b/ext/mssql/php_mssql.c
@@ -822,7 +822,7 @@ static void php_mssql_get_column_content_with_type(mssql_link *mssql_ptr,int off
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 @@ static void php_mssql_get_column_content_with_type(mssql_link *mssql_ptr,int off
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 @@ static void php_mssql_get_column_content_without_type(mssql_link *mssql_ptr,int
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 @@ static void php_mssql_get_column_content_without_type(mssql_link *mssql_ptr,int
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);