List:Commits« Previous MessageNext Message »
From:bdegtyariov Date:February 9 2007 1:19pm
Subject:Connector/ODBC 3.51 commit: r159 - in trunk: . driver
View as plain text  
Modified:
   trunk/ChangeLog
   trunk/driver/results.c
Log:
BUG#25846: fixed getting TIME columns using SQL_TIMESTAMP_STRUCT structure in Crystal
Reports

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-02-09 07:07:02 UTC (rev 158)
+++ trunk/ChangeLog	2007-02-09 13:19:59 UTC (rev 159)
@@ -38,6 +38,8 @@
    functions such as COMPRESS() in SELECT queries
 -- fixed 64-bit issue related to SQLINTEGER/SQLUINTEGER bound columns 
    defined as int, but casted as long/unsigned long
+-- BUG#25846: fixed getting TIME columns using SQL_TIMESTAMP_STRUCT structure 
+   in Crystal Reports
 ---------------------------------------------
 25-Aug-2005 (3.51.12): pharvey@stripped
 ---------------------------------------------

Modified: trunk/driver/results.c
===================================================================
--- trunk/driver/results.c	2007-02-09 07:07:02 UTC (rev 158)
+++ trunk/driver/results.c	2007-02-09 13:19:59 UTC (rev 159)
@@ -1028,10 +1028,36 @@
             case SQL_C_TIMESTAMP:
             case SQL_C_TYPE_TIMESTAMP:
                 {
-                    if ( str_to_ts((SQL_TIMESTAMP_STRUCT *)rgbValue, value) )
-                        *pcbValue= SQL_NULL_DATA;
+                    if (field->type == FIELD_TYPE_TIME)
+                    {
+                        SQL_TIME_STRUCT ts;
+
+                        if ( str_to_time_st(&ts,value) )
+                            *pcbValue= SQL_NULL_DATA;
+                        else
+                        {
+                            SQL_TIMESTAMP_STRUCT *timestamp_info= (SQL_TIMESTAMP_STRUCT
*)rgbValue;
+                            time_t sec_time= time(NULL);
+                            struct tm cur_tm;
+                            localtime_r(&sec_time, &cur_tm);
+
+                            timestamp_info->year= 1900 + cur_tm.tm_year;
+                            timestamp_info->month= 1 + cur_tm.tm_mon; /* January is 0
in tm */
+                            timestamp_info->day= cur_tm.tm_mday;
+                            timestamp_info->hour= ts.hour;
+                            timestamp_info->minute= ts.minute;
+                            timestamp_info->second= ts.second;
+                            timestamp_info->fraction= 0;
+                            *pcbValue= sizeof(SQL_TIMESTAMP_STRUCT);      
+                        }
+                    } 
                     else
-                        *pcbValue= sizeof(SQL_TIMESTAMP_STRUCT);      
+                    {
+                        if ( str_to_ts((SQL_TIMESTAMP_STRUCT *)rgbValue, value) )
+                            *pcbValue= SQL_NULL_DATA;
+                        else
+                            *pcbValue= sizeof(SQL_TIMESTAMP_STRUCT);      
+                    }
                     break;
 
                 }

Thread
Connector/ODBC 3.51 commit: r159 - in trunk: . driverbdegtyariov9 Feb