Annotation of parser3/src/classes/op.C, revision 1.72

1.1       paf         1: /** @file
1.9       paf         2:        Parser: parser @b operators.
1.1       paf         3: 
1.70      paf         4:        Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com)
1.71      paf         5:        Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
1.1       paf         6: 
1.72    ! paf         7:        $Id: op.C,v 1.71 2002/02/08 08:30:10 paf Exp $
1.1       paf         8: */
                      9: 
1.13      paf        10: #include "classes.h"
1.1       paf        11: #include "pa_common.h"
                     12: #include "pa_request.h"
                     13: #include "pa_vint.h"
                     14: #include "pa_sql_connection.h"
                     15: 
1.18      parser     16: // limits
                     17: 
                     18: #define MAX_LOOPS 10000
                     19: 
1.10      paf        20: // defines
                     21: 
                     22: #define OP_CLASS_NAME "OP"
1.11      paf        23: 
1.10      paf        24: // class
                     25: 
                     26: class MOP : public Methoded {
                     27: public:
                     28:        MOP(Pool& pool);
1.11      paf        29: public: // Methoded
1.10      paf        30:        bool used_directly() { return true; }
1.11      paf        31:        void configure_user(Request& r);
1.36      parser     32: 
1.11      paf        33: private:
                     34:        String main_sql_name;
                     35:        String main_sql_drivers_name;
1.10      paf        36: };
                     37: 
                     38: // methods
                     39: 
1.5       paf        40: static void _if(Request& r, const String&, MethodParams *params) {
1.48      parser     41:        Value& condition_code=params->as_junction(0, "condition must be expression");
1.1       paf        42: 
                     43:        bool condition=r.process(condition_code, 
                     44:                0/*no name*/,
                     45:                false/*don't intercept string*/).as_bool();
1.6       paf        46:        if(condition)
1.34      parser     47:                r.write_pass_lang(r.process(params->as_junction(1, "'then' parameter must be code")));
1.50      parser     48:        else if(params->size()>2)
1.34      parser     49:                r.write_pass_lang(r.process(params->as_junction(2, "'else' parameter must be code")));
1.1       paf        50: }
                     51: 
1.5       paf        52: static void _untaint(Request& r, const String& method_name, MethodParams *params) {
1.1       paf        53:        Pool& pool=r.pool();
                     54: 
1.60      paf        55:        uchar lang;
1.59      paf        56:        if(params->size()==1)
                     57:                lang=String::UL_AS_IS; // mark as simply 'tainted'. useful in html from sql 
                     58:        else {
                     59:                const String& lang_name=params->as_string(0, "lang must be string");
1.60      paf        60:                lang=untaint_lang_name2enum->get_int(lang_name);
1.59      paf        61:                if(!lang)
                     62:                        throw Exception(0, 0,
                     63:                                &lang_name,
                     64:                                "invalid taint language");
                     65:        }
1.1       paf        66: 
                     67:        {
1.59      paf        68:                Value& vbody=params->as_junction(params->size()-1, "body must be code");
1.1       paf        69:                
                     70:                Temp_lang temp_lang(r, lang); // set temporarily specified ^untaint[language;
1.5       paf        71:                r.write_pass_lang(r.process(vbody)); // process marking tainted with that lang
1.1       paf        72:        }
                     73: }
                     74: 
1.5       paf        75: static void _taint(Request& r, const String&, MethodParams *params) {
1.1       paf        76:        Pool& pool=r.pool();
                     77: 
1.60      paf        78:        uchar lang;
1.1       paf        79:        if(params->size()==1)
                     80:                lang=String::UL_TAINTED; // mark as simply 'tainted'. useful in table:set
                     81:        else {
1.48      parser     82:                const String& lang_name=params->as_string(0, "lang must be string");
1.60      paf        83:                lang=untaint_lang_name2enum->get_int(lang_name);
1.1       paf        84:                if(!lang)
1.53      parser     85:                        throw Exception(0, 0,
1.3       paf        86:                                &lang_name,
                     87:                                "invalid taint language");
1.1       paf        88:        }
                     89: 
                     90:        {
1.34      parser     91:                Value& vbody=params->as_no_junction(params->size()-1, "body must not be code");
1.1       paf        92:                
                     93:                String result(r.pool());
                     94:                result.append(
                     95:                        vbody.as_string(),  // process marking tainted with that lang
                     96:                        lang, true);  // force result language to specified
                     97:                r.write_pass_lang(result);
                     98:        }
                     99: }
                    100: 
