Welcome Guest, Not a member yet? Register   Sign In
mysql maximum length of field
#1

[eluser]Unknown[/eluser]
I am building a simple form generation class/ orm
I need to get the maximum allowed length of fields in the mysql table.
CI allows to fetch max_length but this only fetches the length of the data already in the field.
This is the value returned by mysql_field_len($result, $num)

This is my code in my controller...

$this->CI->load->database();
$query = $this->CI->db->query($sql);
$fields = @$query->field_data();
$res = $query->result_array();

the error suppression is there because I get data_seek errors without it.
How can I get the field length as specified in the schema?

Kind regaards
Kevin
#2

[eluser]tonanbarbarian[/eluser]
you want the field metadata function
Field Metadata
#3

[eluser]Unknown[/eluser]
No, as I mentioned above, this only provides to fetch the length of the data already in the field.
I need the maximum allowable langth of the field as returned by mysql_field_len.

Kind regards
Kevin
#4

[eluser]Skuja[/eluser]
I am dealing with the same problem.. Has anyone come up with a good solution for this ?




Theme © iAndrew 2016 - Forum software by © MyBB