PDO::cubrid_schema

(PECL PDO_CUBRID >= 8.3.0.0001)

PDO::cubrid_schemaGet the requested schema information

Beschreibung

public PDO::cubrid_schema(int $schema_type, string $table_name = ?, string $col_name = ?): array

This function is used to get the requested schema information from database. You have to designate table_name, if you want to get information on certain table, col_name, if you want to get information on certain column (can be used only with PDO::CUBRID_SCH_COL_PRIVILEGE).

The result of this function is returned as a two-dimensional array (column (associative array) * row (numeric array)). The following tables shows types of schema and the column structure of the result array to be returned based on the schema type.

Result Composition of Each Type
Schema Column Number Column Name Value
PDO::CUBRID_SCH_TABLE 1 NAME  
  2 TYPE 0:system table 1:view 2:table
PDO::CUBRID_SCH_VIEW 1 NAME  
  2 TYPE 1:view
PDO::CUBRID_SCH_QUERY_SPEC 1 QUERY_SPEC  
PDO::CUBRID_SCH_ATTRIBUTE / PDO::CUBRID_SCH_TABLE_ATTRIBUTE 1 ATTR_NAME  
  2 DOMAIN  
  3 SCALE  
  4 PRECISION  
  5 INDEXED 1:indexed
  6 NOT NULL 1:not null
  7 SHARED 1:shared
  8 UNIQUE 1:unique
  9 DEFAULT  
  10 ATTR_ORDER base:1
  11 CLASS_NAME  
  12 SOURCE_CLASS  
  13 IS_KEY 1:key
PDO::CUBRID_SCH_METHOD / PDO::CUBRID_SCH_TABLE_METHOD 1 NAME  
  2 RET_DOMAIN  
  3 ARG_DOMAIN  
PDO::CUBRID_SCH_METHOD_FILE 1 METHOD_FILE  
PDO::CUBRID_SCH_SUPER_TABLE / PDO::CUBRID_SCH_DIRECT_SUPER_TABLE / PDO::CUBRID_SCH_SUB_TABLE 1 CLASS_NAME  
  2 TYPE 0:system table 1:view 2:table
PDO::CUBRID_SCH_CONSTRAINT 1 TYPE 0:unique 1:index 2:reverse unique 3:reverse index
  2 NAME  
  3 ATTR_NAME  
  4 NUM_PAGES  
  5 NUM_KEYS  
  6 PRIMARY_KEY 1:primary key
  7 KEY_ORDER base:1
PDO::CUBRID_SCH_TRIGGER 1 NAME  
  2 STATUS  
  3 EVENT  
  4 TARGET_CLASS  
  5 TARGET_ATTR  
  6 ACTION_TIME  
  7 ACTION  
  8 PRIORITY  
  9 CONDITION_TIME  
  10 CONDITION  
PDO::CUBRID_SCH_TABLE_PRIVILEGE / PDO::CUBRID_SCH_COL_PRIVILEGE 1 CLASS_NAME / ATTR_NAME  
  2 PRIVILEGE  
  3 GRANTABLE  
PDO::CUBRID_SCH_PRIMARY_KEY 1 CLASS_NAME  
  2 ATTR_NAME  
  3 KEY_SEQ base:1
  4 KEY_NAME  
PDO::CUBRID_SCH_IMPORTED_KEYS / PDO::CUBRID_SCH_EXPORTED_KEYS / PDO::CUBRID_SCH_CROSS_REFERENCE 1 PKTABLE_NAME  
  2 PKCOLUMN_NAME  
  3 FKTABLE_NAME base:1
  4 FKCOLUMN_NAME  
  5 KEY_SEQ base:1
  6 UPDATE_ACTION 0:cascade 1:restrict 2:no action 3:set null
  7 DELETE_ACTION 0:cascade 1:restrict 2:no action 3:set null
  8 FK_NAME  
  9 PK_NAME  

Parameter-Liste

schema_type

Schema type that you want to know.

table_name

Table you want to know the schema of.

col_name

Column you want to know the schema of.

Rückgabewerte

Array containing the schema information, when process is successful;

FALSE, when process is unsuccessful

Beispiele

Beispiel #1 A PDO::cubrid_schema() example

This example shows how to get primary key and foreign keys of table game.

<?php
$pk_list 
$dbh->cubrid_schema(PDO::CUBRID_SCH_PRIMARY_KEY"game");
print_r($pk_list);

$fk_list $dbh->cubrid_schema(PDO::CUBRID_SCH_IMPORTED_KEYS"game");
print_r($fk_list);
?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

