複数の PRIMARY KEY 指定について
2006年3月25日
対処しなければならない模様。
MySQL:
現在のSQLite:
このテーブルに、次のようにデータ挿入ができなければならない。
(追記:解決)
これは、Nucleus のプラグインオプションに用いられているものであるが、ソースコード(PLUGIN.php)を見てみると、auto_increment 部分の機能は使用していない様である。従って、テーブルを以下のように作成すればよいらしい。
現在の仕様(ver 0.53)では、以下のMySQLクエリーを実行すると、それが上記のように翻訳される。
MySQL:
CREATE TABLE nucleus_plugin_option( ovalue text DEFAULT '' NOT NULL, oid int(11) NOT NULL auto_increment, ocontextid int(11) DEFAULT '0' NOT NULL, PRIMARY KEY (oid, ocontextid) );
現在のSQLite:
CREATE TABLE 'nucleus_plugin_option' ( ovalue text DEFAULT '' NOT NULL, oid INTEGER NOT NULL PRIMARY KEY, ocontextid int(11) DEFAULT '0' NOT NULL )
このテーブルに、次のようにデータ挿入ができなければならない。
INSERT INTO nucleus_plugin_option (ovalue, oid, ocontextid) VALUES( 'yes', '85', '1'); INSERT INTO nucleus_plugin_option (ovalue, oid, ocontextid) VALUES( 'yes', '85', '2');
(追記:解決)
これは、Nucleus のプラグインオプションに用いられているものであるが、ソースコード(PLUGIN.php)を見てみると、auto_increment 部分の機能は使用していない様である。従って、テーブルを以下のように作成すればよいらしい。
CREATE TABLE 'nucleus_plugin_option' ( ovalue text DEFAULT '' NOT NULL, oid int(11) DEFAULT '0' NOT NULL, ocontextid int(11) DEFAULT '0' NOT NULL, PRIMARY KEY (oid,ocontextid) )
現在の仕様(ver 0.53)では、以下のMySQLクエリーを実行すると、それが上記のように翻訳される。
CREATE TABLE nucleus_plugin_option( ovalue text DEFAULT '' NOT NULL, oid int(11) DEFAULT '0' NOT NULL, ocontextid int(11) DEFAULT '0' NOT NULL, PRIMARY KEY (oid, ocontextid) );