--- parser3/src/classes/file.C 2003/11/20 17:07:43 1.116 +++ parser3/src/classes/file.C 2004/03/02 14:56:42 1.121 @@ -1,11 +1,11 @@ /** @file Parser: @b file parser class. - Copyright (c) 2001-2003 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001-2004 ArtLebedev Group (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char * const IDENT_FILE_C="$Date: 2003/11/20 17:07:43 $"; +static const char * const IDENT_FILE_C="$Date: 2004/03/02 14:56:42 $"; #include "pa_config_includes.h" @@ -24,6 +24,7 @@ static const char * const IDENT_FILE_C=" #include "pa_vtable.h" #include "pa_charset.h" #include "pa_charsets.h" +#include "pa_sql_connection.h" // defines @@ -504,7 +505,7 @@ static void _lock(Request& r, MethodPara const String& file_spec=r.absolute(params.as_string(0, "file name must be string")); Lock_execute_body_info info={ &r, - ¶ms.as_junction(1, "body must be code"); + ¶ms.as_junction(1, "body must be code") }; file_write_action_under_lock(file_spec, "lock", lock_execute_body, &info); @@ -615,6 +616,12 @@ static void _fullpath(Request& r, Method r.write_assign_lang(*result); } +static void _sql_string(Request& r, MethodParams&) { + VFile& self=GET_SELF(r, VFile); + + const char *quoted=r.connection()->quote(self.value_ptr(), self.value_size()); + r.write_assign_lang(*new String(quoted)); +} // constructor @@ -667,4 +674,7 @@ MFile::MFile(): Methoded("file") { add_native_method("justext", Method::CT_STATIC, _justext, 1, 1); // /some/page.html: ^file:fullpath[a.gif] => /some/a.gif add_native_method("fullpath", Method::CT_STATIC, _fullpath, 1, 1); + + // ^file.sql-string[] + add_native_method("sql-string", Method::CT_DYNAMIC, _sql_string, 0, 0); }