As I said on IRC, happy to look into this, my main question is how
transform_sql.py would know what files to scan for the MAP_DELETED <->
'base-deleted' mappings.

Do we want a header file with a well-known name
(subversion/include/private/)?  Maybe in the same directory as the
source .sql file?  Maybe the .sql file should have a directive pointing
to the map file?

Among these I prefer the second one, i.e., 
subversion/libsvn_wc/wc-queries.sql -> subversion/libsvn_wc/token-maps.h

Philip - perhaps you can move the relevant definitions to that header?
Then I'll follow up with a transform_sql.py patch.

Philip Martin wrote on Fri, Dec 07, 2012 at 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
> 'base-delete'.
> 
> 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))
> 
> into
> 
>       OR (op_depth = ?3 AND presence = 'base-deleted'))
> 
> -- 
> Philip

Reply via email to