/* ** Copyright (c) 2002 D. Richard Hipp ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public ** License as published by the Free Software Foundation; either ** version 2 of the License, or (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** You should have received a copy of the GNU General Public ** License along with this library; if not, write to the ** Free Software Foundation, Inc., 59 Temple Place - Suite 330, ** Boston, MA 02111-1307, USA. ** ** Author contact information: ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ******************************************************************************* ** ** This file includes the code required to generate a fairly large "test" ** CVSTrac database. ** ** Generated database is schema version 1.0. Make sure you run ** cvstrac update `pwd` ** before trying to use it. */ #include #include #include #include #include #include #include #define MAX_CHNG 20000 #define MAX_FILECHNG 10 /* per CHNG */ #define MAX_DEPTH 3 /* directories in a FILECHNG */ #define MAX_DIR 8 /* breadth of directory tree */ #define CODE_OVER 5*86400*365 /* approx 5 years of development */ static void generate_chng(sqlite3 *db, time_t when, int cn){ int rc; char *zSql; char *zErrMsg; char zDir[4096]; char zBase[4096]; int depth = 1+(rand()%MAX_DEPTH); int num_filechng = 1+(rand()%MAX_FILECHNG); int j,k; zDir[0] = 0; sqlite3_exec(db,"BEGIN;",0,0,&zErrMsg); /* For simplicity, each CHNG record only hits a single directory. */ for(j=k=0;j