Ground Sunlight

Windowsで作る - PHPプログラミングの開発環境

ユーザ用ツール

サイト用ツール


apricot:usage:ja:database

差分

このページの2つのバージョン間の差分を表示します。

この比較画面にリンクする

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
apricot:usage:ja:database [2020/08/25 20:36]
y2sunlight
apricot:usage:ja:database [2020/09/17 15:05] (現在)
y2sunlight [Idiormの設定ファイル]
行 17: 行 17:
   * [[apricot:usage:ja:validation|Apricot バリデーション]]   * [[apricot:usage:ja:validation|Apricot バリデーション]]
   * [[apricot:usage:ja:provider|Apricot サービスプロバイダー]]   * [[apricot:usage:ja:provider|Apricot サービスプロバイダー]]
 +  * [[apricot:usage:ja:authentication|Apricot ユーザ認証]]
   * [[apricot:usage:ja:utility|Apricot ユーティリティ]]   * [[apricot:usage:ja:utility|Apricot ユーティリティ]]
  
行 25: 行 26:
 Apricotでは、ORマッパーに[[basic-library:idiorm:1.5|Idiorm]]を使用します。詳しい使い方やメソッドについてはIdiormの[[https://idiorm.readthedocs.io/en/latest/|マニュアル]]を参照して下さい。 Apricotでは、ORマッパーに[[basic-library:idiorm:1.5|Idiorm]]を使用します。詳しい使い方やメソッドについてはIdiormの[[https://idiorm.readthedocs.io/en/latest/|マニュアル]]を参照して下さい。
  
-Idiormの典型的な使用例を示します:+Idiorm の典型的な使用例を示します:
  
 <code php> <code php>
行 63: 行 64:
             'driver_options' => [PDO::MYSQL_ATTR_INIT_COMMAND => 'set names utf8'],             'driver_options' => [PDO::MYSQL_ATTR_INIT_COMMAND => 'set names utf8'],
             'check_tables' => 'show tables like \'user\'',             'check_tables' => 'show tables like \'user\'',
 +            'initial_statements'=> [
 +                'set names utf8',
 +            ],
         ],         ],
     ],     ],
行 106: 行 110:
   * driver_options --- データベースドライバー毎のオプション   * driver_options --- データベースドライバー毎のオプション
   * check_tables --- アプリケーションで使用するテーブルの存在を確認するSQL文   * check_tables --- アプリケーションで使用するテーブルの存在を確認するSQL文
 +  * initial_statements --- 接続直後に実行する初期化SQL文
  
 ''connection_string'' は必須です。''db_file'' は SQLite のようなファイル共有型のデータベースの場合に必要で、''username'' と ''password'' は MySQL のようなクライアント-サーバ型のデータベースの場合に必要になります。''connection_string'' と ''driver_options'' についてはを PHPの[[https://www.php.net/manual/en/pdo.drivers.php|PDO driver-specific documentation]] 参照して下さい。 ''connection_string'' は必須です。''db_file'' は SQLite のようなファイル共有型のデータベースの場合に必要で、''username'' と ''password'' は MySQL のようなクライアント-サーバ型のデータベースの場合に必要になります。''connection_string'' と ''driver_options'' についてはを PHPの[[https://www.php.net/manual/en/pdo.drivers.php|PDO driver-specific documentation]] 参照して下さい。
行 112: 行 117:
  
 ''check_tables'' はオプションで、アプリケーションで使用するテーブルの存在を調べるSQLクエリ文を設定します。詳しくは次項の[[#テーブルの作成|Idiormのセットアップ]]を参照して下さい。 ''check_tables'' はオプションで、アプリケーションで使用するテーブルの存在を調べるSQLクエリ文を設定します。詳しくは次項の[[#テーブルの作成|Idiormのセットアップ]]を参照して下さい。
 +
 +''initial_statements'' はオプションで、データベースとの接続直後に実行するSQL文を設定します。このSQL文は複数指定することができます。
  
 === initial_data === === initial_data ===
apricot/usage/ja/database.1598355376.txt.gz · 最終更新: 2020/08/25 20:36 by y2sunlight