Right, I see where there are hardcoded values. These should all be changed to
look like this:

#define MSGSTATUS_REGULAR   1
#define MSGSTATUS_DELETED   2
#define MSGSTATUS_NOTREADY  5

snprintf( query, MAX_QUERY_SIZE, "UPDATE blah SET blah = '%d'",
          MSGSTATUS_NOTREADY" );

I'm not sure why the numbers are currently being written with leading zeroes,
but in any event, magic numbers are bad and defined constants are better.

Aaron


Anton Nekhoroshih <[EMAIL PROTECTED]> said:

> ÷ ó&#65533;&#65533;, 29.05.2004, &#65533; 12:38, Aaron Stone 
> &#65533;&#65533;&#65533;&#65533;&#65533;:
> > These should actually be inserted via snprintf using constants. Someone 
> > posted
> > about their definitions recently, but I can't find them in the code...
> > 
> > Aaron
> > 
> [EMAIL PROTECTED] dbmail]$ cvs -z3 update -A db.c|cat db.c|egrep
> '(001|002|003)'
>                  "AND msg.status < 002 "
>                                  "message_idnr='%llu' AND status<002",
>            to status >= 002, the quotum has to be recalculated */
>                  "UPDATE messages SET status = '003' WHERE status =
> '002'");
>                  "SELECT message_idnr FROM messages WHERE
> status='003'");
>          * this also means that the status will be set to '001'
>                  "recent_flag) VALUES ('%llu', '%llu', '', '001', '1')",
>                          "AND msg.status < '002' "
>                          "AND msg.status < '002'", mailbox_idnr);
>                  "UPDATE messages SET status='002' "
>                  "AND deleted_flag='1' AND status < '002'",
> mailbox_idnr);
>                  "AND status< '002' AND unique_id!=''", msg_idnr,
> 
> > 
> > Anton Nekhoroshih <[EMAIL PROTECTED]> said:
> > 
> > > Hi All!
> > > 
> > > It is now used statuses: 001, 002, 003
> > > Logically that it corresponds: 1, 2, 3
> > > 
> > > But me personally and db oracle it is not clear why it is used 001,
> > > instead of 1 and ....?
> > > 
> > > In oracle '001' not equal '1' and .... !!!
> > > 
> > > Besides a field status numerical if you want where or to output numbers
> > > with zero that look 'man printf' !!!
> > > 
> > > Personally for myself I in db.c all zero have removed also all works
> > > correctly.
> > > 
> > > 
> > > 
> > > 
> > > 
> > > _______________________________________________
> > > Dbmail-dev mailing list
> > > Dbmail-dev@dbmail.org
> > > http://twister.fastxs.net/mailman/listinfo/dbmail-dev
> > > 
> > 
> > 
> 
> _______________________________________________
> Dbmail-dev mailing list
> Dbmail-dev@dbmail.org
> http://twister.fastxs.net/mailman/listinfo/dbmail-dev
> 



-- 



Reply via email to