Menu

#82 max_length and type in cubbrid_fetch_field() return incorrect data

open
nobody
None
5
2012-02-11
2012-02-11
Jira Trac
No

[cubrid_fetch_field()|http://www.php.net/manual/en/function.cubrid-fetch-field.php] returns an object with {code}name, table, def, max_length, not_null, primary_key, unique_key, multiple_key, numeric, blob, type, unsigned, zerofill{code} properties.

I have the following table:

{code}
CREATE TABLE tbl_users(
id integer AUTO_INCREMENT,
email character varying(100) NOT NULL UNIQUE,
join_date integer NOT NULL,
CONSTRAINT pk_tbl_users_id PRIMARY KEY(id)
);
{code}

When {code}cubrid_fetch_field(){code} is executed the following result is returned.

{code}
Array (
[0] = stdClass Object (
[name] = id
[type] = integer
[default] =
[max_length] = 3
[primary_key] = 1 )
[1] = stdClass Object (
[name] = email
[type] = varchar(100)
[default] =
[max_length] = 25
[primary_key] = 0 )
[2] = stdClass Object (
[name] = join_date
[type] = integer
[default] =
[max_length] = 10
[primary_key] = 0 ) )
{code}

# Both *id* and *join_date* columns are integers, but *max_length* are 3 and 10. Why?
# *email* column has type *varchar* but *varchar(100)* is returned.
# *email* column has max length constraint = 100, *25* is returned.

Is it a bug or is this the way it should be?

Discussion

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.