Metadata - mysqli
am 24.11.2009 13:01:47 von keyser soze
hi
mysqli_fetch_field provide result metadata
like 'column name', 'max length', 'datatype' etc
but i need the "comment" of each column
is this possible?
(i guess it does't because
i do a query, and that query brings to me columns and its values
but not the comment metadata...
but it would be very nice to have the "field comment" metadata
in order to use it on interfaces or reports, etc)
thanks
---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 091123-1, 23/11/2009
Tested on: 24/11/2009 09:01:48 a.m.
avast! - copyright (c) 1988-2009 ALWIL Software.
http://www.avast.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Metadata - mysqli
am 24.11.2009 13:19:53 von David Otton
2009/11/24 keyser soze :
> mysqli_fetch_field provide result metadata
> like 'column name', 'max length', 'datatype' etc
> but i need the "comment" of each column
>
> is this possible?
The table that stores data about columns is
information_schema.COLUMNS. You're looking for the COLUMN_COMMENT
column. Eg
SELECT COLUMN_COMMENT FROM information_schema.COLUMNS WHERE
TABLE_SCHEMA = 'database' AND TABLE_NAME = 'table' AND COLUMN_NAME =
'column';
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Metadata - mysqli
am 24.11.2009 13:43:07 von keyser soze
yes, David, thanks
i know that
this query, for example:
select now(), item_count+10 as itemplus10, name
from mytable
i do not pretend that columns 1 and 2
bring to me the "column_comment" metadata because don't exist
but it would be helpful if i can get the column_comment metadata
of the column 3
i can have several joins,
it would be very useful to get implicitly
the original metadata of the columns that are included on the query
without modifications or calculations
since, in other way
i should have some schema for matching table and column names
with its metadata,
for example a php that setup an array of all columns
(from table columns)
indexed by "db.table.column"
the purpose of all this
is to get "labels" for each field
for use in the application
tell me please, what do you think?
i don't have much experience in php+mysql
thanks
David Otton escribió:
> 2009/11/24 keyser soze :
>
>> mysqli_fetch_field provide result metadata
>> like 'column name', 'max length', 'datatype' etc
>> but i need the "comment" of each column
>>
>> is this possible?
>
> The table that stores data about columns is
> information_schema.COLUMNS. You're looking for the COLUMN_COMMENT
> column. Eg
>
> SELECT COLUMN_COMMENT FROM information_schema.COLUMNS WHERE
> TABLE_SCHEMA = 'database' AND TABLE_NAME = 'table' AND COLUMN_NAME =
> 'column';
>
---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 091123-1, 23/11/2009
Tested on: 24/11/2009 09:43:10 a.m.
avast! - copyright (c) 1988-2009 ALWIL Software.
http://www.avast.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php