From 4ab12d84b2738fbfc9aafed6b4710180aa2d37e4 Mon Sep 17 00:00:00 2001 From: horchi Date: Sun, 19 Mar 2017 15:26:57 +0100 Subject: minor imrovement of db api --- lib/db.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/db.c b/lib/db.c index 7b50bcd..2dbca80 100644 --- a/lib/db.c +++ b/lib/db.c @@ -734,15 +734,18 @@ int cDbTable::init(int allowAlter) // check/create table ... - if (exist() && allowAlter) - validateStructure(allowAlter); + if (allowAlter) + { + if (exist()) + validateStructure(allowAlter); - if (createTable() != success) - return fail; + if (!exist() && createTable() != success) + return fail; - // check/create indices + // check/create indices - createIndices(); + createIndices(); + } // ------------------------------ // prepare BASIC statements -- cgit v1.2.3