Forum OpenACS Q&A: Re: Problem Installing The Jabber Package

Collapse
Posted by Bjoern Kiesbye on
Hi Martin,

Your Idee isn't bad , but we would have to do a second check when the sql is actualy executed , for oracle I use Ns_DbDML and for Postgres Ns_DbExec this is neseccary for at least some of the queries. As well the first check had to be doen everywhere in the code where a SQL query is created (the extra time loss wouldn't be the big problem but it would blow up the code and makes it less readable).

I #define CONSTANS for each query during precompiler run, they are defined whith  SQL querys for oracle or postgress (db_jclient.h), the CONSTANTS are then replaced (in the second recursive precompiler run) inside the code with the previously defined SQL queries.

db_jclient.h looks like that:

#if JBDB == ORA

//first how to execute dml satements
#define JBDB_EXEC_DML ret =  Ns_DbDML(handle, sql);

// the sql  from db_jclient.c
#define JBDB_UPDATE_STATUS  "begin jb_update_status
('%s' , '%s' , '%s' , '%s');  end;"

//sql from lib_jclient.c
#define JBDB_MESSAGE_LOG "update jb_message_log set conn_state='0' ,
send = sysdate where message = '%s' and screen = '%s'"

#elif JBDB == POSTGRES

//first how to execute dml satements
#define JBDB_EXEC_DML(handle , sql) ret = Ns_DbExec(handle , sql);

//the sql  from db_jclient.c
#define JBDB_UPDATE_STATUS  "Select jb_update_status ('s' , '%s' , '%s' , '%s')"

//sql from lib_jclient.c
#define JBDB_MESSAGE_LOG "update jb_message_log set conn_state='0' ,send = curent_timestamp where message = '%s' and screen = '%s')"

Inside the *.c files it looks like this then (no extra if blocks are nesecary):

snprintf(sql , 761 , JBDB_MESSAGE_LOG  , Ns_SetGet(row , "message") , jid_full(id) );
db =  JABBER_Dbml_Main(sql);

This way it's a very littel faster and the code is better readable, the disadvantage is that you need to compile  one nsjabber.so for oracle and one for postgres.

If you want to run both (ora/post) oacs instalations with one Aolserver installation,( I think this will only happen on development Systems)
just compile one nsjabber.so for oracle and one for postgres , create two sub dirs in
/usr/local/aolserver/bin/, name them 'nsjabber-ora' and
'nsjabber-post' and copy the appropriate nsjabber.so files to this dirs. Then change the modul load section of your aolserver-config.tcl that it looks like this:

ns_section ns/server/${server}/modules
ns_param  nssock            ${bindir}/nssock.so
ns_param  nslog              ${bindir}/nslog.so
ns_param  nsdb              ${bindir}/nsdb.so

if { $database == "oracle" } {
ns_param  ns_jabber              ${bindir}/nsjabber-ora/nsjabber.so
} else {
ns_param  ns_jabber              ${bindir}/nsjabber-post/nsjabber.so
}

This way always the appropriate nsjabber.so will be loaded.

To which email address did you send the jabber-drop.sql file (mailto:bjoern_kiesbye@web.de)? I did't get any, could you try to send it again.

Thanks

Collapse
Posted by martin hebrank on
Bjoern,
I resent the jabber-drop.sql. I hope you got it.
Now, is there someplace where plans for this package are discussed? I have to do quite a bit of work on it and want to make sure that I'm working with the community.

** Martin