/[Apache-SVN]/httpd/httpd/trunk/modules/database/mod_dbd.c
ViewVC logotype

Diff of /httpd/httpd/trunk/modules/database/mod_dbd.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 553563, Thu Jul 5 17:10:43 2007 UTC revision 646453, Wed Apr 9 18:01:53 2008 UTC
# Line 141  static void *merge_dbd_config(apr_pool_t Line 141  static void *merge_dbd_config(apr_pool_t
141      return svr;      return svr;
142  }  }
143    
 #define ISINT(val) do {                                                 \  
         const char *p;                                                  \  
                                                                         \  
         for (p = val; *p; ++p) {                                        \  
             if (!apr_isdigit(*p)) {                                     \  
                 return "Argument must be numeric!";                     \  
             }                                                           \  
         }                                                               \  
     } while (0)  
   
144  static const char *dbd_param(cmd_parms *cmd, void *dconf, const char *val)  static const char *dbd_param(cmd_parms *cmd, void *dconf, const char *val)
145  {  {
146      const apr_dbd_driver_t *driver = NULL;      const apr_dbd_driver_t *driver = NULL;
# Line 185  static const char *dbd_param(cmd_parms * Line 175  static const char *dbd_param(cmd_parms *
175      case cmd_params:      case cmd_params:
176          cfg->params = val;          cfg->params = val;
177          break;          break;
178        }
179    
180        return NULL;
181    }
182    
183  #if APR_HAS_THREADS  #if APR_HAS_THREADS
184    static const char *dbd_param_int(cmd_parms *cmd, void *dconf, const char *val)
185    {
186        svr_cfg *svr = ap_get_module_config(cmd->server->module_config,
187                                            &dbd_module);
188        dbd_cfg_t *cfg = svr->cfg;
189        const char *p;
190    
191        for (p = val; *p; ++p) {
192            if (!apr_isdigit(*p)) {
193                return "Argument must be numeric!";
194            }
195        }
196    
197        switch ((long) cmd->info) {
198      case cmd_min:      case cmd_min:
         ISINT(val);  
199          cfg->nmin = atoi(val);          cfg->nmin = atoi(val);
200          cfg->set |= NMIN_SET;          cfg->set |= NMIN_SET;
201          break;          break;
202      case cmd_keep:      case cmd_keep:
         ISINT(val);  
203          cfg->nkeep = atoi(val);          cfg->nkeep = atoi(val);
204          cfg->set |= NKEEP_SET;          cfg->set |= NKEEP_SET;
205          break;          break;
206      case cmd_max:      case cmd_max:
         ISINT(val);  
207          cfg->nmax = atoi(val);          cfg->nmax = atoi(val);
208          cfg->set |= NMAX_SET;          cfg->set |= NMAX_SET;
209          break;          break;
210      case cmd_exp:      case cmd_exp:
         ISINT(val);  
211          cfg->exptime = atoi(val);          cfg->exptime = atoi(val);
212          cfg->set |= EXPTIME_SET;          cfg->set |= EXPTIME_SET;
213          break;          break;
 #endif  
214      }      }
215    
216      return NULL;      return NULL;
217  }  }
218    #endif
219    
220  static const char *dbd_param_flag(cmd_parms *cmd, void *dconf, int flag)  static const char *dbd_param_flag(cmd_parms *cmd, void *dconf, int flag)
221  {  {
# Line 250  static const command_rec dbd_cmds[] = { Line 255  static const command_rec dbd_cmds[] = {
255                     "SQL statement to prepare (or nothing, to override "                     "SQL statement to prepare (or nothing, to override "
256                     "statement inherited from main server) and label"),                     "statement inherited from main server) and label"),
257  #if APR_HAS_THREADS  #if APR_HAS_THREADS
258      AP_INIT_TAKE1("DBDMin", dbd_param, (void*)cmd_min, RSRC_CONF,      AP_INIT_TAKE1("DBDMin", dbd_param_int, (void*)cmd_min, RSRC_CONF,
259                    "Minimum number of connections"),                    "Minimum number of connections"),
260      /* XXX: note that mod_proxy calls this "smax" */      /* XXX: note that mod_proxy calls this "smax" */
261      AP_INIT_TAKE1("DBDKeep", dbd_param, (void*)cmd_keep, RSRC_CONF,      AP_INIT_TAKE1("DBDKeep", dbd_param_int, (void*)cmd_keep, RSRC_CONF,
262                    "Maximum number of sustained connections"),                    "Maximum number of sustained connections"),
263      AP_INIT_TAKE1("DBDMax", dbd_param, (void*)cmd_max, RSRC_CONF,      AP_INIT_TAKE1("DBDMax", dbd_param_int, (void*)cmd_max, RSRC_CONF,
264                    "Maximum number of connections"),                    "Maximum number of connections"),
265      /* XXX: note that mod_proxy calls this "ttl" (time to live) */      /* XXX: note that mod_proxy calls this "ttl" (time to live) */
266      AP_INIT_TAKE1("DBDExptime", dbd_param, (void*)cmd_exp, RSRC_CONF,      AP_INIT_TAKE1("DBDExptime", dbd_param_int, (void*)cmd_exp, RSRC_CONF,
267                    "Keepalive time for idle connections"),                    "Keepalive time for idle connections"),
268  #endif  #endif
269      {NULL}      {NULL}

Legend:
Removed from v.553563  
changed lines
  Added in v.646453

apache@apache.org
ViewVC Help
Powered by ViewVC 1.1.2