--- parser3/src/classes/op.C 2001/11/19 12:17:05 1.60 +++ parser3/src/classes/op.C 2001/12/06 20:23:44 1.62.2.1.2.1 @@ -4,7 +4,7 @@ Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) Author: Alexander Petrosyan (http://paf.design.ru) - $Id: op.C,v 1.60 2001/11/19 12:17:05 paf Exp $ + $Id: op.C,v 1.62.2.1.2.1 2001/12/06 20:23:44 paf Exp $ */ #include "classes.h" @@ -121,11 +121,11 @@ static void _process(Request& r, const S // evaluate source to process const String& source= - r.process(params->as_no_junction(0, "body must be string")).as_string(); + r.process(params->as_junction(0, "body must be code")).as_string(); // process source code, append processed methods to 'self' class // maybe-define new @main - r.use_buf(source.cstr(), place, &self_class); + r.use_buf(source.cstr(String::UL_UNSPECIFIED, r.connection), place, &self_class); // maybe-execute @main[] if(const Method *method=self_class.get_method(*main_method_name)) { @@ -232,17 +232,33 @@ static void _error(Request& r, const Str /// @todo rewrite ugly code with try/try to autoobject TempConnection static void _connect(Request& r, const String& method_name, MethodParams *params) { Pool& pool=r.pool(); - +#ifdef RESOURCES_DEBUG +struct timeval mt[2]; +#endif Value& url=params->as_no_junction(0, "url must not be code"); Value& body_code=params->as_junction(1, "body must be code"); Table *protocol2driver_and_client= static_cast(r.classes_conf.get(r.OP.name())); +#ifdef RESOURCES_DEBUG +//measure:before +gettimeofday(&mt[0],NULL); +#endif // connect SQL_Connection& connection=SQL_driver_manager->get_connection( url.as_string(), method_name, protocol2driver_and_client); +#ifdef RESOURCES_DEBUG +//measure:after connect +gettimeofday(&mt[1],NULL); + +double t[2]; +for(int i=0;i<2;i++) + t[i]=mt[i].tv_sec+mt[i].tv_usec/1000000.0; + +r.sql_connect_time+=t[1]-t[0]; +#endif // remember/set current connection SQL_Connection *saved_connection=r.connection; r.connection=&connection;