1.5       paf       101: static void _process(Request& r, const String& method_name, MethodParams *params) {
1.1       paf       102:        // calculate pseudo file name of processed chars
                    103:        // would be something like "/some/file(4) process"
                    104:        char place[MAX_STRING];
                    105: #ifndef NO_STRING_ORIGIN
                    106:        const Origin& origin=method_name.origin();
                    107:        snprintf(place, MAX_STRING, "%s(%d) %s", 
                    108:                origin.file, 1+origin.line,
                    109:                method_name.cstr());
                    110: #else
1.39      parser    111:        strncpy(place, method_name.cstr(), MAX_STRING-1); place[MAX_STRING-1]=0;
1.1       paf       112: #endif 
                    113: 
                    114:        VStateless_class& self_class=*r.self->get_class();
                    115:        {
                    116:                // temporary zero @main so to maybe-replace it in processed code
                    117:                Temp_method temp_method_main(self_class, *main_method_name, 0);
                    118:                // temporary zero @auto so it wouldn't be auto-called in Request::use_buf
                    119:                Temp_method temp_method_auto(self_class, *auto_method_name, 0);
                    120:                
                    121:                // evaluate source to process
                    122:                const String& source=
1.61      paf       123:                        r.process(params->as_junction(0, "body must be code")).as_string();
1.1       paf       124: 
                    125:                // process source code, append processed methods to 'self' class
                    126:                // maybe-define new @main
1.67      paf       127:                r.use_buf(
                    128:                        source.cstr(String::UL_UNSPECIFIED, r.connection(0)), 
                    129:                        place, 
                    130:                        &self_class);
1.1       paf       131:                
                    132:                // maybe-execute @main[]
                    133:                if(const Method *method=self_class.get_method(*main_method_name)) {
                    134:                        // execute!     
                    135:                        r.execute(*method->parser_code);
                    136:                }
                    137:        }
                    138: }
                    139:        
1.5       paf       140: static void _rem(Request& r, const String&, MethodParams *params) {
1.34      parser    141:        params->as_junction(0, "body must be code");
1.1       paf       142: }
                    143: 
1.5       paf       144: static void _while(Request& r, const String& method_name, MethodParams *params) {
1.1       paf       145:        Pool& pool=r.pool();
                    146: 
1.34      parser    147:        Value& vcondition=params->as_junction(0, "condition must be expression");
                    148:        Value& body=params->as_junction(1, "body must be code");
1.1       paf       149: 
                    150:        // while...
                    151:        int endless_loop_count=0;
                    152:        while(true) {
1.18      parser    153:                if(++endless_loop_count>=MAX_LOOPS) // endless loop?
1.53      parser    154:                        throw Exception(0, 0,
1.1       paf       155:                                &method_name,
                    156:                                "endless loop detected");
                    157: 
                    158:                bool condition=
                    159:                        r.process(
                    160:                                vcondition, 
                    161:                                0/*no name*/,
                    162:                                false/*don't intercept string*/).as_bool();
                    163:                if(!condition) // ...condition is true
                    164:                        break;
                    165: 
                    166:                // write processed body
                    167:                r.write_pass_lang(r.process(body));
                    168:        }
                    169: }
                    170: 
1.5       paf       171: static void _use(Request& r, const String& method_name, MethodParams *params) {
1.34      parser    172:        Value& vfile=params->as_no_junction(0, "file name must not be code");
1.37      parser    173:        r.use_file(vfile.as_string());
1.1       paf       174: }
                    175: 
