Re: Metadata - mysqli

From: Date: Tue, 24 Nov 2009 12:43:07 +0000
Subject: Re: Metadata - mysqli
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-300052@lists.php.net to get a copy of this message
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 <bajopalabra@yahoo.com.ar>:
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

« previous php.general (#300052) next »