* Michal Čihař <ni...@debian.org> [2009-02-06 17:16:48 CET]: > You're writing really on time :-). Currently SMSD is under heavy > development and you can still influence how it will look in next > release.
Hopefully more SQL-like in its SQL backends. ;) > Dne Fri, 6 Feb 2009 16:15:23 +0100 > Gerfried Fuchs <rho...@debian.at> napsal(a): > > While debugging why gammu takes ages with mysql backend to send a > > simple sms I stumbled upon something that made me feel highly > > uncomfortable about it. The (my)sql support lacks of all sql basics, > > like using indexes in the tables, usage of autoincrement fields for IDs > > or at least the max() function instead of ORDER BY ID DESC LIMIT 1. > > The problem with using autoincrement (at least in the case you are > talking about) is that we need to find ID which does not exists in two > tables. That's fine, but: The lines are moved over from outbox to the sentitems. If the IDs are created autoincrement in the outbox there won't be any conflict in the sentitems box. Currently you even have a runtime problem in the code with looking for the last ID in the outbox and later depending on that no line was inserted in between by adding a line with that ID+1. Most of the time though the behavior that led to our annoyance happens: The outbox is empty and the code loops over the IDs in sentitems, one by one until it finds one that doesn't exist. ... in a table without any index. :/ > I know the code is really bad. Thats why I started with new backend > using DBI to support more SQL databases. Just switching the interface won't improve the code, unfortunately. > It still has some bad parts (it is based on same database structure to > be compatible with old ones and parts of code come from old ones), but > I think it's much better than current one. > > Can you please look at the new code and share your thoughts what should > be improved first? > > http://viewsvn.cihar.com/viewvc.cgi/gammu/trunk/smsd/services/dbi.c?view=markup It at least does the same select max(id) for sentitems, though I still would think an autoincrement to be the proper thing to do. Like said, lines are only moved over so there should never happen any conflicting ID, otherwise something else must have gone wrong. You still have the runtime problem mentioned above in here. I've just checked the things that bothered me to the extreme, didn't go over any of the rest. So long. :) Rhonda -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org