DBIx-MyParse
view release on metacpan or search on metacpan
my_parse_cc.cc view on Meta::CPAN
/*
DBIx::MyParse - a glue between Perl and MySQL's SQL parser
Copyright (C) 2005 - 2007 Philip Stoev
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#define EMBEDDED_LIBRARY
#define MYSQL_SERVER
#include <sql/mysql_priv.h>
#include <mysql.h>
#include <libmysqld/embedded_priv.h>
#include <my_parse.h>
#include <my_enum.h>
#include <my_define.h>
static THD * global_thd;
perl_object * my_parse_inner(THD * thd, st_select_lex * select_lex, bool in_subquery);
perl_object * my_parse_item(THD * thd, Item * item);
perl_object * my_parse_tables_obj(THD * thd, st_select_lex * select_lex, perl_object * query_perl, List<TABLE_LIST> * tables);
perl_object * my_parse_tables_list(THD * thd, st_select_lex * select_lex, perl_object * query_perl, TABLE_LIST * start_table);
perl_object * my_parse_list_items(THD * thd, perl_object * query_perl, List<Item> list) {
perl_object * array_perl = my_parse_create_array();
List_iterator_fast<Item> iterator(list);
Item *item;
while ((item = iterator++)) {
my_parse_set_array(
array_perl,
MYPARSE_ARRAY_APPEND,
my_parse_item(thd, item),
MYPARSE_ARRAY_REF
);
}
return array_perl;
}
perl_object * my_parse_list_strings(List<String> list) {
perl_object * array_perl = my_parse_create_array();
List_iterator_fast<String> iterator(list);
String *str;
while ((str = iterator++)) {
my_parse_set_array( array_perl, MYPARSE_ARRAY_APPEND, (void *) str->ptr(), MYPARSE_ARRAY_STRING);
}
return array_perl;
}
perl_object * my_parse_table(THD * thd, st_select_lex * select_lex, perl_object * query_perl, perl_object * join_perl, st_table_list * table) {
perl_object * table_perl = my_parse_create_array();
if (table->alias) {
my_parse_set_array( table_perl, MYPARSE_ITEM_ALIAS, (void *) table->alias, MYPARSE_ARRAY_STRING);
}
if (table->outer_join == JOIN_TYPE_LEFT) {
( run in 0.467 second using v1.01-cache-2.11-cpan-71847e10f99 )