--- parser3/src/classes/table.C 2017/05/17 14:22:11 1.343 +++ parser3/src/classes/table.C 2019/11/23 23:48:41 1.349 @@ -17,12 +17,12 @@ #include "pa_vbool.h" #include "pa_array.h" -#if (!defined(NO_STRINGSTREAM) && !defined(FREEBSD4)) +#if (!defined(NO_STRINGSTREAM) && !defined(FREEBSD4) && !defined(PA_DEBUG_DISABLE_GC)) #include #define USE_STRINGSTREAM #endif -volatile const char * IDENT_TABLE_C="$Id: table.C,v 1.343 2017/05/17 14:22:11 moko Exp $"; +volatile const char * IDENT_TABLE_C="$Id: table.C,v 1.349 2019/11/23 23:48:41 moko Exp $"; // class @@ -37,16 +37,9 @@ public: DECLARE_CLASS_VAR(table, new MTable); -#define TABLE_REVERSE_NAME "reverse" - // globals -String sql_bind_name(SQL_BIND_NAME); -String sql_limit_name(PA_SQL_LIMIT_NAME); -String sql_offset_name(PA_SQL_OFFSET_NAME); -String sql_default_name(SQL_DEFAULT_NAME); -String sql_distinct_name(SQL_DISTINCT_NAME); -String sql_value_type_name(SQL_VALUE_TYPE_NAME); +#define TABLE_REVERSE_NAME "reverse" String table_reverse_name(TABLE_REVERSE_NAME); // methods @@ -413,12 +406,8 @@ static void _load(Request& r, MethodPara HashStringValue *options=0; TableControlChars control_chars; - if(options_param_index, gc_allocator > pa_stringstream; typedef std::basic_string, gc_allocator > pa_string; @@ -1016,7 +1005,7 @@ static void _hash(Request& r, MethodPara } #ifndef DOXYGEN -struct Table_seq_item { +struct Table_seq_item : public PA_Allocated { ArrayString* row; union { const char *c_str; @@ -1048,7 +1037,7 @@ static void _sort(Request& r, MethodPara Table& old_table=GET_SELF(r, VTable).table(); Table& new_table=*new Table(old_table.columns()); - Table_seq_item* seq=new(PointerFreeGC) Table_seq_item[old_table.count()]; + Table_seq_item* seq=new Table_seq_item[old_table.count()]; int i; // calculate key values @@ -1303,7 +1292,11 @@ public: return true; } } - bool before_rows(SQL_Error& error) { + bool before_rows(SQL_Error& error) { + if(table) { + error=SQL_Error("result must contain exactly one table"); + return true; + } try { table=new Table(&columns); columns_count=columns.count(); @@ -1334,11 +1327,7 @@ public: }; #endif -static void marshal_bind( - HashStringValue::key_type aname, - HashStringValue::value_type avalue, - SQL_Driver::Placeholder** pptr) -{ +static void marshal_bind( HashStringValue::key_type aname, HashStringValue::value_type avalue, SQL_Driver::Placeholder** pptr) { SQL_Driver::Placeholder& ph=**pptr; ph.name=aname.cstr(); ph.value=avalue->as_string().untaint_cstr(String::L_AS_IS); @@ -1351,7 +1340,7 @@ static void marshal_bind( // not static, used elsewhere int marshal_binds(HashStringValue& hash, SQL_Driver::Placeholder*& placeholders) { int hash_count=hash.count(); - placeholders=new SQL_Driver::Placeholder[hash_count]; + placeholders=new(PointerGC) SQL_Driver::Placeholder[hash_count]; SQL_Driver::Placeholder* ptr=placeholders; hash.for_each(marshal_bind, &ptr); return hash_count;