ODBC Driver for Kintone

Build 24.0.9060

Discovering Schemas

The following sections show how to obtain schema information.

List Tables and Views

You can use the odbc_tables function to discover what tables and views are available through the driver. This returns results through a resource like a query would.

$stmt = odbc_tables($cnx);
while ($row = odbc_fetch_array($stmt)) {
    echo "Catalog: ", $row["TABLE_CAT"], "\n";
    echo "Schema: ", $row["TABLE_SCHEM"], "\n";
    echo "Table: ", $row["TABLE_NAME"], "\n";
    echo "Type: ", $row["TABLE_TYPE"], "\n";
}

You can use the odbc_columns method to discover what columns are available on a table or view.

$stmt = odbc_columns($cnx);
while ($row = odbc_fetch_array($stmt)) {
    if ($row["TABLE_NAME"] == "Comments") {
        echo "Name: ", $row["COLUMN_NAME"], "\n";
        echo "Type: ", $row["DATA_TYPE"], "\n";
        echo "Length: ", $row["COLUMN_SIZE"], "\n";
        echo "Precision: ", $row["DECIMAL_DIGITS"], "\n";
        echo "Nullable: ", $row["IS_NULLABLE"], "\n";
    }
}

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 24.0.9060