Bug #989: Incomplete date type reporting
| From: | shamim_islam at hotmail dot com | Date: | Mon, 14 Dec 1998 19:42:41 +0000 |
| Subject: | Bug #989: Incomplete date type reporting | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-2798@lists.php.net to get a copy of this message | ||
From: shamim_islam@hotmail.com
Operating system: N/A
PHP version: 3.0.5
PHP Bug Type: MySQL related
Bug description: Incomplete date type reporting
As it was in the original PHP v2.0 the support for the many mysql datatypes is pitifully incomplete.
In the original 2.0, I had to go in and manually code in the missing data types, as in that case it
was merely an omission of some of newer data type names.
In the new 3.0 code, I find that it is even more pitiful in that all the multitude of data types
available in mysql.c have been truncated to the one or two different types as seen fit by whoever
decided those were the only types supported. How is a PHP application to know the limits of a field
when you only supply int as a datatype whereas mysql supports 3 sizes of INTs. And the list goes on.
Here is the culprit section of mysql.c -- please do something about it because without this fix, one
would not be able to properly manage a MYSQL database from a PHP web page. I wonder if anyone
thought about that.
tatic char *php3_mysql_get_field_name(int field_type)
{
switch(field_type) {
case FIELD_TYPE_STRING:
case FIELD_TYPE_VAR_STRING:
return "string";
break;
#ifdef FIELD_TYPE_TINY
case FIELD_TYPE_TINY:
#endif
case FIELD_TYPE_SHORT:
case FIELD_TYPE_LONG:
case FIELD_TYPE_LONGLONG:
case FIELD_TYPE_INT24:
return "int";
break;
case FIELD_TYPE_FLOAT:
case FIELD_TYPE_DOUBLE:
case FIELD_TYPE_DECIMAL:
return "real";
break;
case FIELD_TYPE_TIMESTAMP:
return "timestamp";
break;
case FIELD_TYPE_DATE:
return "date";
break;
case FIELD_TYPE_TIME:
return "time";
break;
case FIELD_TYPE_DATETIME:
return "datetime";
break;
case FIELD_TYPE_TINY_BLOB:
case FIELD_TYPE_MEDIUM_BLOB:
case FIELD_TYPE_LONG_BLOB:
case FIELD_TYPE_BLOB:
return "blob";
break;
case FIELD_TYPE_NULL:
return "null";
break;
default:
return "unknown";
break;
}
}
-----------------------------------------------------------------
If ignorance is bliss, I want a painful headache so at least I know what I'm aiming at. What
about you folks?
P.S. VAR STRING and STRING are still 2 different datatypes as well. -- what gives? This is only
supposed to report the TYPE of the field,. Not automagically coerce the field to some predefined
format. Who decided what was and was not allowed anyway? When I saw the first version of the code, I
assumed it would be fixed later. We're still no where near getting if fixed from what I see.
*sigh*
P.P.S. You managed to get the different flags this time (minus the blob flag I might point out --
redundant or not, code expects this flag to be present). I think you all have just not tested PHP3
against a robust enough app. I know for a fact that my database manager would break with the current
implementation. But it runs fine on php2.0
P.P.P.S: What gives with the if():else; construct? No recursive descent parser? I mean, if
you're aiming for C structure it's a small matter to use the proper C grammer which is
available in BNF format for YACC and LEX. Right?
Please reply.
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net