Result:
Array
(
    [0] => Array
        (
            [CLASS_NAME] => game
            [ATTR_NAME] => athlete_code
            [KEY_SEQ] => 3
            [KEY_NAME] => pk_game_host_year_event_code_athlete_code
        )

    [1] => Array
        (
            [CLASS_NAME] => game
            [ATTR_NAME] => event_code
            [KEY_SEQ] => 2
            [KEY_NAME] => pk_game_host_year_event_code_athlete_code
        )

    [2] => Array
        (
            [CLASS_NAME] => game
            [ATTR_NAME] => host_year
            [KEY_SEQ] => 1
            [KEY_NAME] => pk_game_host_year_event_code_athlete_code
        )

)
Array
(
    [0] => Array
        (
            [PKTABLE_NAME] => athlete
            [PKCOLUMN_NAME] => code
            [FKTABLE_NAME] => game
            [FKCOLUMN_NAME] => athlete_code
            [KEY_SEQ] => 1
            [UPDATE_RULE] => 1
            [DELETE_RULE] => 1
            [FK_NAME] => fk_game_athlete_code
            [PK_NAME] => pk_athlete_code
        )

    [1] => Array
        (
            [PKTABLE_NAME] => event
            [PKCOLUMN_NAME] => code
            [FKTABLE_NAME] => game
            [FKCOLUMN_NAME] => event_code
            [KEY_SEQ] => 1
            [UPDATE_RULE] => 1
            [DELETE_RULE] => 1
            [FK_NAME] => fk_game_event_code
            [PK_NAME] => pk_event_code
        )

)

Hier Kannst Du einen Kommentar verfassen


Bitte gib mindestens 10 Zeichen ein.
Wird geladen... Bitte warte.
* Pflichtangabe
Es sind noch keine Kommentare vorhanden.

PHP cURL-Tutorial: Verwendung von cURL zum Durchführen von HTTP-Anfragen

cURL ist eine leistungsstarke PHP-Erweiterung, die es Ihnen ermöglicht, mit verschiedenen Servern über verschiedene Protokolle wie HTTP, HTTPS, FTP und mehr zu kommunizieren. ...

TheMax

Autor : TheMax
Kategorie: PHP-Tutorials

Midjourney Tutorial - Anleitung für Anfänger

Über Midjourney, dem Tool zur Erstellung digitaler Bilder mithilfe von künstlicher Intelligenz, gibt es ein informatives Video mit dem Titel "Midjourney Tutorial auf Deutsch - Anleitung für Anfänger" ...

Mike94

Autor : Mike94
Kategorie: KI Tutorials

Grundlagen von Views in MySQL

Views in einer MySQL-Datenbank bieten die Möglichkeit, eine virtuelle Tabelle basierend auf dem Ergebnis einer SQL-Abfrage zu erstellen. ...

admin

Autor : admin
Kategorie: mySQL-Tutorials

Tutorial veröffentlichen

Tutorial veröffentlichen

Teile Dein Wissen mit anderen Entwicklern weltweit

Du bist Profi in deinem Bereich und möchtest dein Wissen teilen, dann melde dich jetzt an und teile es mit unserer PHP-Community

mehr erfahren

Tutorial veröffentlichen

Abfrage in Datenbank

Als Zeiger für die Fremdschlüsselspalte in der Yardmanagement-Tabelle verwenden Sie immer den Hauptschlüssel der Stellplatztabelle. Dieser Frem ...

Geschrieben von waderatke am 30.05.2024 04:49:31
Forum: SQL / Datenbanken
Abfrage über mehrere Spalten und Gruppierung

Sowohl der Zeitrahmen als auch die Verfahren müssen anpassbar sein, da die Dauer mit jedem Monat länger wird. Darüber hinaus müssen Prozesse a ...

Geschrieben von waderatke am 30.05.2024 04:43:42
Forum: SQL / Datenbanken
Finden Sie die Bestellungen des letzten Monats und die Gesamtausgaben

Ich möchte alle Kunden finden, die im letzten Monat eine Bestellung aufgegeben haben, und den Gesamtbetrag, den jeder Kunde ausgegeben hat. Wenn ...

Geschrieben von Gast am 28.05.2024 11:54:53
Forum: SQL / Datenbanken
PHP cURL Error

Hello I am facing an issue with cURL in my PHP application. When trying to make a secure HTTPS request, I am getting the following error: cURL e ...

Geschrieben von nolanmaris am 27.05.2024 18:27:56
Forum: PHP Developer Forum