Login | Register
My pages Projects Community openCollabNet

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Catacomb] Apache directive feature request: non-default DBMS portnumber



Andrew,

Thanks for this patch. Could you make a patch using 'diff -u'?
We are discussing to move our CVS depository. After moving we can add new committers.

- Sung

Andrew Morrow (BTS) wrote:

Sung:

Here my mods.  The format is rough but the code is OK.  Note that I am
careless with atoi().  I should check return code.

Let me know if you would rather I commit myself.  I do not think that I have
access to CVS yet.

       Andrew


Need to add field twice:

add new field to dav_repos_dir_conf and dav_repos_server_conf:


diff -w ./dav_repos.h ../../amorrow/catacomb-0.9.0_orig/dav_repos.h


    int db_port;
....
    int db_port;




diff -w ./dbms.c ../../amorrow/catacomb-0.9.0_orig/dbms.c

int dbms_opendb(dav_repos_db * d)
{
       int status;
   TRACE();

   status = dbms_create(&(d->db), d->db_id, d->db_pass, d->db_name,
 d->db_host, d->db_port);

/* Why did orig always return 0 ? */
   return status;
}






diff -w ./mod_dav_repos.c ../../amorrow/catacomb-0.9.0_orig/mod_dav_repos.c

(add this anywhere..., around line 150)


static const char *dav_repos_db_port_cmd(cmd_parms * cmd, void *config,
      const char *arg1)
{
    dav_repos_server_conf *conf =
 ap_get_module_config(cmd->server->module_config,
        &dav_repos_module);
/* AWM: Should we flag syntax errors in number? */
    conf->db_port = atoi(arg1);
    return NULL;
}




static const command_rec dav_repos_cmds[] = {
...
    AP_INIT_TAKE1("DavDBMSPort", dav_repos_db_port_cmd, NULL, RSRC_CONF,
    "specify the MYSQL_DB_PORT for a directory or location"),
...
}



       Andrew





----- Original Message -----
From: "Sung Kim" <hunkims@hotmail.com>
To: "'Andrew Morrow (BTS)'" <amorrow@blacktulipsystems.com>;
<catacomb@webdav.org>
Sent: Saturday, February 07, 2004 2:50 PM
Subject: RE: [Catacomb] Apache directive feature request: non-default DBMS
portnumber


Thanks for your suggestion and it makes a lot of sense.
As soon as we move to the new svn repository, we will try to add the
DavDBMSPort directive. Meanwhile, your patch would be welcome, if you want
to make one.

- Sung
________________________________________
From: catacomb-bounces@webdav.org [mailto:catacomb-bounces@webdav.org] On
Behalf Of Andrew Morrow (BTS)
Sent: Sunday, February 08, 2004 1:56 PM
To: catacomb@webdav.org
Subject: [Catacomb] Apache directive feature request: non-default DBMS
portnumber


Catacomb should have an Apache directive for specifying a non-default DBMS
port number.

The need for this feature is obvious. Of course, some DBMS client API's
offer other kinds of parameters. Even MySQL also has unixsocket and
clientflag in its client API (this is already TODO'ed in dbms_mysql.c) but
port is a very common parameter among DBMS client API's.

For database access to MySQL, Catacomb currently has

DavDBMSHost
DavDBMSId

DavDBMSDbName
DavDBMSPass

So, as a suggested name, adding a directive with a name like

DavDBMSPort

which would specify a port number would fulfill this requirement.

The shortcut currently taken in the code is to pass a value of zero to get
the default port:

dbms.c : dbms_opendb() :
status = dbms_create(&(d->db), d->db_id, d->db_pass, d->db_name,
d->db_host, 0);

With that and the example of the existing directives, its obvious how
to implement the rest of this new directive.

Andrew