1.5       paf       176: static void _for(Request& r, const String& method_name, MethodParams *params) {
1.1       paf       177:        Pool& pool=r.pool();
1.48      parser    178:        const String& var_name=params->as_string(0, "var name must be string");
                    179:        int from=params->as_int(1, "from must be int", r);
                    180:        int to=params->as_int(2, "to must be int", r);
1.34      parser    181:        Value& body_code=params->as_junction(3, "body must be code");
1.50      parser    182:        Value *delim_maybe_code=params->size()>4?&params->get(4):0;
1.1       paf       183: 
1.57      paf       184:        if(to-from>=MAX_LOOPS) // too long loop?
                    185:                throw Exception(0, 0,
                    186:                        &method_name,
                    187:                        "endless loop detected");
                    188: 
1.1       paf       189:        bool need_delim=false;
                    190:        VInt *vint=new(pool) VInt(pool, 0);
                    191:        for(int i=from; i<=to; i++) {
                    192:                vint->set_int(i);
1.56      paf       193:                r.root->put_element(var_name, vint);
1.1       paf       194: 
                    195:                Value& processed_body=r.process(body_code);
1.49      parser    196:                if(delim_maybe_code) { // delimiter set?
1.1       paf       197:                        const String *string=processed_body.get_string();
                    198:                        if(need_delim && string && string->size()) // need delim & iteration produced string?
1.49      parser    199:                                r.write_pass_lang(r.process(*delim_maybe_code));
1.1       paf       200:                        need_delim=true;
                    201:                }
                    202:                r.write_pass_lang(processed_body);
                    203:        }
                    204: }
                    205: 
1.15      paf       206: static void _eval(Request& r, const String& method_name, MethodParams *params) {
1.34      parser    207:        Value& expr=params->as_junction(0, "need expression");
1.1       paf       208:        // evaluate expresion
                    209:        Value *result=r.process(expr, 
1.16      paf       210:                0/*no name YET*/,
1.1       paf       211:                true/*don't intercept string*/).as_expr_result();
1.50      parser    212:        if(params->size()>1) {
1.34      parser    213:                Value& fmt=params->as_no_junction(1, "fmt must not be code");
1.1       paf       214: 
                    215:                Pool& pool=r.pool();
                    216:                String& string=*new(pool) String(pool);
                    217:                string.APPEND_CONST(format(pool, result->as_double(), fmt.as_string().cstr()));
                    218:                result=new(pool) VString(string);
                    219:        }
1.16      paf       220:        result->set_name(method_name);
1.1       paf       221:        r.write_no_lang(*result);
                    222: }
                    223: 
1.52      parser    224: static void _error(Request& r, const String& method_name, MethodParams *params) {
                    225:        Pool& pool=r.pool();
                    226: 
                    227:        const String& serror=params->as_string(0, "message must be string");
1.53      parser    228:        throw Exception(0, 0,
1.52      parser    229:                &method_name,
                    230:                "%s", serror.cstr());
                    231: }
                    232: 
1.1       paf       233: 
1.53      parser    234: /// @todo rewrite ugly code with try/try to autoobject TempConnection
1.42      parser    235: static void _connect(Request& r, const String& method_name, MethodParams *params) {
1.1       paf       236:        Pool& pool=r.pool();
1.63      paf       237: #ifdef RESOURCES_DEBUG
                    238: struct timeval mt[2];
                    239: #endif
1.34      parser    240:        Value& url=params->as_no_junction(0, "url must not be code");
                    241:        Value& body_code=params->as_junction(1, "body must be code");
1.1       paf       242: 
1.19      parser    243:        Table *protocol2driver_and_client=
1.35      parser    244:                static_cast<Table *>(r.classes_conf.get(r.OP.name()));
1.11      paf       245: 
1.63      paf       246: #ifdef RESOURCES_DEBUG
                    247: //measure:before
                    248: gettimeofday(&mt[0],NULL);
                    249: #endif
1.1       paf       250:        // connect
1.67      paf       251:        SQL_Connection_ptr connection=SQL_driver_manager->get_connection(
1.42      parser    252:                url.as_string(), method_name, protocol2driver_and_client);
1.1       paf       253: 
1.63      paf       254: #ifdef RESOURCES_DEBUG
                    255: //measure:after connect
                    256: gettimeofday(&mt[1],NULL);
                    257: 
                    258: double t[2];
                    259: for(int i=0;i<2;i++)
                    260:     t[i]=mt[i].tv_sec+mt[i].tv_usec/1000000.0;
                    261: 
                    262: r.sql_connect_time+=t[1]-t[0];
                    263: #endif
1.67      paf       264:        Temp_connection temp_connection(r, connection.get());
1.1       paf       265:        // execute body
1.53      parser    266:        try {
1.67      paf       267:                r.write_assign_lang(r.process(body_code));
                    268:                
                    269:        } catch(...) { // process/commit problem
                    270:                connection->mark_to_rollback();
                    271:                /*re*/throw; 
1.1       paf       272:        }
                    273: }
                    274: 
