[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Literals in wc SQLite queries

From: Philip Martin <philip_at_codematters.co.uk>
Date: Fri, 07 Dec 2012 17:54:16 +0000

Columns such as nodes.kind, nodes.presence, etc. have strings that
should be one of a discrete set of values. When we bind these columns
in C code we use something like:

    svn_sqlite__bindf("t", presence_map, svn_wc__db_status_normal);

This means we only use known values (svn_wc__db_status_normal) and the
map converts it to the correct discrete string. This checking happens
at build time.

We also have queries where the strings are defined as literals in
wc-queries.sql like:

    DELETE FROM nodes
    WHERE wc_id = ?1
      AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2)
      AND (op_depth < ?3
           OR (op_depth = ?3 AND presence = 'base-deleted'))

There is no checking of these literals to catch errors such as

I've been thinking that transform_sql.py should do some checking.
Perhaps we could move the maps into a know header, annotate them:

    { "base-deleted", svn_wc__db_status_base_deleted }, /* MAP_DELETED */

and then have transform_sql.py parse the header and convert:

      OR (op_depth = ?3 AND presence = MAP_DELETED))


      OR (op_depth = ?3 AND presence = 'base-deleted'))

Received on 2012-12-07 18:54:54 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.