PHP Conference Japan 2024

Table::getSchema

(沒有版本資訊,可能只存在於 Git 中)

Table::getSchema取得表格結構描述

說明

public mysql_xdevapi\Table::getSchema(): mysql_xdevapi\Schema

擷取與表格關聯的結構描述。

參數

此函式沒有參數。

回傳值

一個 Schema 物件。

範例

範例 #1 mysql_xdevapi\Table::getSchema() 範例

<?php
$session
= mysql_xdevapi\getSession("mysqlx://user:password@localhost");

$session->sql("DROP DATABASE IF EXISTS addressbook")->execute();
$session->sql("CREATE DATABASE addressbook")->execute();
$session->sql("CREATE TABLE addressbook.names(name text, age int)")->execute();
$session->sql("INSERT INTO addressbook.names values ('John', 42), ('Sam', 33)")->execute();

$schema = $session->getSchema("addressbook");
$table = $schema->getTable("names");

var_dump($table->getSchema());
?>

以上範例將會輸出類似以下的內容:

object(mysql_xdevapi\Schema)#9 (1) {
  ["name"]=>
  string(11) "addressbook"
}
新增筆記

使用者貢獻的筆記

這個頁面沒有使用者貢獻的筆記。
To Top