On Tue, Oct 8, 2013 at 12:01 PM, Holger Hans Peter Freyther
<holger(a)freyther.de> wrote:
On Tue, Oct 08, 2013 at 03:17:31AM +0200, Alexander
Chemeris wrote:
The v4 DB scheme removes sender ID from the DB
and stores individual values instead (sender addr, ton, npi). To convert an old DB to the
new format we have to read all values from the old table and re-add them to the new one.
we need to squash this with the previous commit and you should add
line wrapping to your text as well.
Squashing will remove your copyright on the code, so I avoided that. I
don't see an issue with having two separate commits.
+#define
SMS_TABLE_CREATE_STMT \
Can you propose an alternative to move this out of the array?
Frankly speaking, I would move _all_ these statements to separate
#defines, to make the code clearer.
And no, I don't see a better way to do that.
+ /*
Rename old SMS table to be able create a new one */
+ result = dbi_conn_query(conn,
+ "ALTER TABLE SMS "
+ "RENAME TO SMS_3");
Okay, that is easier than adding a new column, populating it, removing
the old one, changing the constraints. It is at the cost of having an
additional parser routine.
The thin is that in SQLite you can't remove a column. So this is the
only possible way.
+ /* Mark
SMS_3 table for removal */
How is it marked? ;)
It's not actually removed from the file. VACUUM is needed to actually
remove the data. Thus "marked".
+ } else
if (!strcmp(rev_s, "3")) {
+ if (update_db_revision_3()) {
FAILURE
reading it is odd, but this is how update_db_revision_2 is doing
it.. you just copied it.
Yes, I didn't want to change the code style.
--
Regards,
Alexander Chemeris.
CEO, Fairwaves LLC / ООО УмРадио
http://fairwaves.ru