Patch to add index to SMS table

Holger Hans Peter Freyther holger at freyther.de
Sun Mar 29 09:25:22 UTC 2015


On Fri, Mar 27, 2015 at 06:16:47PM +0100, Alexander Nikolaev wrote:
> Holger,

> If separate SQL statements better match the approved code style, I've
> created a patch that uses separate query for index creation --
> https://gist.github.com/ati/3089e35080598495ca27

Have a look at 

int db_prepare(void)
{
        dbi_result result;
        int i;

        for (i = 0; i < ARRAY_SIZE(create_stmts); i++) {
                result = dbi_conn_query(conn, create_stmts[i]);
                if (!result) {
                        LOGP(DDB, LOGL_ERROR,
                             "Failed to create some table.\n");
                        return 1;
                }
                dbi_result_free(result);
        }


so after you added the SCHEMA_SMS_IDX should be automatically
created. There should be no requirement to execute statement
from update_db_revision_3.


> > What we would like to do is to avoid using libdbi.
> Do you have in mind some other abstraction layer or think that it is
> better to just use native sqlite interface?
> It would be great if it is possible to use asynchronous db calls, but
> this requires major rewrite of the database interface.

https://openbsc.osmocom.org/trac/wiki/Tasks/NITBAsyncDatabase

for a proposal.


holger




More information about the OpenBSC mailing list