The current query can stop at the first result while count() needs all results.
Bert Huijben (Cell phone) From: Daniel Shahaf Sent: zaterdag 26 maart 2011 8:12 To: dev@subversion.apache.org Cc: comm...@subversion.apache.org Subject: Re: svn commit: r1081484 - in /subversion/trunk/subversion/libsvn_wc: wc-queries.sql wc_db.c s...@apache.org wrote on Mon, Mar 14, 2011 at 17:24:06 -0000: > Author: stsp > Date: Mon Mar 14 17:24:05 2011 > New Revision: 1081484 > > URL: http://svn.apache.org/viewvc?rev=1081484&view=rev > Log: > In the revision status code, use a query to determine whether property > modifications are present in the WC, instead of calling > svn_wc__props_modified() from wc_db.c. > > Suggested by: rhuijben > > * subversion/libsvn_wc/wc-queries.sql > (STMT_SELECT_NODES_WITH_PROP_MODIFICATIONS): New query. > > * subversion/libsvn_wc/wc_db.c > (has_local_mods): Use the new query instead of svn_wc__props_modified(). > > Modified: > subversion/trunk/subversion/libsvn_wc/wc-queries.sql > subversion/trunk/subversion/libsvn_wc/wc_db.c > > Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql > URL: > http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=1081484&r1=1081483&r2=1081484&view=diff > ============================================================================== > --- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original) > +++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Mon Mar 14 17:24:05 > 2011 > @@ -910,6 +910,11 @@ WHERE wc_id = ?1 AND (local_relpath = ?2 > presence = 'base-deleted') > AND file_external IS NULL; > > +-- STMT_SELECT_NODES_WITH_PROP_MODIFICATIONS > +SELECT local_relpath FROM actual_node > +WHERE wc_id = ?1 AND (local_relpath = ?2 OR local_relpath LIKE ?3 ESCAPE '#') > + AND properties IS NOT NULL; > + Should this be SELECT COUNT(local_relpath) ... ? > /* This query expects repos_path(wcroot)/% as arg 4, > and repos_path(wcroot), with a slash appended unless the path is empty, > as arg 5. */ > > Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c > URL: > http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1081484&r1=1081483&r2=1081484&view=diff > ============================================================================== > --- subversion/trunk/subversion/libsvn_wc/wc_db.c (original) > +++ subversion/trunk/subversion/libsvn_wc/wc_db.c Mon Mar 14 17:24:05 2011 > @@ -9523,9 +9523,27 @@ has_local_mods(svn_boolean_t *is_modifie > > if (! *is_modified) > { > + /* Check for property modifications. */ > + SVN_ERR(svn_sqlite__get_statement( > + &stmt, wcroot->sdb, > + STMT_SELECT_NODES_WITH_PROP_MODIFICATIONS)); > + SVN_ERR(svn_sqlite__bindf(stmt, "iss", wcroot->wc_id, local_relpath, > + construct_like_arg(local_relpath, > + scratch_pool))); > + /* If this query returns a row, the working copy is modified. */ > + SVN_ERR(svn_sqlite__step(&have_row, stmt)); > + *is_modified = have_row; > + SVN_ERR(svn_sqlite__reset(stmt)); > + > + if (cancel_func) > + SVN_ERR(cancel_func(cancel_baton)); > + } > + > + if (! *is_modified) > + { > apr_pool_t *iterpool = NULL; > > - /* Check for text and prop modifications. */ > + /* Check for text modifications. */ > SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, > > STMT_SELECT_CURRENT_NODES_RECURSIVE)); > SVN_ERR(svn_sqlite__bindf(stmt, "iss", wcroot->wc_id, local_relpath, > @@ -9548,12 +9566,6 @@ has_local_mods(svn_boolean_t *is_modifie > svn_sqlite__column_text(stmt, 0, > iterpool), > iterpool); > - > - SVN_ERR(svn_wc__props_modified(is_modified, db, node_abspath, > - iterpool)); > - if (*is_modified) > - break; > - > node_kind = svn_sqlite__column_token(stmt, 1, kind_map); > if (node_kind == svn_wc__db_kind_file) > { > >