@@ -822,15 +822,22 @@ static void php_mssql_get_column_content_with_type(mssql_link *mssql_ptr,int off
822
822
DBDATEREC dateinfo ;
823
823
int res_length = dbdatlen (mssql_ptr -> link ,offset );
824
824
825
- if ((column_type != SQLDATETIME ) || MS_SQL_G (datetimeconvert )) {
825
+ if ((column_type != SQLDATETIME && column_type != SQLDATETIM4 ) || MS_SQL_G (datetimeconvert )) {
826
826
827
827
if (column_type == SQLDATETIM4 ) res_length += 14 ;
828
828
if (column_type == SQLDATETIME ) res_length += 10 ;
829
829
830
830
res_buf = (unsigned char * ) emalloc (res_length + 1 );
831
831
res_length = dbconvert (NULL ,coltype (offset ),dbdata (mssql_ptr -> link ,offset ), res_length , SQLCHAR ,res_buf ,-1 );
832
832
} else {
833
- dbdatecrack (mssql_ptr -> link , & dateinfo , (DBDATETIME * ) dbdata (mssql_ptr -> link ,offset ));
833
+ if (column_type == SQLDATETIM4 ) {
834
+ DBDATETIME temp ;
835
+
836
+ dbconvert (NULL , SQLDATETIM4 , dbdata (mssql_ptr -> link ,offset ), -1 , SQLDATETIME , (LPBYTE ) & temp , -1 );
837
+ dbdatecrack (mssql_ptr -> link , & dateinfo , & temp );
838
+ } else {
839
+ dbdatecrack (mssql_ptr -> link , & dateinfo , (DBDATETIME * ) dbdata (mssql_ptr -> link ,offset ));
840
+ }
834
841
835
842
res_length = 19 ;
836
843
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
875
882
DBDATEREC dateinfo ;
876
883
int res_length = dbdatlen (mssql_ptr -> link ,offset );
877
884
878
- if ((column_type != SQLDATETIME ) || MS_SQL_G (datetimeconvert )) {
885
+ if ((column_type != SQLDATETIME && column_type != SQLDATETIM4 ) || MS_SQL_G (datetimeconvert )) {
879
886
880
887
if (column_type == SQLDATETIM4 ) res_length += 14 ;
881
888
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
884
891
res_length = dbconvert (NULL ,coltype (offset ),dbdata (mssql_ptr -> link ,offset ), res_length , SQLCHAR , res_buf , -1 );
885
892
886
893
} else {
887
- dbdatecrack (mssql_ptr -> link , & dateinfo , (DBDATETIME * ) dbdata (mssql_ptr -> link ,offset ));
894
+ if (column_type == SQLDATETIM4 ) {
895
+ DBDATETIME temp ;
896
+
897
+ dbconvert (NULL , SQLDATETIM4 , dbdata (mssql_ptr -> link ,offset ), -1 , SQLDATETIME , (LPBYTE ) & temp , -1 );
898
+ dbdatecrack (mssql_ptr -> link , & dateinfo , & temp );
899
+ } else {
900
+ dbdatecrack (mssql_ptr -> link , & dateinfo , (DBDATETIME * ) dbdata (mssql_ptr -> link ,offset ));
901
+ }
888
902
889
903
res_length = 19 ;
890
904
res_buf = (unsigned char * ) emalloc (res_length + 1 );
0 commit comments