php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #56841 db2_field_type returns 'string' for date, time, and timestamp
Submitted: 2006-02-15 11:06 UTC Modified: 2006-02-16 12:58 UTC
From: devel at digitalaudiorock dot com Assigned: tessus (profile)
Status: Closed Package: ibm_db2 (PECL)
PHP Version: 5.1.2 OS: Linux x86
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
37 + 22 = ?
Subscribe to this entry?

 
 [2006-02-15 11:06 UTC] devel at digitalaudiorock dot com
Description:
------------
For any columns of the types date, time, or timestamp, the db2_field_type function returns 'string'.  It appears that this could be addressed by adding something like the following to the case statement in db2_field_type within ibm_db2.c:

		case SQL_TYPE_DATE:
		case SQL_DATE:
			str_val = "date";
			break;
		case SQL_TYPE_TIME:
		case SQL_TIME:
			str_val = "time";
			break;
		case SQL_TYPE_TIMESTAMP:
		case SQL_TIMESTAMP:
			str_val = "timestamp";
			break;

Though I'm not sure if the SQL_DATE, SQL_TIME, and SQL_DATETIME are needed, or if the others would require ODBCVER compiler directives.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-02-15 11:15 UTC] devel at digitalaudiorock dot com
Two additional notes:  This is actually in php 5.1.2, but there was no option for this in the dropdown list.  Also, I should have posted the above code in diff form...here it is:

*** ibm_db2.c_ORIG      2006-02-15 09:38:24.343776223 -0500
--- ibm_db2.c   2006-02-15 10:55:01.763884479 -0500
***************
*** 2925,2930 ****
--- 2925,2942 ----
                case SQL_BLOB:
                        str_val = "blob";
                        break;
+               case SQL_TYPE_DATE:
+               case SQL_DATE:
+                       str_val = "date";
+                       break;
+               case SQL_TYPE_TIME:
+               case SQL_TIME:
+                       str_val = "time";
+                       break;
+               case SQL_TYPE_TIMESTAMP:
+               case SQL_TIMESTAMP:
+                       str_val = "timestamp";
+                       break;
                default:
                        str_val = "string";
                        break;
 [2006-02-15 13:06 UTC] tessus at evermeet dot cx
You are correct. The date/time/timestamp values are not tested. I will change the code as soon as possible.
 [2006-02-16 12:58 UTC] tessus at evermeet dot cx
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.

added the values for date / time / timestamp.
fixed in cvs. (1.43)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 05:01:30 2024 UTC