FreeBSD/contrib/subversion/subversion/libsvn_wc/wc_db_util.c
/* An SQLite application defined function that allows SQL queries to
   use "relpath_depth(local_relpath)".  */
An SQLite application defined function that allows SQL queries to
use "relpath_depth(local_relpath)".
An SQLite application defined function that allows SQL queries to use " relpath_depth ( local_relpath ) " .
static svn_error_t *
relpath_depth_sqlite(svn_sqlite__context_t *sctx,
                     int argc,
                     svn_sqlite__value_t *values[],
                     void *baton)
{
  const char *path = NULL;
  apr_int64_t depth;
  if (argc == 1 && svn_sqlite__value_type(values[0]) == SVN_SQLITE__TEXT)
    path = svn_sqlite__value_text(values[0]);
  if (!path)
    {
      svn_sqlite__result_null(sctx);
      return SVN_NO_ERROR;
    }
  depth = *path ? 1 : 0;
  while (*path)
    {
      if (*path == '/')
        ++depth;
      ++path;
    }
  svn_sqlite__result_int64(sctx, depth);
  return SVN_NO_ERROR;
}
static svn_error_t * relpath_depth_sqlite ( svn_sqlite__context_t * sctx , int argc , svn_sqlite__value_t * values [ ] , void * baton ) { const char * path = NULL ; apr_int64_t depth ; if ( argc == 1 && svn_sqlite__value_type ( values [ 0 ] ) == SVN_SQLITE__TEXT ) path = svn_sqlite__value_text ( values [ 0 ] ) ; if ( ! path ) { svn_sqlite__result_null ( sctx ) ; return SVN_NO_ERROR ; } depth = * path ? 1 : 0 ; while ( * path ) { if ( * path == ' ' ) ++ depth ; ++ path ; } svn_sqlite__result_int64 ( sctx , depth ) ; return SVN_NO_ERROR ; }
An SQLite application defined function that allows SQL queries to
use "relpath_depth(local_relpath)".
An SQLite application defined function that allows SQL queries to use " relpath_depth ( local_relpath ) " .