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.

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

Definition von Stored Procedures - eine Einführung

Stored Procedures sind vordefinierte SQL-Codeblöcke, die in einer Datenbank gespeichert sind und bei Bedarf aufgerufen werden können. ...

Bernie

Autor : ebiz-consult GmbH & Co. KG
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

MovieClip leeren (AS3)

Ich war wirklich besorgt um meine bachelorarbeit schreiben lassen​ (https://xn--ghostwriter-sterreich-sec.at/bachelorarbeit-schreiben-lassen/). ...

Geschrieben von Farebn am 26.04.2024 22:50:34
Forum: Grafik / Design / Flash ...
Berechnungen durchführen

Hallo liebe Forenmitglieder, meine erste frage ist zum Aufbau meiner kleinen Berechnungswebseite, nichts kommerzielles, soll nur eine Anwendung f ...

Geschrieben von matze511 am 21.04.2024 21:42:37
Forum: PHP Developer Forum
Professioneller Webentwickler & Webdesigner

Of course, here is the translation: Hello, Thank you for your interest in the long-term project. Your extensive skills and experience in web dev ...

Geschrieben von Athelstan am 15.04.2024 09:25:39
Forum: Jobgesuche
Wir stellen unsere SEO-Agentur vor

Hallo In der heutigen digitalen Welt war es für Unternehmen noch nie so einfach, ihre Reichweite weltweit zu vergrößern. Wenn Sie außerhalb I ...

Geschrieben von thomasmuller am 14.04.2024 07:18:33
Forum: User stellen sich vor