1.41      parser    275: #ifndef DOXYGEN
1.28      parser    276: struct Switch_data {
                    277:        Value *searching;
                    278:        Value *found;
                    279:        Value *_default;
                    280: };
1.41      parser    281: #endif
1.28      parser    282: static void _switch(Request& r, const String&, MethodParams *params) {
                    283:        void *backup=r.classes_conf.get(*switch_data_name);
                    284:        Switch_data data={&r.process(params->get(0))};  
                    285:        r.classes_conf.put(*switch_data_name, &data);
                    286: 
1.34      parser    287:        r.process(params->as_junction(1, "switch cases must be code")); // and ignore result
1.28      parser    288: 
                    289:        r.classes_conf.put(*switch_data_name, backup);
                    290: 
                    291:        if(Value *code=data.found ? data.found : data._default)
                    292:                r.write_pass_lang(r.process(*code));
                    293: }
                    294: 
1.38      parser    295: static void _case(Request& r, const String& method_name, MethodParams *params) {
                    296:        Pool& pool=r.pool();
                    297: 
                    298:        Switch_data *data=static_cast<Switch_data *>(r.classes_conf.get(*switch_data_name));
                    299:        if(!data)
1.53      parser    300:                throw Exception(0, 0,
1.38      parser    301:                        &method_name,
                    302:                        "without switch");
1.28      parser    303: 
                    304:        int count=params->size();
1.34      parser    305:        Value *code=&params->as_junction(--count, "case result must be code");
1.28      parser    306:        for(int i=0; i<count; i++) {
                    307:                Value& value=r.process(params->get(i));
                    308: 
1.36      parser    309:                if(value.as_string() == *case_default_value) {
1.38      parser    310:                        data->_default=code;
1.28      parser    311:                        break;
                    312:                }
                    313: 
                    314:                bool matches;
1.38      parser    315:                if(data->searching->is_string())
                    316:                        matches=data->searching->as_string() == value.as_string();
1.28      parser    317:                else
1.38      parser    318:                        matches=data->searching->as_double() == value.as_double();
1.28      parser    319: 
                    320:                if(matches) {
1.38      parser    321:                        data->found=code;
1.28      parser    322:                        break;
                    323:                }
                    324:        }
                    325: }
                    326: 
1.63      paf       327: // cache--
                    328: 
                    329: // consts
                    330: 
                    331: const int DATA_STRING_SERIALIZED_VERSION=0x0001;
                    332: 
                    333: // helper types
                    334: 
                    335: #ifndef DOXYGEN
                    336: struct Data_string_serialized_prolog {
                    337:        int version;
                    338: };
                    339: #endif
                    340: 
