Mike P. Mikhailov wrote: > Hello devel, > > I would like to contribute several patches to the openser version > 1.2.0, which we've made in the our recent project to achieve required > goals. Patches are addressing following issues we've found: > > 1. extensions to the sql drivers to support literal values in the > queries like: > > update ts=now(), cnt=cnt+1 where id=12345; > > 2. proper handling of the null values in the sql query: > > ... where val1 is null or val2 is not null > > 3. several macros to make life easy when using sql in our module. > Here some examples how now quieries may looks like: > > int mod_ucb_db_find_local_contact(mod_ucb_register_request_p _rr) { > > UCB_DBG("_rr->local_contact='%.*s'", > _rr->local_contact.len, _rr->local_contact.s > ); > > UCB_LOCAL_NODES() > > SELECT(1) > > KEY("id") > > WHERE(1) > KEY("local_contact") EQ() STR(_rr->local_contact) > > EXECUTE() > > IF_NO_ROWS() > DB_RETURN(1, "no local node found") > > FETCH() > ASINT(0, _rr->id) > > IF_MORE_ROWS() > DB_RETURN(2, "more than one local contact found") > > DB_OK("local node found, id='%d'", _rr->id) > > } > > or: > > int mod_ucb_db_update_local_node_status(int _id, int _sc, str *_rp) { > > UCB_DBG("id='%d', status_code='%d', reason_phrase='%.*s'", > _id, _sc, _rp->len, _rp->s > ); > > UCB_LOCAL_NODES() > > UPDATE(4) > > KEY("last_register") LITERAL("now()") > KEY("count_register") > LITERAL("coalesce(count_register,0)+1") > KEY("status_code") INT(_sc) > KEY("reason_phrase") STR(*_rp) > > FORID(_id) > > EXECUTE() > > DB_OK("local node status updated"); > > } > > #1 & #2 with patches for postgres & mysql drivers. > > #3 may be contributed as additional header file without intervention > in the existing code. > > Please, reply to me if changes mentioned above is interesting for > the openser community. > > Would you mind posting the patches on the bug tracker so this doesn't get lost.
Thanks ./C -- Christopher Bergström [EMAIL PROTECTED] US +1 206.279.5000 UK +44 20.709.68810 Main +1 888 NetSyncro */CONFIDENTIAL COMMUNICATION:/* The information contained in this transmission is confidential and is intended only for the use of the entity or individual to whom it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any use, disclosure, copying, distribution, or the taking of any action in reliance on the contents of this communication is strictly prohibited. If you have received this transmission in error, please immediately notify us of the error in a reply to the sender. _______________________________________________ Devel mailing list Devel@openser.org http://openser.org/cgi-bin/mailman/listinfo/devel