From 3a4bdadfed0e42205f3d0f9561dfcd3528ff1703 Mon Sep 17 00:00:00 2001 From: myun2 Date: Tue, 17 Apr 2012 19:10:55 +0900 Subject: [PATCH] db/pgsql_prepare.hpp Add. --- roast/include/roast/db/pgsql_prepare.hpp | 53 ++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 roast/include/roast/db/pgsql_prepare.hpp diff --git a/roast/include/roast/db/pgsql_prepare.hpp b/roast/include/roast/db/pgsql_prepare.hpp new file mode 100644 index 00000000..983411b0 --- /dev/null +++ b/roast/include/roast/db/pgsql_prepare.hpp @@ -0,0 +1,53 @@ +// Roast+ License + +/* + Prepared Statements +*/ +#ifndef __SFJP_ROAST__db__pgsql_prepare_HPP__ +#define __SFJP_ROAST__db__pgsql_prepare_HPP__ + +#include "roast/db/sql/sql_common.hpp" + +namespace roast +{ + namespace sql + { + namespace postgre + { + /////////////////////////////////////////////////////////////////////////////////// + // Prepared Statements + + namespace _op_names + { + // prepare.hpp + ROAST_LEXICAL_FIXSTR(prepare,"PREPARE"); + ROAST_LEXICAL_FIXSTR(execute,"EXECUTE"); + ROAST_LEXICAL_FIXSTR(_using,"USING"); + } + + // PREPARE (ex: PREPARE fooplan (int, text, bool, numeric) AS INSERT INTO foo VALUES($1, $2, $3, $4);) + template + struct prepate : public seq< + _op_names::prepate, _char::space, // PREPARE + _char::lpare, TYPES, _char::rpare, _char::space, // () + _op_names::as, _char::space, QUERY_BODY> // AS + { + }; + + /////////////////////////////////////////////////////////////////////////////////// + + // EXECUTE (ex: EXECUTE fooplan(1, 'Hunter Valley', 't', 200.00);) + template + class execute : public seq< + _op_names::execute, _char::space, // EXECUTE + _char::lpare, TYPES, _char::rpare> // () + { + }; + + + /////////////////////////////////////////////////////////////////////////// + } + } +} + +#endif//__SFJP_ROAST__db__pgsql_prepare_HPP__ -- 2.11.0