1.68      paf       341: void cache_delete(const String& file_spec) {
                    342:        file_delete(file_spec, false/*fail_on_read_problem*/);
1.63      paf       343: }
1.69      paf       344: 
                    345: #ifndef DOXYGEN
                    346: struct Locked_process_and_cache_put_action_info {
                    347:        Request *r;
                    348:        Value *body;
                    349: };
                    350: #endif
                    351: static void locked_process_and_cache_put_action(int f, void *context) {
                    352:        Locked_process_and_cache_put_action_info& info=
                    353:                *static_cast<Locked_process_and_cache_put_action_info *>(context);
                    354:        
                    355:        // body->process 
                    356:        info.body=&info.r->process(*info.body);
                    357: 
                    358:        // result->string
                    359:        const String& data_string=info.body->as_string();
                    360: 
                    361:        // string -serialize> buffer
1.63      paf       362:        void *data; size_t data_size;
                    363:        data_string.serialize(
                    364:                sizeof(Data_string_serialized_prolog), 
                    365:                data, data_size);
                    366:        Data_string_serialized_prolog& prolog=
                    367:                *static_cast<Data_string_serialized_prolog *>(data);
                    368:        prolog.version=DATA_STRING_SERIALIZED_VERSION;
1.69      paf       369:        
                    370:        // buffer -write> file
                    371:        write(f, data, data_size);
                    372: }
                    373: Value *locked_process_and_cache_put(Request& r, 
                    374:                                                                        Value& body_code,
                    375:                                                                        const String& file_spec) {
                    376:        Locked_process_and_cache_put_action_info info={
                    377:                &r,
                    378:                &body_code,
                    379:        };
                    380: 
                    381:        return file_write_action_under_lock(
                    382:                file_spec, 
                    383:                "cache_put", locked_process_and_cache_put_action, &info,
                    384:                false/*as_text*/,
                    385:                false/*do_append*/,
                    386:                false/*block*/) ? info.body : 0;
1.63      paf       387: }
                    388: String *cache_get(Pool& pool, const String& file_spec) {
                    389:        void* data; size_t data_size;
1.72    ! paf       390:        if(file_read(pool, file_spec, 
1.63      paf       391:                           data, data_size, 
                    392:                           false/*as_text*/, 
1.69      paf       393:                           false/*fail_on_read_problem*/)
1.72    ! paf       394:            && data_size/* ignore reads which are empty due to 
        !           395:                        non-unary open+lockEX conflict with lockSH */) {
1.63      paf       396:        
1.72    ! paf       397:                Data_string_serialized_prolog& prolog=
        !           398:                        *static_cast<Data_string_serialized_prolog *>(data);
1.63      paf       399: 
1.72    ! paf       400:                String *result=new(pool) String(pool);
        !           401:                if(
        !           402:                        data_size>=sizeof(Data_string_serialized_prolog)
        !           403:                        && prolog.version==DATA_STRING_SERIALIZED_VERSION
        !           404:                        && result->deserialize(
        !           405:                                sizeof(Data_string_serialized_prolog),  data, data_size, file_spec.cstr()))
        !           406:                        return result;
        !           407:        }
1.63      paf       408: 
1.72    ! paf       409:        return 0;
1.63      paf       410: }
                    411: static void _cache(Request& r, const String& method_name, MethodParams *params) {
                    412:        Pool& pool=r.pool();
                    413:        
                    414:        // file_spec, expires, body code
1.65      paf       415:        const String &file_spec=r.absolute(params->as_string(0, "filespec must be string"));
                    416:        if(params->size()==1) { // delete
1.68      paf       417:                cache_delete(file_spec);
1.65      paf       418:                return;
                    419:        }
                    420: 
1.63      paf       421:        time_t lifespan=(time_t)params->as_double(1, "lifespan must be number", r);
                    422:        Value& body_code=params->as_junction(2, "body must be code");
                    423: 
                    424:        if(lifespan) { // 'lifespan' specified? try cached copy...
                    425:                size_t size;
                    426:                time_t atime, mtime, ctime;
1.69      paf       427: 
                    428:                // hence we don't hope to have unary create/lockEX
                    429:                // we need some plan to live in a life like that, so... 
                    430:                // worst races plan:
                    431:                // A        B
                    432:                // open
                    433:                //          |open
                    434:                // lockSH
                    435:                //          |nonblocking-lockEX fails
                    436:                // unlockSH
                    437:                // close, cache_get returns 0
                    438:                // open
                    439:                // nonblocking-lockEX succeeds; process, write, close
                    440:                //          |retry1: open
                    441:                // ...
                    442:                //          |lockSH succeeds; ...
                    443: 
1.63      paf       444:                // {file_spec} modification time
1.69      paf       445:                for(int retry=0; retry<2; retry++) {
                    446:                        if(file_stat(file_spec, size, atime, mtime, ctime, false/*no exception on error*/)) // exists?
                    447:                                if(time(0)-mtime > lifespan) // expired
                    448:                                        cache_delete(file_spec);
                    449:                                else // not expired
                    450:                                        if(String *cached_body=cache_get(pool, file_spec)) { // have cached copy?
                    451:                                                // write it out 
                    452:                                                r.write_assign_lang(*cached_body);
                    453:                                                // happy with it
                    454:                                                return;
                    455:                                        }
                    456: 
                    457:                        // non-blocked lock; process; cache it
                    458:                        if(Value *processed_body=locked_process_and_cache_put(r, body_code, file_spec)) {
1.63      paf       459:                                // write it out 
1.69      paf       460:                                r.write_assign_lang(*processed_body);
1.63      paf       461:                                // happy with it
                    462:                                return;
1.69      paf       463:                        } else { // somebody writing result right now
                    464:                                pa_sleep(0, 500000); // waiting half a second
                    465:                                retry=0; // prolonging our wait, than could cache_get it, without processing body_code
1.63      paf       466:                        }
1.69      paf       467:                }
                    468:                throw Exception(0, 0,
                    469:                        &file_spec,
                    470:                        "locking problem");
                    471:        } else { 
                    472:                // 'lifespan'=0, forget cached copy
1.68      paf       473:                cache_delete(file_spec);
1.69      paf       474:                // process
                    475:                Value& processed_body=r.process(body_code);
                    476:                // write it out 
                    477:                r.write_assign_lang(processed_body);
                    478:                // happy with it
                    479:                return;
                    480:        }
                    481:        // never reached
1.63      paf       482: }
                    483: 
