PhpDig.net

What is PhpDig?
PhpDig is a PHP MySQL based
Web Spider & Search Engine.




odbc_tables

Name

odbc_tables — Displays table information.

Synopsis

resource odbc_tables(conn[, catalog][, owner][, table][, type]);
resource conn: Connection ID
string catalog (optional): Catalog name
string owner (optional): Database owner
string table (optional): Table name
string type (optional): Table type

Returns

Result identifier; FALSE on failure

Description

Displays information on a table or tables. The syntax of this command may vary across database vendors; the example below shows the correct syntax for Microsoft SQL Server. Wildcards can be used; '%' indicates a match on zero or more characters, while '_' is used to match a single character.

Results returned are TABLE_CAT, TABLE_SCHEM, TABLE_NAME, TABLE_TYPE, and REMARKS . The results are ordered by TABLE_TYPE, TABLE_QUALIFIER, TABLE_OWNER, and TABLE_NAME.

The wildcard operation and content of parameters is quite different in this function from other ODBC functions. Additionally, if a parameter contains a NULL or a wildcard, it can have different effects. For example, if owner and table contain empty quotes and catalog has a value of '%', the result set returned actually contains the names of valid catalogs (databases). If catalog and table contain empty strings and owner is '%', then the result set contains a list of valid owners for the data source specified via the DSN, since catalog is NULL. Finally, if catalog , owner , and table are all empty strings and type is '%' the result set contains a list of valid table types that can be used as values for this parameter.

To further complicate things, if specifying type , the multiple values must be comma separated, and each value must also be quoted or no values must be quoted. "'TABLE', 'VIEW'" and "'TABLE','SYSTEM TABLE'" are typical examples.

Version

Existing since version 4.0

Example

Example 1364. Show table information

<?php
$db = odbc_connect("DSN","user","pass");
$result = odbc_tables($db,"Northwind","dbo","Employees","%");
odbc_result_all($result)
?>



PHP Functions Essential Reference. Copyright © 2002 by New Riders Publishing (Authors: Zak Greant, Graeme Merrall, Torben Wilson, Brett Michlitsch). This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at http://www.opencontent.org/openpub/). The authors of this book have elected not to choose any options under the OPL. This online book was obtained from http://www.fooassociates.com/phpfer/ and is designed to provide information about the PHP programming language, focusing on PHP version 4.0.4 for the most part. The information is provided on an as-is basis, and no warranty or fitness is implied. All persons and entities shall have neither liability nor responsibility to any person or entity with respect to any loss or damage arising from the information contained in this book.

Powered by: vBulletin Version 3.0.7
Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.