On 05 Apr 2001 15:05:57 -0400, Thomas B. Passin wrote:
Gitte Wange wrote -
Well if you make MySQL select the next_id for you - what happens then if there are no records in the table? Will it then return 1 (if you say select max(id)+1) ???
It ***should*** return null (that is, 1+null-->null). SQLAnywhere does (I just tested it for you). But I don't know if MySQL acts correctly or not. I don't have it installed. Just make a table with one column, don't populate it, and try it out.
Cheers,
Tom P
FYI - MySQL also returns null So I presume that you can make a test like this: <dtml-if FindAnyRecords> <dtml-call expr="InsertRecordWithNext_id(next_id=next_id)"> <dtml-else> <dtml-call expr="InsertRecordWithNext_id(next_id=1)"> </dtml-if> I have sensed that some people on this list is a bit "anoyed" (perhaps a wrong word) about my postings - I am sorry to say this but the Zope documentation isn't the best :-) Regards, Gitte