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.

Neuigkeiten für PHP-Entwickler: Laravel 11 Veröffentlichung

Am 12. März 2024 wurde die lang erwartete Version 11 des Laravel-Frameworks veröffentlicht, die eine Reihe von spannenden Neuerungen und Verbesserungen für die PHP-Entwicklungsgemeinschaft mit sich bringt. ...

Mike94

Autor : Mike94
Kategorie: PHP Magazin

Technisches SEO bleibt relevant

Technisches SEO – Was ist das überhaupt? Technisches SEO bezieht sich auf die Optimierung der technischen Aspekte deiner Webseite. Das Ziel ist klar! ...

admin

Autor : admin
Kategorie: SEO & Online-Marketing

Was ist neu in der PHP 8.2.10

PHP 8.2.10 ist eine der neuesten Versionen von PHP, die eine Reihe von Verbesserungen und neuen Funktionen mit sich bringt. In diesem Artikel werden wir einige der herausragenden Neuerungen und Verbesserungen dieser Version diskutieren. ...

admin

Autor : admin
Kategorie: Software-Updates

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

Seltsames Verhalten von execute() oder Fehler meinerseits

Hallo liebe Community, ich habe ein kleines Problem und vielleicht kann mir ja jemand helfen, würde ich mich sehr drüber freuen. Unten steht e ...

Geschrieben von garibaldiwz am 22.03.2024 13:03:12
Forum: SQL / Datenbanken
Google reCAPTCHA in Kontaktformular einbinden

Überprüfen Sie den E-Mail-Versand: Stellen Sie sicher, dass die E-Mail-Funktion mail() ordnungsgemäß funktioniert und dass keine Fehler beim V ...

Geschrieben von Gast am 18.03.2024 04:54:16
Forum: PHP Developer Forum
`count.php`

Hallo cober93327, und Danke fuer deine Antwort! :-) Naja, so einen "Besucherzähler" auf der Webseite anzuzeigen ist schon eher etwas, das man a ...

Geschrieben von kekse1 am 17.03.2024 15:56:38
Forum: Projekthilfe
`count.php`

Es gibt dazu natuerlich auch eine recht ausfuehrliche Dokumentation in meinem GitHub-Repository Es würde meiner Ansicht nach enorm helfen, wenn D ...

Geschrieben von cober93327 am 14.03.2024 15:49:28
Forum: Projekthilfe