1 // ANNA - Anna is Not Nothingness Anymore //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
11 #include <anna/config/defines.hpp>
13 #include <anna/dbms.mysql/OracleTranslator.hpp>
17 using namespace anna::dbms;
19 mysql::OracleTranslator mysql::OracleTranslator::st_this;
22 * Pone las sentencias SQL escritas para Oracle en el formato que necesita el
25 * La sentencia Oracle podría ser algo así como:
26 * insert into foo (a, b, c) values (:x, :y, :zzzz)
27 * update goo set xx=&value where yy=:zzz
29 * Y Debería quedar algo así:
30 * insert into foo (a, b, c) values (?,?,?)
31 * update goo set xx=? where yy=?
33 const char* mysql::OracleTranslator::apply(const char* statement)
34 throw(RuntimeException) {
37 if(anna_strchr(statement, ':') != NULL)
39 else if(anna_strchr(statement, '&') != NULL)
46 enum { Copying, Filtering };
51 while((character = *statement) != 0) {
55 if(character == ':' || character == '&') {
64 if(character == ',' || character == ')' || isspace(character) || iscntrl(character)) {
79 void mysql::OracleTranslator::allocate(const char* statement)
81 const int size = anna_strlen(statement);
89 a_buffer = new char [a_size = size + 1];