--- parser3/src/classes/void.C 2004/06/22 14:12:57 1.34 +++ parser3/src/classes/void.C 2007/02/03 18:08:38 1.37 @@ -1,11 +1,11 @@ /** @file Parser: @b VOID parser class. - Copyright (c) 2001-2004 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001-2005 ArtLebedev Group (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char * const IDENT_VOID_C="$Date: 2004/06/22 14:12:57 $"; +static const char * const IDENT_VOID_C="$Date: 2007/02/03 18:08:38 $"; #include "classes.h" #include "pa_vmethod_frame.h" @@ -14,6 +14,7 @@ static const char * const IDENT_VOID_C=" #include "pa_vint.h" #include "pa_vdouble.h" #include "pa_vvoid.h" +#include "pa_vbool.h" #include "pa_sql_connection.h" // externs @@ -59,6 +60,12 @@ static void _double(Request& r, MethodPa params.count()==0?vvoid.as_double():params.as_double(0, "default must be double", r))); } +static void _bool(Request& r, MethodParams& params) { + VVoid& vvoid=GET_SELF(r, VVoid); + r.write_no_lang(*new VBool( + params.count()==0?vvoid.as_bool():params.as_bool(0, "default must be bool", r))); +} + #ifndef DOXYGEN class Void_sql_event_handlers: public SQL_Driver_query_event_handlers { const String& statement_string; @@ -87,7 +94,7 @@ static void _sql(Request& r, MethodParam HashStringValue* bind=0; if(params.count()>1) { Value& voptions=params.as_no_junction(1, "options must be hash, not code"); - if(!voptions.is_string()) + if(voptions.is_defined() && !voptions.is_string()) if(HashStringValue* options=voptions.get_hash()) { int valid_options=0; if(Value* vbind=options->get(sql_bind_name)) { @@ -170,6 +177,10 @@ MVoid::MVoid(): Methoded("void") { // ^void.double(default) add_native_method("double", Method::CT_DYNAMIC, _double, 0, 1); + // ^void.bool[] + // ^void.bool(default) + add_native_method("bool", Method::CT_DYNAMIC, _bool, 0, 1); + // ^sql[query] add_native_method("sql", Method::CT_STATIC, _sql, 1, 2);