note 34335 modified in function.ibase-query by abies
| From: | abies@php.net | Date: | Tue, 02 Sep 2003 12:05:54 +0000 |
| Subject: | note 34335 modified in function.ibase-query by abies | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-55464@lists.php.net to get a copy of this message | ||
Two comments on interogating system tables in Interbase or Firebird; I hope it helps.
1. if you try to build a query string to extract data from a system table (that has the form
"rdb$some_name"), you should divide the "rdb$some_name" table name in your query
string using the string merge operator ".".
$query = "select rdb"."$"."relation_name as TABLE_NAME from
rdb"."$"."relations where rdb"."$"."system_flag=0";
2. The second thing is related to the fact that you can later use (after the call to
ibase_fetch_object) as field identifier the ALIAS used in the query for the
"rdb$some_name" table.
Example:
$get_table_names_query = "select rdb"."$"."relation_name as TABLE_NAME from
rdb"."$"."relations where rdb"."$"."system_flag=0";
//
$res_table_names_query = ibase_query($dbconnection, $get_table_names_query);
//
while ($row_table_names = ibase_fetch_object($res_table_names_query))
{
print($row_table_names->TABLE_NAME);//alias used
}
Editor's note:
it is easier to use a backslash to protect the $-sign.
eg. "select rdb\$relation_name as TABLE_NAME from rdb"
--was--
Two comments on interogating system tables in Interbase or Firebird; I hope it helps.
1. if you try to build a query string to extract data from a system table (that has the form
"rdb$some_name"), you should divide the "rdb$some_name" table name in your query
string using the string merge operator ".".
$query = "select rdb"."$"."relation_name as TABLE_NAME from
rdb"."$"."relations where rdb"."$"."system_flag=0";
2. The second thing is related to the fact that you can later use (after the call to
ibase_fetch_object) as field identifier the ALIAS used in the query for the
"rdb$some_name" table.
Example:
$get_table_names_query = "select rdb"."$"."relation_name as TABLE_NAME from
rdb"."$"."relations where rdb"."$"."system_flag=0";
//
$res_table_names_query = ibase_query($dbconnection, $get_table_names_query);
//
while ($row_table_names = ibase_fetch_object($res_table_names_query))
{
print($row_table_names->TABLE_NAME);//alias used
}
http://www.php.net/manual/en/function.ibase-query.php