You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by gs...@apache.org on 2011/05/09 23:21:25 UTC
svn commit: r1101224 - in /subversion/trunk/subversion/libsvn_wc:
wc-queries.sql wc_db.c
Author: gstein
Date: Mon May 9 21:21:25 2011
New Revision: 1101224
URL: http://svn.apache.org/viewvc?rev=1101224&view=rev
Log:
Simplify the changelist change-notifications. We never need to filter the
notifications (unlike revert), so if it is in the table: we notify.
* subversion/libsvn_wc/wc-queries.sql:
(STMT_CREATE_CHANGELIST_LIST): update docco for one UPDATE case
(STMT_DELETE_CHANGELIST_LIST_RECURSIVE): removed
(STMT_SELECT_CHANGELIST_LIST_RECURSIVE): removed
(STMT_DROP_CHANGELIST_LIST): new statement
(STMT_SELECT_CHANGELIST_LIST): select all changelist notifications
(STMT_CREATE_DELETE_LIST): leave note that we should record wc_id
* subversion/libsvn_wc/wc_db.c:
(svn_wc__db_op_set_changelist): remove LIKE_ARG and simplify the loop
selecting rows for the database. remove the no-row optimization since
we want the exiting-statement to drop the table. adjust column indices
to account for selecting wc_id (unused for now). on exit, drop the
table rather than the special row deletion code.
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=1101224&r1=1101223&r2=1101224&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Mon May 9 21:21:25 2011
@@ -386,7 +386,7 @@ CREATE INDEX changelist_list_index ON ch
Action Old CL New CL Notification
------ ------ ------ ------------
UPDATE ACTUAL NULL NOT NULL cl-set
- UPDATE ACTUAL NOT NULL NOT NULL cl-clear / cl-set
+ UPDATE ACTUAL NOT NULL NOT NULL cl-set
UPDATE ACTUAL NOT NULL NULL cl-clear
Of the following triggers, the first address the first case, and the second
@@ -430,15 +430,13 @@ DROP TRIGGER IF EXISTS trigger_changelis
INSERT INTO changelist_list(wc_id, local_relpath, notify, changelist)
VALUES (?1, ?2, ?3, ?4)
--- STMT_DELETE_CHANGELIST_LIST_RECURSIVE
-DELETE FROM changelist_list
-WHERE wc_id = ?1 AND local_relpath = ?2 OR local_relpath LIKE ?3 ESCAPE '#'
+-- STMT_DROP_CHANGELIST_LIST
+DROP TABLE IF EXISTS changelist_list
--- STMT_SELECT_CHANGELIST_LIST_RECURSIVE
-SELECT local_relpath, notify, changelist
+-- STMT_SELECT_CHANGELIST_LIST
+SELECT wc_id, local_relpath, notify, changelist
FROM changelist_list
-WHERE wc_id = ?1 AND local_relpath = ?2 or local_relpath LIKE ?3 ESCAPE '#'
-ORDER BY local_relpath
+ORDER BY wc_id, local_relpath
-- STMT_DELETE_ACTUAL_EMPTY
DELETE FROM actual_node
@@ -1079,6 +1077,8 @@ WHERE local_relpath = ?1 OR local_relpat
-- STMT_CREATE_DELETE_LIST
DROP TABLE IF EXISTS delete_list;
CREATE TEMPORARY TABLE delete_list (
+/* ### we should put the wc_id in here in case a delete spans multiple
+ ### working copies. queries, etc will need to be adjusted. */
local_relpath TEXT PRIMARY KEY
)
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1101224&r1=1101223&r2=1101224&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Mon May 9 21:21:25 2011
@@ -4858,7 +4858,6 @@ svn_wc__db_op_set_changelist(svn_wc__db_
struct with_triggers_baton_t wtb = { STMT_CREATE_CHANGELIST_LIST,
STMT_DROP_CHANGELIST_LIST_TRIGGERS,
NULL, NULL };
- const char *like_arg;
svn_sqlite__stmt_t *stmt;
svn_boolean_t have_row;
apr_pool_t *iterpool = svn_pool_create(scratch_pool);
@@ -4906,20 +4905,15 @@ svn_wc__db_op_set_changelist(svn_wc__db_
return SVN_NO_ERROR;
}
- like_arg = construct_like_arg(local_relpath, scratch_pool);
-
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
- STMT_SELECT_CHANGELIST_LIST_RECURSIVE));
- SVN_ERR(svn_sqlite__bindf(stmt, "iss", wcroot->wc_id, local_relpath,
- like_arg));
+ STMT_SELECT_CHANGELIST_LIST));
SVN_ERR(svn_sqlite__step(&have_row, stmt));
- if (!have_row)
- return svn_error_return(svn_sqlite__reset(stmt)); /* optimise for no row */
while (have_row)
{
- const char *notify_relpath = svn_sqlite__column_text(stmt, 0, NULL);
- svn_wc_notify_action_t action = svn_sqlite__column_int(stmt, 1);
+ /* ### wc_id is column 0. use it one day... */
+ const char *notify_relpath = svn_sqlite__column_text(stmt, 1, NULL);
+ svn_wc_notify_action_t action = svn_sqlite__column_int(stmt, 2);
svn_wc_notify_t *notify;
const char *notify_abspath;
@@ -4931,18 +4925,14 @@ svn_wc__db_op_set_changelist(svn_wc__db_
notify_abspath = svn_dirent_join(wcroot->abspath, notify_relpath,
iterpool);
notify = svn_wc_create_notify(notify_abspath, action, iterpool);
- notify->changelist_name = svn_sqlite__column_text(stmt, 2, NULL);
+ notify->changelist_name = svn_sqlite__column_text(stmt, 3, NULL);
notify_func(notify_baton, notify, iterpool);
SVN_ERR(svn_sqlite__step(&have_row, stmt));
}
SVN_ERR(svn_sqlite__reset(stmt));
- SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
- STMT_DELETE_CHANGELIST_LIST_RECURSIVE));
- SVN_ERR(svn_sqlite__bindf(stmt, "iss", wcroot->wc_id, local_relpath,
- like_arg));
- SVN_ERR(svn_sqlite__step_done(stmt));
+ SVN_ERR(svn_sqlite__exec_statements(wcroot->sdb, STMT_DROP_CHANGELIST_LIST));
svn_pool_destroy(iterpool);