バージョン: v2.3.0
get
テーブルから単一のレコードを取得します。
get($table, $columns, $where)
table [string]
対象のテーブル名。
columns [string/array]
取得するカラム。
where [array] (省略可)
結果を絞り込むための WHERE 条件。
get($table, $join, $columns, $where)
table [string]
対象のテーブル名。
join [array]
関連テーブルを結合するための JOIN 定義。JOIN が不要な場合は省略できます。
columns [string/array]
取得するカラム。
where [array] (省略可)
結果を絞り込むための WHERE 条件。
戻り値
[mixed] 最初に一致したレコード。戻り値はスカラー値または連想配列です。
$email = $database->get("account", "email", [
"user_id" => 1234
]);
// 結果例:
// "foo@bar.com"
$profile = $database->get("account", [
"email",
"gender",
"location"
], [
"user_id" => 1234
]);
// 結果例:
// array(
// "email" => "foo@bar.com",
// "gender" => "female",
// "location" => "earth"
// )
$data = $database->get("post", [
"[>]account" => "user_id"
], [
"post.content",
"account.user_name",
"account.location"
], [
"ORDER" => "post.rate"
]);
// 結果例:
// array(
// "content" => "A new day",
// "user_name" => "foo",
// "location" => "earth"
// )