View / Download this file.
----------------------------------------
PTMDB MODULE - db_get_indexes() FUNCTION
----------------------------------------
------------
USAGE FORMAT
------------
Where @indexes is the returned list of Index columns/fields:
@indexes = &db_get_indexes($db_object, $table_name);
@indexes = &db_get_indexes($db_object, $table_name, $db_name);
-----------
DESCRIPTION
-----------
Retrieves a list of Index column headers from a given database table. If a
database has already been selected, the only required parameters are the
database object and a table name. If a database has not been selected, or
you wish to list Index column names from a table in another database, a
database name is required as well. Returns an array containing the Index
column header names from the given database (based on MySQL "SHOW INDEXES"
return format).
---------
ARGUMENTS
---------
$db_object
REQUIRED
A database handler object. This object stores connection information and
is returned from a db_connect() function call. This object is of the same
type as is returned by a DBI->connect function call.
$table_name
REQUIRED
The name of the table from which you would like to pull Index column
headers.
$db_name
OPTIONAL / REQUIRED
The name of the database from which to pull table Indexes. This is
only required if a database has not yet been selected using the
db_select_database() function or an SQL 'USE' statement, or alternately if
you wish to pull table column headers from a different database than the
one currently selected.
-------
RETURNS
-------
A list (array) containing the Index column header names from the selected
table in the order in which they were returned from the database server.
--------------
USAGE EXAMPLES
--------------
------------------------------------------------------------------
Example 1: Display the Index Column Names from the Table 'MyTable'
------------------------------------------------------------------
<?= join(', ', &db_get_indexes($dbobj, 'MyTable')) =?>
|