Skip to content

Instantly share code, notes, and snippets.

@y-ken
Last active December 17, 2015 02:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save y-ken/5539113 to your computer and use it in GitHub Desktop.
Save y-ken/5539113 to your computer and use it in GitHub Desktop.
mroongaでも以下SQLコマンドが利用可能なようです。もし差し支えなければ、ドキュメントの追加をご検討頂けると幸いです。 http://mroonga.org/ja/docs/reference.html

CREATE TABLE IF NOT EXISTS table_name (...)形式での動作テストは以下の通りです。

環境

  • CentOS-6.4
  • MySQL-5.6.11
  • mysql-mroonga-3.03

InnoDBでの動作

mysql> CREATE TABLE IF NOT EXISTS sample_table (
    ->   id INT PRIMARY KEY AUTO_INCREMENT,
    ->   contents TEXT
    -> ) ENGINE = InnoDB DEFAULT CHARSET utf8;
Query OK, 0 rows affected (0.02 sec)

mysql> CREATE TABLE IF NOT EXISTS sample_table (
    ->   id INT PRIMARY KEY AUTO_INCREMENT,
    ->   contents TEXT
    -> ) ENGINE = InnoDB DEFAULT CHARSET utf8;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> show warnings;
+-------+------+-------------------------------------+
| Level | Code | Message                             |
+-------+------+-------------------------------------+
| Note  | 1050 | Table 'sample_table' already exists |
+-------+------+-------------------------------------+
1 row in set (0.00 sec)

mysql> DROP TABLE IF exists sample_table;
Query OK, 0 rows affected (0.00 sec)

mroongaでの動作

mysql> CREATE TABLE  IF NOT EXISTS sample_table (
    ->   id INT PRIMARY KEY AUTO_INCREMENT,
    ->   contents TEXT
    -> ) ENGINE = mroonga DEFAULT CHARSET utf8;
Query OK, 0 rows affected (0.01 sec)

mysql> CREATE TABLE  IF NOT EXISTS sample_table (
    ->   id INT PRIMARY KEY AUTO_INCREMENT,
    ->   contents TEXT
    -> ) ENGINE = mroonga DEFAULT CHARSET utf8;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> show warnings;
+-------+------+-------------------------------------+
| Level | Code | Message                             |
+-------+------+-------------------------------------+
| Note  | 1050 | Table 'sample_table' already exists |
+-------+------+-------------------------------------+
1 row in set (0.00 sec)

mysql> DROP TABLE IF exists sample_table;
Query OK, 0 rows affected (0.01 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment