Changeset 431

Show
Ignore:
Timestamp:
07/08/2005 10:29:40 PM (3 years ago)
Author:
jan
Message:

replace mysql my memcache prototypes, fixes parameter handling

Location:
branches/lighttpd-1.3.x/src
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • branches/lighttpd-1.3.x/src/mod_cml.h

    r428 r431  
    8787CACHE_FUNC_PROTO(f_unix_time_now); 
    8888CACHE_FUNC_PROTO(f_file_mtime); 
    89 CACHE_FUNC_PROTO(f_mysql_escape); 
    90 CACHE_FUNC_PROTO(f_mysql_connect); 
    91 CACHE_FUNC_PROTO(f_mysql_query); 
     89CACHE_FUNC_PROTO(f_memcache_get); 
     90CACHE_FUNC_PROTO(f_memcache_exists); 
    9291 
    9392#endif 
  • branches/lighttpd-1.3.x/src/mod_cml_funcs.c

    r428 r431  
    6262} 
    6363 
    64 CACHE_FUNC_PROTO(f_mysql_escape) { 
     64CACHE_FUNC_PROTO(f_memcache_exists) { 
    6565        UNUSED(srv); 
    6666        UNUSED(con); 
     
    6868        if (p->params->ptr[0]->type != T_NODE_VALUE_STRING) { 
    6969                log_error_write(srv, __FILE__, __LINE__, "sd",  
    70                                 "f_mysql_escape: I need a string:",  
     70                                "f_memcache_exists: I need a string:",  
    7171                                p->params->ptr[0]->type); 
    7272                 
    73                 return -1; 
    74         } 
    75          
    76         tnode_prepare_string(result); 
    77         buffer_copy_string_buffer(VAL_STRING(result), p->params->ptr[0]->data.str); 
    78          
    79         return 0; 
    80 } 
    81  
    82 CACHE_FUNC_PROTO(f_mysql_query) { 
    83         UNUSED(srv); 
    84         UNUSED(con); 
    85          
    86         if (p->params->ptr[0]->type != T_NODE_VALUE_STRING) { 
    87                 log_error_write(srv, __FILE__, __LINE__, "sd",  
    88                                 "f_mysql_query: I need a string:",  
    89                                 p->params->ptr[0]->type); 
    9073                return -1; 
    9174        } 
     
    9780} 
    9881 
    99 CACHE_FUNC_PROTO(f_mysql_connect) { 
     82CACHE_FUNC_PROTO(f_memcache_get) { 
    10083        UNUSED(srv); 
    10184        UNUSED(con); 
    10285         
    103         if (p->params->ptr[0]->type != T_NODE_VALUE_STRING) return -1; 
    104         if (p->params->ptr[1]->type != T_NODE_VALUE_STRING) return -1; 
    105         if (p->params->ptr[2]->type != T_NODE_VALUE_STRING) return -1; 
    106         if (p->params->ptr[3]->type != T_NODE_VALUE_STRING) return -1; 
     86        if (p->params->ptr[0]->type != T_NODE_VALUE_STRING) { 
     87                log_error_write(srv, __FILE__, __LINE__, "sd",  
     88                                "f_memcache_get: I need a string:",  
     89                                p->params->ptr[0]->type); 
     90                return -1; 
     91        } 
    10792         
    108         tnode_prepare_long(result); 
    109         VAL_LONG(result) = 0; 
     93        tnode_prepare_string(result); 
     94        buffer_copy_string_buffer(VAL_STRING(result), p->params->ptr[0]->data.str); 
    11095         
    11196        return 0; 
    11297} 
    113  
  • branches/lighttpd-1.3.x/src/mod_cml_logic.c

    r428 r431  
    164164         
    165165        cache_trigger_functions f[] = { 
    166                 { "file.mtime",    1, f_file_mtime }, 
    167                 { "unix.time.now", 0, f_unix_time_now }, 
    168                 { "mysql.escape",  1, f_mysql_escape }, 
    169                 { "mysql.connect", 4, f_mysql_connect }, 
    170                 { "mysql.query",   1, f_mysql_query }, 
     166                { "file.mtime",     1, f_file_mtime }, 
     167                { "unix.time.now",  0, f_unix_time_now }, 
     168                { "memcache.exits", 1, f_memcache_exists }, 
     169                { "memcache.get",   1, f_memcache_get }, 
    171170                { NULL, 0, NULL }, 
    172171        }; 
     
    341340                                         
    342341                                        /* parse parameters */ 
     342                                         
     343                                        tnode_val_array_reset(p->params); 
    343344                                         
    344345                                        if (0 != cache_parse_parameters(srv, con, p, br_open + 1, t->used - slen - 3, p->params)) {