1.10      paf       484: // constructor
                    485: 
1.11      paf       486: MOP::MOP(Pool& apool) : Methoded(apool),
                    487:        main_sql_name(apool, MAIN_SQL_NAME),
                    488:        main_sql_drivers_name(apool, MAIN_SQL_DRIVERS_NAME)
                    489: {
1.10      paf       490:        set_name(*NEW String(pool(), OP_CLASS_NAME));
1.28      parser    491: 
1.1       paf       492:        // ^if(condition){code-when-true}
                    493:        // ^if(condition){code-when-true}{code-when-false}
1.10      paf       494:        add_native_method("if", Method::CT_ANY, _if, 2, 3);
1.1       paf       495: 
                    496:        // ^untaint[as-is|uri|sql|js|html|html-typo]{code}
1.59      paf       497:        add_native_method("untaint", Method::CT_ANY, _untaint, 1, 2);
1.1       paf       498: 
                    499:        // ^taint[as-is|uri|sql|js|html|html-typo]{code}
1.10      paf       500:        add_native_method("taint", Method::CT_ANY, _taint, 1, 2);
1.1       paf       501: 
                    502:        // ^process[code]
1.10      paf       503:        add_native_method("process", Method::CT_ANY, _process, 1, 1);
1.1       paf       504: 
                    505:        // ^rem{code}
1.51      parser    506:        add_native_method("rem", Method::CT_ANY, _rem, 1, 10000);
1.1       paf       507: 
                    508:        // ^while(condition){code}
1.10      paf       509:        add_native_method("while", Method::CT_ANY, _while, 2, 2);
1.1       paf       510: 
                    511:        // ^use[file]
1.10      paf       512:        add_native_method("use", Method::CT_ANY, _use, 1, 1);
1.1       paf       513: 
1.54      paf       514:        // ^for[i](from-number;to-number-inclusive){code}[delim]
1.10      paf       515:        add_native_method("for", Method::CT_ANY, _for, 3+1, 3+1+1);
1.1       paf       516: 
                    517:        // ^eval(expr)
                    518:        // ^eval(expr)[format]
1.10      paf       519:        add_native_method("eval", Method::CT_ANY, _eval, 1, 2);
1.52      parser    520: 
                    521:        // ^error[msg]
                    522:        add_native_method("error", Method::CT_ANY, _error, 1, 1);
1.32      parser    523: 
1.1       paf       524: 
                    525:        // ^connect[protocol://user:pass@host[:port]/database]{code with ^sql-s}
1.10      paf       526:        add_native_method("connect", Method::CT_ANY, _connect, 2, 2);
                    527: 
1.63      paf       528: 
1.65      paf       529:        // ^cache[file_spec] delete cache
1.63      paf       530:        // ^cache[file_spec](time){code} time=0 no cache
1.65      paf       531:        add_native_method("cache", Method::CT_ANY, _cache, 1, 3);
1.63      paf       532:        
1.28      parser    533:        // switch
                    534: 
                    535:        // ^switch[value]{cases}
                    536:        add_native_method("switch", Method::CT_ANY, _switch, 2, 2);
                    537: 
                    538:        // ^case[value]{code}
1.51      parser    539:        add_native_method("case", Method::CT_ANY, _case, 2, 10000);
1.10      paf       540: }
1.11      paf       541: 
                    542: // constructor & configurator
1.1       paf       543: 
1.10      paf       544: Methoded *MOP_create(Pool& pool) {
1.35      parser    545:        return new(pool) MOP(pool);
1.11      paf       546: }
                    547: 
                    548: void MOP::configure_user(Request& r) {
                    549:        Pool& pool=r.pool();
                    550: 
                    551:        // $MAIN:SQL.drivers
                    552:        if(Value *sql=r.main_class->get_element(main_sql_name))
                    553:                if(Value *element=sql->get_element(main_sql_drivers_name))
                    554:                        if(Table *protocol2library=element->get_table())
                    555:                                r.classes_conf.put(name(), protocol2library);
1.1       paf       556: }

E-mail: