OSDN Git Service

table.hpp: CREATE TABLEにTEMPORARY、IF NOT EXISTSを対応
authormyun2 <myun2@nwhite.info>
Wed, 18 Apr 2012 03:02:11 +0000 (12:02 +0900)
committermyun2 <myun2@nwhite.info>
Wed, 18 Apr 2012 03:02:11 +0000 (12:02 +0900)
roast/include/roast/db/sql/create_table_detail.hpp
roast/include/roast/db/sql/sql_common.hpp
roast/include/roast/db/sql/table.hpp

index 2b8afb5..9046343 100644 (file)
@@ -14,7 +14,8 @@ namespace roast
        namespace sql
        {
                ///////////////////////////////////////////////////////////////////////////////////
-
+               
+               //      Column Type
                template <typename COLUMN_NAME, typename DATA_TYPE, typename OPTIONS=EmptyType>
                class create_table_column_ : public seq<
                        COLUMN_NAME, _char::space,
@@ -30,6 +31,29 @@ namespace roast
                {
                };
                
+               ///////////////////////////////////
+               
+               //      TEMPORARY
+               template <bool _IsTemporary>    //      is true
+               class _temporary : public seq<_op_names::temporary, _char::space>
+               {
+               };
+               template <>
+               class _temporary<false> : public empty
+               {
+               };
+
+               //      IF NOT EXISTS
+               template <bool _IsExistNotCreate>       //      is true
+               class _if_not_exists : public seq<_op_names::if_not_exists, _char::space>
+               {
+               };
+               template <>     //      is true
+               class _if_not_exists<false> : public empty
+               {
+               };
+
+               
                ///////////////////////////////////////////////////////////////////////////
        }
 }
index 9ce7b98..df50ced 100644 (file)
@@ -24,6 +24,7 @@ namespace roast
                }
 
                using ::roast::lexical::rule::seq;
+               using ::roast::lexical::rule::empty;
                
                ////////////////////////////////////////////
                
index 2e39524..6e60248 100644 (file)
@@ -17,9 +17,11 @@ namespace roast
                ///////////////////////////////////////////////////////////////////////////////////
                
                //      CREATE TABLE
-               template <typename TABLE_NAME, typename COLUMNS>
+               template <typename TABLE_NAME, typename COLUMNS,
+                       bool _IsTemporary=false, bool _IsExistNotCreate=false>
                class create_table_ : public seq<
-                       _op_names::create, _char::space, _op_names::table, _char::space,        //      CREATE TABLE
+                       _op_names::create, _char::space, _temporary<_IsTemporary>,                      //      CREATE [TEMPORARY]
+                       _op_names::table, _char::space, _if_not_exists<_IsExistNotCreate>,      //      TABLE [IF NOT EXISTS]
                        TABLE_NAME, _char::space, _char::lpare, COLUMNS, _char::rpare>          //      <TABLE NAME> (<COLUMNS>)
                {
                };