> -----Original Message-----
> From: Philip Martin [mailto:philip.mar...@wandisco.com]
> Sent: vrijdag 11 juni 2010 11:36
> To: dev@subversion.apache.org
> Subject: Re: svn commit: r953617 - in
> /subversion/trunk/subversion/libsvn_wc: merge.c props.c wc-queries.sql
> wc_db.c wc_db.h workqueue.c workqueue.h
> 
> rhuij...@apache.org writes:
> 
> > Author: rhuijben
> > Date: Fri Jun 11 09:11:14 2010
> > New Revision: 953617
> 
> > +svn_error_t *
> > +svn_wc__db_temp_op_set_text_conflict_marker_files(svn_wc__db_t
> *db,
> > +                                                  const char
*local_abspath,
> > +                                                  const char
*old_basename,
> > +                                                  const char
*new_basename,
> > +                                                  const char
*wrk_basename,
> > +                                                  apr_pool_t
> > +*scratch_pool) {
> > +  svn_wc__db_pdh_t *pdh;
> > +  const char *local_relpath;
> > +  svn_sqlite__stmt_t *stmt;
> > +  svn_boolean_t got_row;
> > +
> > +  SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
> > +
> > +  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath,
> db,
> > +                                             local_abspath,
> > +
svn_sqlite__mode_readwrite,
> > +                                             scratch_pool,
> > + scratch_pool));  VERIFY_USABLE_PDH(pdh);
> > +
> > +  SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
> > +                                    STMT_SELECT_ACTUAL_NODE));
> > + SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id,
> > + local_relpath));
> > +
> > +  SVN_ERR(svn_sqlite__step(&got_row, stmt));
> > + SVN_ERR(svn_sqlite__reset(stmt));
> > +
> > +  if (got_row)
> > +    {
> > +      SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
> > +
STMT_UPDATE_ACTUAL_TEXT_CONFLICTS));
> > +    }
> > +  else
> > +    {
> > +      SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
> > +
STMT_INSERT_ACTUAL_TEXT_CONFLICTS));
> > +    }
> 
> This SQL stuff is all a bit new to me.  Why do you choose to have distinct
> insert and update queries rather than an insert or replace query?  Should
> there be a transaction to combine the SELECT query with the UPDATE/INSERT
> query?  Or are you relying on the working copy lock?
> I realise this is a _temp_ function.

There are more fields in ACTUAL_NODE then there are touched by this
function. If I would use an INSERT OR REPLACE, I would remove changelists,
properties and other data stored in actual node. (Sqlite documents that it
removes the old record, before it inserts the new one if it has a collision
on the insert).

(See also Greg's reply that I should have added a note on using a
transaction for this)

        Bert

Reply via email to