You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2011/02/22 18:20:48 UTC
svn commit: r1073418 - in /subversion/trunk/subversion/libsvn_wc:
wc-queries.sql wc_db.c
Author: philip
Date: Tue Feb 22 17:20:48 2011
New Revision: 1073418
URL: http://svn.apache.org/viewvc?rev=1073418&view=rev
Log:
Escape the path used in the LIKE operator in the property cache queries.
* subversion/libsvn_wc/wc_db.c
(struct cache_props_baton_t): Remove statement indices, add boolean.
(cache_props_recursive): Select statement and bind parameters based
on boolean, generate like path.
(read_props_recursive): Set boolean in baton.
* subversion/libsvn_wc/wc-queries.sql
(STMT_CACHE_NODE_PROPS_RECURSIVE, STMT_CACHE_ACTUAL_PROPS_RECURSIVE): Add
third parameter for LIKE path.
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=1073418&r1=1073417&r2=1073418&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Tue Feb 22 17:20:48 2011
@@ -765,7 +765,7 @@ DROP TABLE IF EXISTS temp__node_props_ca
CREATE TEMPORARY TABLE temp__node_props_cache AS
SELECT local_relpath, kind, properties FROM nodes_current
WHERE wc_id = ?1
- AND (?2 = '' OR local_relpath = ?2 OR local_relpath LIKE ?2 || '/%')
+ AND (?2 = '' OR local_relpath = ?2 OR local_relpath LIKE ?3 ESCAPE '#')
AND local_relpath NOT IN (
SELECT local_relpath FROM actual_node WHERE wc_id = ?1)
AND (presence = 'normal' OR presence = 'incomplete');
@@ -779,7 +779,7 @@ INSERT INTO temp__node_props_cache (loca
ON A.wc_id = N.wc_id AND A.local_relpath = N.local_relpath
AND (N.presence = 'normal' OR N.presence = 'incomplete')
WHERE A.wc_id = ?1
- AND (?2 = '' OR A.local_relpath = ?2 OR A.local_relpath LIKE ?2 || '/%')
+ AND (?2 = '' OR A.local_relpath = ?2 OR A.local_relpath LIKE ?3 ESCAPE '#')
AND A.local_relpath NOT IN
(SELECT local_relpath FROM temp__node_props_cache);
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1073418&r1=1073417&r2=1073418&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Tue Feb 22 17:20:48 2011
@@ -5266,8 +5266,7 @@ svn_wc__db_read_props(apr_hash_t **props
*/
typedef struct cache_props_baton_t
{
- int stmt_node_props_ndx;
- int stmt_actual_props_ndx;
+ svn_boolean_t immediates_only;
apr_int64_t wc_id;
const char *local_relpath;
svn_cancel_func_t cancel_func;
@@ -5282,15 +5281,43 @@ cache_props_recursive(void *cb_baton,
cache_props_baton_t *baton = cb_baton;
svn_sqlite__stmt_t *stmt;
- SVN_ERR(svn_sqlite__get_statement(&stmt, db, baton->stmt_node_props_ndx));
- SVN_ERR(svn_sqlite__bindf(stmt, "is", baton->wc_id, baton->local_relpath));
+ if (baton->immediates_only)
+ {
+ SVN_ERR(svn_sqlite__get_statement(&stmt, db,
+ STMT_CACHE_NODE_PROPS_OF_CHILDREN));
+ SVN_ERR(svn_sqlite__bindf(stmt, "is",
+ baton->wc_id, baton->local_relpath));
+ }
+ else
+ {
+ SVN_ERR(svn_sqlite__get_statement(&stmt, db,
+ STMT_CACHE_NODE_PROPS_RECURSIVE));
+ SVN_ERR(svn_sqlite__bindf(stmt, "iss",
+ baton->wc_id, baton->local_relpath,
+ construct_like_arg(baton->local_relpath,
+ scratch_pool)));
+ }
SVN_ERR(svn_sqlite__step_done(stmt));
if (baton->cancel_func)
SVN_ERR(baton->cancel_func(baton->cancel_baton));
- SVN_ERR(svn_sqlite__get_statement(&stmt, db, baton->stmt_actual_props_ndx));
- SVN_ERR(svn_sqlite__bindf(stmt, "is", baton->wc_id, baton->local_relpath));
+ if (baton->immediates_only)
+ {
+ SVN_ERR(svn_sqlite__get_statement(&stmt, db,
+ STMT_CACHE_ACTUAL_PROPS_OF_CHILDREN));
+ SVN_ERR(svn_sqlite__bindf(stmt, "is", baton->wc_id,
+ baton->local_relpath));
+ }
+ else
+ {
+ SVN_ERR(svn_sqlite__get_statement(&stmt, db,
+ STMT_CACHE_ACTUAL_PROPS_RECURSIVE));
+ SVN_ERR(svn_sqlite__bindf(stmt, "iss", baton->wc_id,
+ baton->local_relpath,
+ construct_like_arg(baton->local_relpath,
+ scratch_pool)));
+ }
SVN_ERR(svn_sqlite__step_done(stmt));
return SVN_NO_ERROR;
@@ -5326,16 +5353,7 @@ read_props_recursive(svn_wc__db_t *db,
SVN_ERR(svn_sqlite__exec_statements(wcroot->sdb,
STMT_CLEAR_NODE_PROPS_CACHE));
- if (immediates_only)
- {
- baton.stmt_node_props_ndx = STMT_CACHE_NODE_PROPS_OF_CHILDREN;
- baton.stmt_actual_props_ndx = STMT_CACHE_ACTUAL_PROPS_OF_CHILDREN;
- }
- else
- {
- baton.stmt_node_props_ndx = STMT_CACHE_NODE_PROPS_RECURSIVE;
- baton.stmt_actual_props_ndx = STMT_CACHE_ACTUAL_PROPS_RECURSIVE;
- }
+ baton.immediates_only = immediates_only;
baton.wc_id = wcroot->wc_id;
baton.cancel_func = cancel_func;
baton.cancel_baton = cancel_baton;