--- parser3/src/classes/table.C 2017/12/03 23:36:23 1.345 +++ parser3/src/classes/table.C 2020/12/14 20:58:15 1.352 @@ -5,6 +5,16 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ +#include "pa_config_includes.h" + +#define NO_STRINGSTREAM + +#if (!defined(NO_STRINGSTREAM) && !defined(FREEBSD4) && !defined(PA_DEBUG_DISABLE_GC)) +#include +#include "../lib/gc/include/gc_allocator.h" +#define USE_STRINGSTREAM +#endif + #include "classes.h" #include "pa_vmethod_frame.h" @@ -17,12 +27,7 @@ #include "pa_vbool.h" #include "pa_array.h" -#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.345 2017/12/03 23:36:23 moko Exp $"; +volatile const char * IDENT_TABLE_C="$Id: table.C,v 1.352 2020/12/14 20:58:15 moko Exp $"; // class @@ -37,16 +42,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,15 +411,11 @@ 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; @@ -644,7 +637,7 @@ static void _save(Request& r, MethodPara --param_index; const String& file_name=params.as_string(param_index++, FILE_NAME_MUST_NOT_BE_CODE); - String file_spec=r.absolute(file_name); + String file_spec=r.full_disk_path(file_name); if(do_append && file_exist(file_spec)) output_column_names=false; @@ -1303,7 +1296,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 +1331,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);