Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Merge all recent trunk changes into the clear-title branch (since we hold clear title on all recent changes.) |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | clear-title |
| Files: | files | file ages | folders |
| SHA1: |
64541535d92a6fdb5898bf9558982e5f |
| User & Date: | drh 2010-04-02 20:09:02.000 |
Context
|
2010-04-04
| ||
| 23:20 | Pull in recent graph layout changes. ... (check-in: 0551ff8178 user: drh tags: clear-title) | |
|
2010-04-02
| ||
| 20:09 | Merge all recent trunk changes into the clear-title branch (since we hold clear title on all recent changes.) ... (check-in: 64541535d9 user: drh tags: clear-title) | |
| 19:28 | Add additional markups to show inefficient queries when running in TH3_DEBUG mode. ... (check-in: 251fd001a8 user: drh tags: trunk) | |
|
2010-03-18
| ||
| 14:40 | Merge in all of the latest clear-title changes from the trunk. ... (check-in: 7c2577bd63 user: drh tags: clear-title) | |
Changes
Changes to src/attach.c.
| ︙ | ︙ | |||
28 29 30 31 32 33 34 | #include <assert.h> /* ** WEBPAGE: attachlist ** ** tkt=TICKETUUID ** page=WIKIPAGE | < > > > > | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
#include <assert.h>
/*
** WEBPAGE: attachlist
**
** tkt=TICKETUUID
** page=WIKIPAGE
**
** List attachments.
** Either one of tkt= or page= are supplied or neither. If neither
** are given, all attachments are listed. If one is given, only
** attachments for the designated ticket or wiki page are shown.
** TICKETUUID must be complete
*/
void attachlist_page(void){
const char *zPage = P("page");
const char *zTkt = P("tkt");
Blob sql;
Stmt q;
|
| ︙ | ︙ |
Changes to src/branch.c.
| ︙ | ︙ | |||
120 121 122 123 124 125 126 |
"SELECT tagname FROM tagxref, tag"
" WHERE tagxref.rid=%d AND tagxref.tagid=tag.tagid"
" AND tagtype>0 AND tagname GLOB 'sym-*'"
" ORDER BY tagname",
rootid);
while( db_step(&q)==SQLITE_ROW ){
const char *zTag = db_column_text(&q, 0);
| | | 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
"SELECT tagname FROM tagxref, tag"
" WHERE tagxref.rid=%d AND tagxref.tagid=tag.tagid"
" AND tagtype>0 AND tagname GLOB 'sym-*'"
" ORDER BY tagname",
rootid);
while( db_step(&q)==SQLITE_ROW ){
const char *zTag = db_column_text(&q, 0);
blob_appendf(&branch, "T -%F *\n", zTag);
}
db_finalize(&q);
blob_appendf(&branch, "U %F\n", g.zLogin);
md5sum_blob(&branch, &mcksum);
blob_appendf(&branch, "Z %b\n", &mcksum);
if( !noSign && clearsign(&branch, &branch) ){
|
| ︙ | ︙ | |||
244 245 246 247 248 249 250 |
@ </ol>
style_sidebox_end();
db_prepare(&q,
"SELECT DISTINCT value FROM tagxref"
" WHERE tagid=%d AND value NOT NULL"
" AND rid IN leaves"
| | | 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
@ </ol>
style_sidebox_end();
db_prepare(&q,
"SELECT DISTINCT value FROM tagxref"
" WHERE tagid=%d AND value NOT NULL"
" AND rid IN leaves"
" ORDER BY value /*sort*/",
TAG_BRANCH
);
cnt = 0;
while( db_step(&q)==SQLITE_ROW ){
const char *zBr = db_column_text(&q, 0);
if( cnt==0 ){
@ <h2>Open Branches:</h2>
|
| ︙ | ︙ | |||
273 274 275 276 277 278 279 |
db_prepare(&q,
"SELECT value FROM tagxref"
" WHERE tagid=%d AND value NOT NULL"
" EXCEPT "
"SELECT value FROM tagxref"
" WHERE tagid=%d AND value NOT NULL"
" AND rid IN leaves"
| | | 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 |
db_prepare(&q,
"SELECT value FROM tagxref"
" WHERE tagid=%d AND value NOT NULL"
" EXCEPT "
"SELECT value FROM tagxref"
" WHERE tagid=%d AND value NOT NULL"
" AND rid IN leaves"
" ORDER BY value /*sort*/",
TAG_BRANCH, TAG_BRANCH
);
while( db_step(&q)==SQLITE_ROW ){
const char *zBr = db_column_text(&q, 0);
if( cnt==0 ){
@ <h2>Closed Branches:</h2>
@ <ul>
|
| ︙ | ︙ |
Changes to src/browse.c.
| ︙ | ︙ | |||
148 149 150 151 152 153 154 |
if( zCI ){
char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
char zShort[20];
memcpy(zShort, zUuid, 10);
zShort[10] = 0;
@ <h2>Files of check-in [<a href="vinfo?name=%T(zUuid)">%s(zShort)</a>]
@ %s(blob_str(&dirname))</h2>
| | | | | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
if( zCI ){
char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
char zShort[20];
memcpy(zShort, zUuid, 10);
zShort[10] = 0;
@ <h2>Files of check-in [<a href="vinfo?name=%T(zUuid)">%s(zShort)</a>]
@ %s(blob_str(&dirname))</h2>
zSubdirLink = mprintf("%s/dir?ci=%S&name=%T", g.zTop, zUuid, zPrefix);
if( zD ){
style_submenu_element("Top", "Top", "%s/dir?ci=%S", g.zTop, zUuid);
style_submenu_element("All", "All", "%s/dir?name=%t", g.zTop, zD);
}else{
style_submenu_element("All", "All", "%s/dir", g.zBaseURL);
}
}else{
@ <h2>The union of all files from all check-ins
@ %s(blob_str(&dirname))</h2>
zSubdirLink = mprintf("%s/dir?name=%T", g.zBaseURL, zPrefix);
|
| ︙ | ︙ | |||
215 216 217 218 219 220 221 |
" SELECT pathelement(x,0), u FROM allfiles"
);
}
/* Generate a multi-column table listing the contents of zD[]
** directory.
*/
| | | | | 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
" SELECT pathelement(x,0), u FROM allfiles"
);
}
/* Generate a multi-column table listing the contents of zD[]
** directory.
*/
mxLen = db_int(12, "SELECT max(length(x)) FROM localfiles /*scan*/");
cnt = db_int(0, "SELECT count(*) FROM localfiles /*scan*/");
nCol = 4;
nRow = (cnt+nCol-1)/nCol;
db_prepare(&q, "SELECT x, u FROM localfiles ORDER BY x /*scan*/");
@ <table border="0" width="100%%"><tr><td valign="top" width="25%%">
i = 0;
while( db_step(&q)==SQLITE_ROW ){
const char *zFN;
if( i==nRow ){
@ </td><td valign="top" width="25%%">
i = 0;
|
| ︙ | ︙ |
Changes to src/db.c.
| ︙ | ︙ | |||
46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
** An single SQL statement is represented as an instance of the following
** structure.
*/
struct Stmt {
Blob sql; /* The SQL for this statement */
sqlite3_stmt *pStmt; /* The results of sqlite3_prepare() */
Stmt *pNext, *pPrev; /* List of all unfinalized statements */
};
#endif /* INTERFACE */
/*
** Call this routine when a database error occurs.
*/
static void db_err(const char *zFormat, ...){
| > | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
** An single SQL statement is represented as an instance of the following
** structure.
*/
struct Stmt {
Blob sql; /* The SQL for this statement */
sqlite3_stmt *pStmt; /* The results of sqlite3_prepare() */
Stmt *pNext, *pPrev; /* List of all unfinalized statements */
int nStep; /* Number of sqlite3_step() calls */
};
#endif /* INTERFACE */
/*
** Call this routine when a database error occurs.
*/
static void db_err(const char *zFormat, ...){
|
| ︙ | ︙ | |||
189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
blob_vappendf(&pStmt->sql, zFormat, ap);
va_end(ap);
zSql = blob_str(&pStmt->sql);
if( sqlite3_prepare_v2(g.db, zSql, -1, &pStmt->pStmt, 0)!=0 ){
db_err("%s\n%s", sqlite3_errmsg(g.db), zSql);
}
pStmt->pNext = pStmt->pPrev = 0;
return 0;
}
int db_prepare(Stmt *pStmt, const char *zFormat, ...){
int rc;
va_list ap;
va_start(ap, zFormat);
rc = db_vprepare(pStmt, zFormat, ap);
| > | 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
blob_vappendf(&pStmt->sql, zFormat, ap);
va_end(ap);
zSql = blob_str(&pStmt->sql);
if( sqlite3_prepare_v2(g.db, zSql, -1, &pStmt->pStmt, 0)!=0 ){
db_err("%s\n%s", sqlite3_errmsg(g.db), zSql);
}
pStmt->pNext = pStmt->pPrev = 0;
pStmt->nStep = 0;
return 0;
}
int db_prepare(Stmt *pStmt, const char *zFormat, ...){
int rc;
va_list ap;
va_start(ap, zFormat);
rc = db_vprepare(pStmt, zFormat, ap);
|
| ︙ | ︙ | |||
264 265 266 267 268 269 270 271 272 273 274 275 276 277 |
/*
** Step the SQL statement. Return either SQLITE_ROW or an error code
** or SQLITE_OK if the statement finishes successfully.
*/
int db_step(Stmt *pStmt){
int rc;
rc = sqlite3_step(pStmt->pStmt);
return rc;
}
/*
** Reset or finalize a statement.
*/
int db_reset(Stmt *pStmt){
| > > > > > > > > > > > > > > > > > > > > > > | > | 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
/*
** Step the SQL statement. Return either SQLITE_ROW or an error code
** or SQLITE_OK if the statement finishes successfully.
*/
int db_step(Stmt *pStmt){
int rc;
rc = sqlite3_step(pStmt->pStmt);
pStmt->nStep++;
return rc;
}
/*
** Print warnings if a query is inefficient.
*/
static void db_stats(Stmt *pStmt){
#ifdef FOSSIL_DEBUG
int c1, c2;
const char *zSql = sqlite3_sql(pStmt->pStmt);
if( zSql==0 ) return;
c1 = sqlite3_stmt_status(pStmt->pStmt, SQLITE_STMTSTATUS_FULLSCAN_STEP, 1);
c2 = sqlite3_stmt_status(pStmt->pStmt, SQLITE_STMTSTATUS_SORT, 1);
if( c1>pStmt->nStep*4 && strstr(zSql,"/*scan*/")==0 ){
fossil_warning("%d scan steps for %d rows in [%s]", c1, pStmt->nStep, zSql);
}else if( c2 && strstr(zSql,"/*sort*/")==0 && strstr(zSql,"/*scan*/")==0 ){
fossil_warning("sort w/o index in [%s]", zSql);
}
pStmt->nStep = 0;
#endif
}
/*
** Reset or finalize a statement.
*/
int db_reset(Stmt *pStmt){
int rc;
db_stats(pStmt);
rc = sqlite3_reset(pStmt->pStmt);
db_check_result(rc);
return rc;
}
int db_finalize(Stmt *pStmt){
int rc;
db_stats(pStmt);
blob_reset(&pStmt->sql);
rc = sqlite3_finalize(pStmt->pStmt);
db_check_result(rc);
pStmt->pStmt = 0;
if( pStmt->pNext ){
pStmt->pNext->pPrev = pStmt->pPrev;
}
|
| ︙ | ︙ | |||
1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 |
** If g.useAttach that means the ~/.fossil database was opened with
** the useAttach flag set to 1. In that case no connection swap is required
** so this routine is a no-op.
*/
void db_swap_connections(void){
if( !g.useAttach ){
sqlite3 *dbTemp = g.db;
g.db = g.dbConfig;
g.dbConfig = dbTemp;
}
}
/*
** Get and set values from the CONFIG, GLOBAL_CONFIG and VVAR table in the
| > | 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 |
** If g.useAttach that means the ~/.fossil database was opened with
** the useAttach flag set to 1. In that case no connection swap is required
** so this routine is a no-op.
*/
void db_swap_connections(void){
if( !g.useAttach ){
sqlite3 *dbTemp = g.db;
assert( g.dbConfig!=0 );
g.db = g.dbConfig;
g.dbConfig = dbTemp;
}
}
/*
** Get and set values from the CONFIG, GLOBAL_CONFIG and VVAR table in the
|
| ︙ | ︙ |
Changes to src/diff.c.
| ︙ | ︙ | |||
727 728 729 730 731 732 733 | } /* ** WEBPAGE: annotate ** ** Query parameters: ** | | | | | > > | 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 |
}
/*
** WEBPAGE: annotate
**
** Query parameters:
**
** checkin=ID The manifest ID at which to start the annotation
** filename=FILENAME The filename.
*/
void annotation_page(void){
int mid;
int fnid;
int i;
Annotator ann;
login_check_credentials();
if( !g.okRead ){ login_needed(); return; }
mid = name_to_rid(PD("checkin","0"));
fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", P("filename"));
if( mid==0 || fnid==0 ){ fossil_redirect_home(); }
if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){
fossil_redirect_home();
}
style_header("File Annotation");
annotate_file(&ann, fnid, mid, g.okHistory);
@ <pre>
|
| ︙ | ︙ |
Changes to src/finfo.c.
| ︙ | ︙ | |||
56 57 58 59 60 61 62 |
iOffset = zOffset ? atoi(zOffset) : 0;
if (g.argc<3) {
usage("FILENAME");
}
file_tree_name(g.argv[2], &dest, 1);
zFilename = blob_str(&dest);
db_prepare(&q,
| > > > | | < < | > > > > | | > | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
iOffset = zOffset ? atoi(zOffset) : 0;
if (g.argc<3) {
usage("FILENAME");
}
file_tree_name(g.argv[2], &dest, 1);
zFilename = blob_str(&dest);
db_prepare(&q,
"SELECT "
" (SELECT uuid FROM blob WHERE rid=mlink.fid)," /* New file */
" (SELECT uuid FROM blob WHERE rid=mlink.mid)," /* The check-in */
" date(event.mtime,'localtime'),"
" coalesce(event.ecomment, event.comment),"
" coalesce(event.euser, event.user)"
" FROM mlink, event"
" WHERE mlink.fnid=(SELECT fnid FROM filename WHERE name=%Q)"
" AND event.objid=mlink.mid"
" ORDER BY event.mtime DESC LIMIT %d OFFSET %d /*sort*/",
zFilename, iLimit, iOffset
);
printf("History of %s\n", zFilename);
while( db_step(&q)==SQLITE_ROW ){
const char *zFileUuid = db_column_text(&q, 0);
const char *zCiUuid = db_column_text(&q, 1);
const char *zDate = db_column_text(&q, 2);
const char *zCom = db_column_text(&q, 3);
const char *zUser = db_column_text(&q, 4);
char *zOut;
printf("%s ", zDate);
if( zFileUuid==0 ){
zOut = sqlite3_mprintf("[%.10s] DELETED %s (user: %s)",
zCiUuid, zCom, zUser);
}else{
zOut = sqlite3_mprintf("[%.10s] %s (user: %s, artifact: [%.10s])",
zCiUuid, zCom, zUser, zFileUuid);
}
comment_print(zOut, 11, 79);
sqlite3_free(zOut);
}
db_finalize(&q);
blob_reset(&dest);
}
|
| ︙ | ︙ | |||
109 110 111 112 113 114 115 |
style_header("File History");
login_anonymous_available();
zPrevDate[0] = 0;
zFilename = PD("name","");
db_prepare(&q,
"SELECT"
| < | | | | | | | | | | | < < | < | | | | | | | | | | | 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
style_header("File History");
login_anonymous_available();
zPrevDate[0] = 0;
zFilename = PD("name","");
db_prepare(&q,
"SELECT"
" datetime(event.mtime,'localtime')," /* Date of change */
" coalesce(event.ecomment, event.comment)," /* Check-in comment */
" coalesce(event.euser, event.user)," /* User who made chng */
" mlink.pid," /* File rid */
" mlink.fid," /* Parent file rid */
" (SELECT uuid FROM blob WHERE rid=mlink.pid)," /* Parent file uuid */
" (SELECT uuid FROM blob WHERE rid=mlink.fid)," /* Current file uuid */
" (SELECT uuid FROM blob WHERE rid=mlink.mid)," /* Check-in uuid */
" event.bgcolor," /* Background color */
" (SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0"
" AND tagxref.rid=mlink.mid)" /* Tags */
" FROM mlink, event"
" WHERE mlink.fnid=(SELECT fnid FROM filename WHERE name=%Q)"
" AND event.objid=mlink.mid"
" ORDER BY event.mtime DESC /*sort*/",
TAG_BRANCH,
zFilename
);
blob_zero(&title);
blob_appendf(&title, "History of ");
hyperlinked_path(zFilename, &title);
@ <h2>%b(&title)</h2>
blob_reset(&title);
pGraph = graph_init();
@ <div id="canvas" style="position:relative;width:1px;height:1px;"></div>
@ <table cellspacing=0 border=0 cellpadding=0>
while( db_step(&q)==SQLITE_ROW ){
const char *zDate = db_column_text(&q, 0);
const char *zCom = db_column_text(&q, 1);
const char *zUser = db_column_text(&q, 2);
int fpid = db_column_int(&q, 3);
int frid = db_column_int(&q, 4);
const char *zPUuid = db_column_text(&q, 5);
const char *zUuid = db_column_text(&q, 6);
const char *zCkin = db_column_text(&q,7);
const char *zBgClr = db_column_text(&q, 8);
const char *zBr = db_column_text(&q, 9);
int gidx;
char zTime[10];
char zShort[20];
char zShortCkin[20];
if( zBr==0 ) zBr = "trunk";
gidx = graph_add_row(pGraph, frid, fpid>0 ? 1 : 0, &fpid, zBr);
if( memcmp(zDate, zPrevDate, 10) ){
|
| ︙ | ︙ | |||
174 175 176 177 178 179 180 |
if( zBgClr && zBgClr[0] ){
@ <td valign="top" align="left" bgcolor="%h(zBgClr)">
}else{
@ <td valign="top" align="left">
}
sqlite3_snprintf(sizeof(zShort), zShort, "%.10s", zUuid);
sqlite3_snprintf(sizeof(zShortCkin), zShortCkin, "%.10s", zCkin);
| > | | | | | | > > > | | | < > | 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
if( zBgClr && zBgClr[0] ){
@ <td valign="top" align="left" bgcolor="%h(zBgClr)">
}else{
@ <td valign="top" align="left">
}
sqlite3_snprintf(sizeof(zShort), zShort, "%.10s", zUuid);
sqlite3_snprintf(sizeof(zShortCkin), zShortCkin, "%.10s", zCkin);
if( zUuid ){
if( g.okHistory ){
@ <a href="%s(g.zTop)/artifact/%s(zUuid)">[%S(zUuid)]</a>
}else{
@ [%S(zUuid)]
}
@ part of check-in
}else{
@ <b>Deleted</b> by check-in
}
hyperlink_to_uuid(zShortCkin);
@ %h(zCom) (user:
hyperlink_to_user(zUser, zDate, "");
@ branch: %h(zBr))
if( g.okHistory && zUuid ){
if( fpid ){
@ <a href="%s(g.zTop)/fdiff?v1=%s(zPUuid)&v2=%s(zUuid)">[diff]</a>
}
@ <a href="%s(g.zTop)/annotate?checkin=%S(zCkin)&filename=%h(zFilename)">
@ [annotate]</a>
}
@ </td>
}
db_finalize(&q);
if( pGraph ){
graph_finish(pGraph, 1);
if( pGraph->nErr ){
graph_free(pGraph);
pGraph = 0;
|
| ︙ | ︙ |
Changes to src/graph.c.
| ︙ | ︙ | |||
304 305 306 307 308 309 310 |
pRow->iRail = ++p->mxRail;
pRow->railInUse = 1<<pRow->iRail;
continue;
}
if( pDesc->aiRaiser[pDesc->iRail]==0 && pDesc->zBranch==pRow->zBranch ){
pRow->iRail = pDesc->iRail;
}else{
| | | 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
pRow->iRail = ++p->mxRail;
pRow->railInUse = 1<<pRow->iRail;
continue;
}
if( pDesc->aiRaiser[pDesc->iRail]==0 && pDesc->zBranch==pRow->zBranch ){
pRow->iRail = pDesc->iRail;
}else{
pRow->iRail = findFreeRail(p, 0, pDesc->idx, inUse, pDesc->iRail);
}
pDesc->aiRaiser[pRow->iRail] = pRow->idx;
mask = 1<<pRow->iRail;
if( pRow->isLeaf ){
inUse &= ~mask;
}else{
inUse |= mask;
|
| ︙ | ︙ |
Changes to src/http.c.
| ︙ | ︙ | |||
191 192 193 194 195 196 197 |
** Read and interpret the server reply
*/
closeConnection = 1;
iLength = -1;
while( (zLine = transport_receive_line())!=0 && zLine[0]!=0 ){
if( strncasecmp(zLine, "http/1.", 7)==0 ){
if( sscanf(zLine, "HTTP/1.%d %d", &iHttpVersion, &rc)!=2 ) goto write_err;
| | > | | > > > > > > > > > > > > > > > | | 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 |
** Read and interpret the server reply
*/
closeConnection = 1;
iLength = -1;
while( (zLine = transport_receive_line())!=0 && zLine[0]!=0 ){
if( strncasecmp(zLine, "http/1.", 7)==0 ){
if( sscanf(zLine, "HTTP/1.%d %d", &iHttpVersion, &rc)!=2 ) goto write_err;
if( rc!=200 && rc!=302 ){
int ii;
for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){}
while( zLine[ii]==' ' ) ii++;
fossil_fatal("server says: %s\n", &zLine[ii]);
goto write_err;
}
if( iHttpVersion==0 ){
closeConnection = 1;
}else{
closeConnection = 0;
}
}else if( strncasecmp(zLine, "content-length:", 15)==0 ){
for(i=15; isspace(zLine[i]); i++){}
iLength = atoi(&zLine[i]);
}else if( strncasecmp(zLine, "connection:", 11)==0 ){
char c;
for(i=11; isspace(zLine[i]); i++){}
c = zLine[i];
if( c=='c' || c=='C' ){
closeConnection = 1;
}else if( c=='k' || c=='K' ){
closeConnection = 0;
}
}else if( rc==302 && strncasecmp(zLine, "location:", 9)==0 ){
int i, j;
for(i=9; zLine[i] && zLine[i]==' '; i++){}
if( zLine[i]==0 ) fossil_fatal("malformed redirect: %s", zLine);
j = strlen(zLine) - 1;
if( j>4 && strcmp(&zLine[j-4],"/xfer")==0 ) zLine[j-4] = 0;
printf("redirect to %s\n", &zLine[i]);
url_parse(&zLine[i]);
transport_close();
http_exchange(pSend, pReply, useLogin);
return;
}
}
if( rc!=200 ){
fossil_fatal("\"location:\" missing from 302 redirect reply");
goto write_err;
}
/*
** Extract the reply payload that follows the header
*/
if( iLength<0 ){
fossil_fatal("server did not reply");
goto write_err;
}
blob_zero(pReply);
blob_resize(pReply, iLength);
iLength = transport_receive(blob_buffer(pReply), iLength);
blob_resize(pReply, iLength);
if( g.fHttpTrace ){
|
| ︙ | ︙ |
Changes to src/info.c.
| ︙ | ︙ | |||
344 345 346 347 348 349 350 |
if( zUser==0 || zUser[0]==0 ) zUser = "unknown";
@ <tr><th>Received From:</th>
@ <td>%h(zUser) @ %h(zIpAddr) on %s(zDate)</td></tr>
}
db_finalize(&q);
}
if( g.okHistory ){
| < | | | | | | | | < | 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 |
if( zUser==0 || zUser[0]==0 ) zUser = "unknown";
@ <tr><th>Received From:</th>
@ <td>%h(zUser) @ %h(zIpAddr) on %s(zDate)</td></tr>
}
db_finalize(&q);
}
if( g.okHistory ){
const char *zProjName = db_get("project-name", "unnamed");
@ <tr><th>Timelines:</th><td>
@ <a href="%s(g.zBaseURL)/timeline?p=%S(zUuid)">ancestors</a>
@ | <a href="%s(g.zBaseURL)/timeline?d=%S(zUuid)">descendants</a>
@ | <a href="%s(g.zBaseURL)/timeline?d=%S(zUuid)&p=%S(zUuid)">both</a>
db_prepare(&q, "SELECT substr(tag.tagname,5) FROM tagxref, tag "
" WHERE rid=%d AND tagtype>0 "
" AND tag.tagid=tagxref.tagid "
" AND +tag.tagname GLOB 'sym-*'", rid);
while( db_step(&q)==SQLITE_ROW ){
const char *zTagName = db_column_text(&q, 0);
@ | <a href="%s(g.zTop)/timeline?t=%T(zTagName)">%h(zTagName)</a>
}
db_finalize(&q);
@ </td></tr>
@ <tr><th>Other Links:</th>
@ <td>
@ <a href="%s(g.zTop)/dir?ci=%S(zUuid)">files</a>
@ | <a href="%s(g.zTop)/zip/%s(zProjName)-%S(zUuid).zip?uuid=%s(zUuid)">
@ ZIP archive</a>
@ | <a href="%s(g.zTop)/artifact/%S(zUuid)">manifest</a>
if( g.okWrite ){
@ | <a href="%s(g.zTop)/ci_edit?r=%S(zUuid)">edit</a>
}
@ </td>
@ </tr>
}
@ </table></p>
}else{
style_header("Check-in Information");
login_anonymous_available();
}
db_finalize(&q);
|
| ︙ | ︙ | |||
397 398 399 400 401 402 403 |
if( showDiff ){
@ <a href="%s(g.zBaseURL)/ci/%T(zName)">[hide diffs]</a><br/>
}else{
@ <a href="%s(g.zBaseURL)/vinfo/%T(zName)">[show diffs]</a><br/>
}
}
db_prepare(&q,
| | > > < < | | | | | | | | | 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 |
if( showDiff ){
@ <a href="%s(g.zBaseURL)/ci/%T(zName)">[hide diffs]</a><br/>
}else{
@ <a href="%s(g.zBaseURL)/vinfo/%T(zName)">[show diffs]</a><br/>
}
}
db_prepare(&q,
"SELECT pid, fid, name,"
" (SELECT uuid FROM blob WHERE rid=mlink.pid),"
" (SELECT uuid FROM blob WHERE rid=mlink.fid)"
" FROM mlink JOIN filename ON filename.fnid=mlink.fnid"
" WHERE mlink.mid=%d"
" ORDER BY name",
rid
);
while( db_step(&q)==SQLITE_ROW ){
int pid = db_column_int(&q,0);
int fid = db_column_int(&q,1);
const char *zName = db_column_text(&q,2);
const char *zOld = db_column_text(&q,3);
const char *zNew = db_column_text(&q,4);
if( !g.okHistory ){
if( zNew==0 ){
@ <p>Deleted %h(zName)</p>
continue;
}else{
@ <p>Changes to %h(zName)</p>
}
}else if( zOld && zNew ){
@ <p>Modified <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
@ from <a href="%s(g.zTop)/artifact/%s(zOld)">[%S(zOld)]</a>
@ to <a href="%s(g.zTop)/artifact/%s(zNew)">[%S(zNew)].</a>
if( !showDiff ){
@
@ <a href="%s(g.zTop)/fdiff?v1=%S(zOld)&v2=%S(zNew)">[diff]</a>
}
}else if( zOld ){
@ <p>Deleted <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
@ version <a href="%s(g.zTop)/artifact/%s(zOld)">[%S(zOld)]</a></p>
continue;
}else{
@ <p>Added <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
@ version <a href="%s(g.zTop)/artifact/%s(zNew)">[%S(zNew)]</a></p>
}
if( showDiff ){
@ <blockquote><pre>
append_diff(pid, fid);
@ </pre></blockquote>
}
}
|
| ︙ | ︙ | |||
496 497 498 499 500 501 502 |
@ <tr><th>Record ID:</th><td>%d(rid)</td></tr>
}
@ <tr><th>Original User:</th><td>
hyperlink_to_user(zUser, zDate, "</td></tr>");
if( g.okHistory ){
@ <tr><th>Commands:</th>
@ <td>
| < | | 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 |
@ <tr><th>Record ID:</th><td>%d(rid)</td></tr>
}
@ <tr><th>Original User:</th><td>
hyperlink_to_user(zUser, zDate, "</td></tr>");
if( g.okHistory ){
@ <tr><th>Commands:</th>
@ <td>
@ <a href="%s(g.zBaseURL)/whistory?name=%t(zName)">history</a>
@ | <a href="%s(g.zBaseURL)/artifact/%S(zUuid)">raw-text</a>
@ </td>
@ </tr>
}
@ </table></p>
}else{
style_header("Wiki Information");
rid = 0;
|
| ︙ | ︙ | |||
619 620 621 622 623 624 625 626 627 628 629 630 631 632 |
int rid, /* The artifact ID */
int linkToView, /* Add viewer link if true */
Blob *pDownloadName /* Fill with an appropriate download name */
){
Stmt q;
int cnt = 0;
int nWiki = 0;
db_prepare(&q,
"SELECT filename.name, datetime(event.mtime),"
" coalesce(event.ecomment,event.comment),"
" coalesce(event.euser,event.user),"
" b.uuid"
" FROM mlink, filename, event, blob a, blob b"
" WHERE filename.fnid=mlink.fnid"
| > > | 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 |
int rid, /* The artifact ID */
int linkToView, /* Add viewer link if true */
Blob *pDownloadName /* Fill with an appropriate download name */
){
Stmt q;
int cnt = 0;
int nWiki = 0;
char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
db_prepare(&q,
"SELECT filename.name, datetime(event.mtime),"
" coalesce(event.ecomment,event.comment),"
" coalesce(event.euser,event.user),"
" b.uuid"
" FROM mlink, filename, event, blob a, blob b"
" WHERE filename.fnid=mlink.fnid"
|
| ︙ | ︙ | |||
689 690 691 692 693 694 695 |
}
@ by
hyperlink_to_user(zUser,zDate," on");
hyperlink_to_date(zDate,".");
nWiki++;
cnt++;
if( pDownloadName && blob_size(pDownloadName)==0 ){
| | | 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 |
}
@ by
hyperlink_to_user(zUser,zDate," on");
hyperlink_to_date(zDate,".");
nWiki++;
cnt++;
if( pDownloadName && blob_size(pDownloadName)==0 ){
blob_appendf(pDownloadName, "%s.wiki", zPagename);
}
}
db_finalize(&q);
if( nWiki==0 ){
db_prepare(&q,
"SELECT datetime(mtime), user, comment, type, uuid"
" FROM event, blob"
|
| ︙ | ︙ | |||
724 725 726 727 728 729 730 |
@ Control file referencing
}
hyperlink_to_uuid(zUuid);
@ - %w(zCom) by
hyperlink_to_user(zUser,zDate," on");
hyperlink_to_date(zDate, ".");
if( pDownloadName && blob_size(pDownloadName)==0 ){
| | | | 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 |
@ Control file referencing
}
hyperlink_to_uuid(zUuid);
@ - %w(zCom) by
hyperlink_to_user(zUser,zDate," on");
hyperlink_to_date(zDate, ".");
if( pDownloadName && blob_size(pDownloadName)==0 ){
blob_appendf(pDownloadName, "%.10s.txt", zUuid);
}
cnt++;
}
db_finalize(&q);
}
db_prepare(&q,
"SELECT target, filename, datetime(mtime), user, src"
" FROM attachment"
" WHERE src=(SELECT uuid FROM blob WHERE rid=%d)"
" ORDER BY mtime DESC",
rid
);
while( db_step(&q)==SQLITE_ROW ){
const char *zTarget = db_column_text(&q, 0);
const char *zFilename = db_column_text(&q, 1);
const char *zDate = db_column_text(&q, 2);
const char *zUser = db_column_text(&q, 3);
/* const char *zSrc = db_column_text(&q, 4); */
if( cnt>0 ){
@ Also attachment "%h(zFilename)" to
}else{
@ Attachment "%h(zFilename)" to
}
if( strlen(zTarget)==UUID_SIZE && validate16(zTarget,UUID_SIZE) ){
char zShort[20];
|
| ︙ | ︙ | |||
768 769 770 771 772 773 774 |
}
}
@ added by
hyperlink_to_user(zUser,zDate," on");
hyperlink_to_date(zDate,".");
cnt++;
if( pDownloadName && blob_size(pDownloadName)==0 ){
| | < | | | | | 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 |
}
}
@ added by
hyperlink_to_user(zUser,zDate," on");
hyperlink_to_date(zDate,".");
cnt++;
if( pDownloadName && blob_size(pDownloadName)==0 ){
blob_append(pDownloadName, zFilename, -1);
}
}
db_finalize(&q);
if( cnt==0 ){
@ Control artifact.
if( pDownloadName && blob_size(pDownloadName)==0 ){
blob_appendf(pDownloadName, "%.10s.txt", zUuid);
}
}else if( linkToView && g.okHistory ){
@ <a href="%s(g.zBaseURL)/artifact/%S(zUuid)">[view]</a>
}
}
/*
** WEBPAGE: fdiff
**
** Two arguments, v1 and v2, are integers. Show the difference between
** the two records.
*/
void diff_page(void){
int v1 = name_to_rid(P("v1"));
int v2 = name_to_rid(P("v2"));
Blob c1, c2, diff;
login_check_credentials();
if( !g.okRead ){ login_needed(); return; }
style_header("Diff");
@ <h2>Differences From:</h2>
@ <blockquote>
|
| ︙ | ︙ | |||
927 928 929 930 931 932 933 |
style_header("Hex Artifact Content");
zUuid = db_text("?","SELECT uuid FROM blob WHERE rid=%d", rid);
@ <h2>Artifact %s(zUuid):</h2>
@ <blockquote>
blob_zero(&downloadName);
object_description(rid, 0, &downloadName);
style_submenu_element("Download", "Download",
| | | 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 |
style_header("Hex Artifact Content");
zUuid = db_text("?","SELECT uuid FROM blob WHERE rid=%d", rid);
@ <h2>Artifact %s(zUuid):</h2>
@ <blockquote>
blob_zero(&downloadName);
object_description(rid, 0, &downloadName);
style_submenu_element("Download", "Download",
"%s/raw/%T?name=%s", g.zTop, blob_str(&downloadName), zUuid);
@ </blockquote>
@ <hr>
content_get(rid, &content);
@ <blockquote><pre>
hexdump(&content);
@ </pre></blockquote>
style_footer();
|
| ︙ | ︙ | |||
974 975 976 977 978 979 980 |
style_header("Artifact Content");
zUuid = db_text("?", "SELECT uuid FROM blob WHERE rid=%d", rid);
@ <h2>Artifact %s(zUuid)</h2>
@ <blockquote>
blob_zero(&downloadName);
object_description(rid, 0, &downloadName);
style_submenu_element("Download", "Download",
| | | | | | | | | | 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 |
style_header("Artifact Content");
zUuid = db_text("?", "SELECT uuid FROM blob WHERE rid=%d", rid);
@ <h2>Artifact %s(zUuid)</h2>
@ <blockquote>
blob_zero(&downloadName);
object_description(rid, 0, &downloadName);
style_submenu_element("Download", "Download",
"%s/raw/%T?name=%s", g.zTop, blob_str(&downloadName), zUuid);
zMime = mimetype_from_name(blob_str(&downloadName));
if( zMime ){
if( strcmp(zMime, "text/html")==0 ){
if( P("txt") ){
style_submenu_element("Html", "Html",
"%s/artifact?name=%s", g.zTop, zUuid);
}else{
renderAsHtml = 1;
style_submenu_element("Text", "Text",
"%s/artifact?name=%s&txt=1", g.zTop, zUuid);
}
}else if( strcmp(zMime, "application/x-fossil-wiki")==0 ){
if( P("txt") ){
style_submenu_element("Wiki", "Wiki",
"%s/artifact?name=%s", g.zTop, zUuid);
}else{
renderAsWiki = 1;
style_submenu_element("Text", "Text",
"%s/artifact?name=%s&txt=1", g.zTop, zUuid);
}
}
}
@ </blockquote>
@ <hr>
content_get(rid, &content);
if( renderAsWiki ){
wiki_convert(&content, 0, 0);
}else if( renderAsHtml ){
@ <div>
cgi_append_content(blob_buffer(&content), blob_size(&content));
@ </div>
}else{
zMime = mimetype_from_content(&content);
@ <blockquote>
if( zMime==0 ){
@ <pre>
@ %h(blob_str(&content))
@ </pre>
style_submenu_element("Hex","Hex", "%s/hexdump?name=%s", g.zTop, zUuid);
}else if( strncmp(zMime, "image/", 6)==0 ){
@ <img src="%s(g.zBaseURL)/raw?name=%s(zUuid)&m=%s(zMime)"></img>
style_submenu_element("Hex","Hex", "%s/hexdump?name=%s", g.zTop, zUuid);
}else{
@ <pre>
hexdump(&content);
@ </pre>
}
@ </blockquote>
}
|
| ︙ | ︙ | |||
1194 1195 1196 1197 1198 1199 1200 |
{ "#c0c0c0", "#c0c0c0" },
};
int nColor = sizeof(aColor)/sizeof(aColor[0]);
int i;
login_check_credentials();
if( !g.okWrite ){ login_needed(); return; }
| | | | 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 |
{ "#c0c0c0", "#c0c0c0" },
};
int nColor = sizeof(aColor)/sizeof(aColor[0]);
int i;
login_check_credentials();
if( !g.okWrite ){ login_needed(); return; }
rid = name_to_rid(P("r"));
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
zComment = db_text(0, "SELECT coalesce(ecomment,comment)"
" FROM event WHERE objid=%d", rid);
if( zComment==0 ) fossil_redirect_home();
if( P("cancel") ){
cgi_redirectf("ci?name=%s", zUuid);
}
zNewComment = PD("c",zComment);
zUser = db_text(0, "SELECT coalesce(euser,user)"
" FROM event WHERE objid=%d", rid);
if( zUser==0 ) fossil_redirect_home();
zNewUser = PD("u",zUser);
zDate = db_text(0, "SELECT datetime(mtime)"
|
| ︙ | ︙ | |||
1313 1314 1315 1316 1317 1318 1319 |
blob_appendf(&ctrl, "Z %b\n", &cksum);
db_begin_transaction();
g.markPrivate = content_is_private(rid);
nrid = content_put(&ctrl, 0, 0);
manifest_crosslink(nrid, &ctrl);
db_end_transaction(0);
}
| | | 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 |
blob_appendf(&ctrl, "Z %b\n", &cksum);
db_begin_transaction();
g.markPrivate = content_is_private(rid);
nrid = content_put(&ctrl, 0, 0);
manifest_crosslink(nrid, &ctrl);
db_end_transaction(0);
}
cgi_redirectf("ci?name=%s", zUuid);
}
blob_zero(&comment);
blob_append(&comment, zNewComment, -1);
zUuid[10] = 0;
style_header("Edit Check-in [%s]", zUuid);
if( P("preview") ){
Blob suffix;
|
| ︙ | ︙ | |||
1355 1356 1357 1358 1359 1360 1361 |
@ %s(blob_str(&suffix))
@ </td></tr></table>
@ </blockquote>
@ <hr>
blob_reset(&suffix);
}
@ <p>Make changes to attributes of check-in
| | | 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 |
@ %s(blob_str(&suffix))
@ </td></tr></table>
@ </blockquote>
@ <hr>
blob_reset(&suffix);
}
@ <p>Make changes to attributes of check-in
@ [<a href="ci?name=%s(zUuid)">%s(zUuid)</a>]:</p>
@ <form action="%s(g.zBaseURL)/ci_edit" method="POST">
login_insert_csrf_secret();
@ <input type="hidden" name="r" value="%d(rid)">
@ <table border="0" cellspacing="10">
@ <tr><td align="right" valign="top"><b>User:</b></td>
@ <td valign="top">
|
| ︙ | ︙ |
Changes to src/login.c.
| ︙ | ︙ | |||
395 396 397 398 399 400 401 402 403 404 405 406 407 408 |
" AND %Q=%Q",
rTime, &zCookie[i], blob_buffer(&b)
);
blob_reset(&b);
}
sqlite3_snprintf(sizeof(g.zCsrfToken), g.zCsrfToken, "%.10s", zCookie);
}
/* If no user found yet, try to log in as "nobody" */
if( uid==0 ){
uid = db_int(0, "SELECT uid FROM user WHERE login='nobody'");
if( uid==0 ){
/* If there is no user "nobody", then make one up - with no privileges */
uid = -1;
| > > > > > > > > > > > | 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 |
" AND %Q=%Q",
rTime, &zCookie[i], blob_buffer(&b)
);
blob_reset(&b);
}
sqlite3_snprintf(sizeof(g.zCsrfToken), g.zCsrfToken, "%.10s", zCookie);
}
/* If no user found and the REMOTE_USER environment variable is set,
** the accept the value of REMOTE_USER as the user.
*/
if( uid==0 ){
const char *zRemoteUser = P("REMOTE_USER");
if( zRemoteUser && db_get_boolean("remote_user_ok",0) ){
uid = db_int(0, "SELECT uid FROM user WHERE login=%Q"
" AND length(cap)>0 AND length(pw)>0", zRemoteUser);
}
}
/* If no user found yet, try to log in as "nobody" */
if( uid==0 ){
uid = db_int(0, "SELECT uid FROM user WHERE login='nobody'");
if( uid==0 ){
/* If there is no user "nobody", then make one up - with no privileges */
uid = -1;
|
| ︙ | ︙ | |||
474 475 476 477 478 479 480 |
for(i=0; zCap[i]; i++){
switch( zCap[i] ){
case 's': g.okSetup = 1; /* Fall thru into Admin */
case 'a': g.okAdmin = g.okRdTkt = g.okWrTkt = g.okZip =
g.okRdWiki = g.okWrWiki = g.okNewWiki =
g.okApndWiki = g.okHistory = g.okClone =
g.okNewTkt = g.okPassword = g.okRdAddr =
| | | 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 |
for(i=0; zCap[i]; i++){
switch( zCap[i] ){
case 's': g.okSetup = 1; /* Fall thru into Admin */
case 'a': g.okAdmin = g.okRdTkt = g.okWrTkt = g.okZip =
g.okRdWiki = g.okWrWiki = g.okNewWiki =
g.okApndWiki = g.okHistory = g.okClone =
g.okNewTkt = g.okPassword = g.okRdAddr =
g.okTktFmt = g.okAttach = g.okApndTkt = 1;
/* Fall thru into Read/Write */
case 'i': g.okRead = g.okWrite = 1; break;
case 'o': g.okRead = 1; break;
case 'z': g.okZip = 1; break;
case 'd': g.okDelete = 1; break;
case 'h': g.okHistory = 1; break;
|
| ︙ | ︙ |
Changes to src/main.c.
| ︙ | ︙ | |||
224 225 226 227 228 229 230 231 232 233 234 235 236 237 |
** This procedure runs first.
*/
int main(int argc, char **argv){
const char *zCmdName;
int idx;
int rc;
g.now = time(0);
g.argc = argc;
g.argv = argv;
if( getenv("GATEWAY_INTERFACE")!=0 ){
zCmdName = "cgi";
}else if( argc<2 ){
fprintf(stderr, "Usage: %s COMMAND ...\n", argv[0]);
| > | 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
** This procedure runs first.
*/
int main(int argc, char **argv){
const char *zCmdName;
int idx;
int rc;
sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0);
g.now = time(0);
g.argc = argc;
g.argv = argv;
if( getenv("GATEWAY_INTERFACE")!=0 ){
zCmdName = "cgi";
}else if( argc<2 ){
fprintf(stderr, "Usage: %s COMMAND ...\n", argv[0]);
|
| ︙ | ︙ | |||
345 346 347 348 349 350 351 352 353 354 355 356 357 358 |
va_end(ap);
if( g.cgiPanic ){
cgi_printf("<p><font color=\"red\">%h</font></p>", z);
}else{
fprintf(stderr, "%s: %s\n", g.argv[0], z);
}
}
/*
** Print a usage comment and quit
*/
void usage(const char *zFormat){
fprintf(stderr, "Usage: %s %s %s\n", g.argv[0], g.argv[1], zFormat);
exit(1);
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 |
va_end(ap);
if( g.cgiPanic ){
cgi_printf("<p><font color=\"red\">%h</font></p>", z);
}else{
fprintf(stderr, "%s: %s\n", g.argv[0], z);
}
}
/*
** Return a name for an SQLite error code
*/
static const char *sqlite_error_code_name(int iCode){
static char zCode[30];
switch( iCode & 0xff ){
case SQLITE_OK: return "SQLITE_OK";
case SQLITE_ERROR: return "SQLITE_ERROR";
case SQLITE_PERM: return "SQLITE_PERM";
case SQLITE_ABORT: return "SQLITE_ABORT";
case SQLITE_BUSY: return "SQLITE_BUSY";
case SQLITE_NOMEM: return "SQLITE_NOMEM";
case SQLITE_READONLY: return "SQLITE_READONLY";
case SQLITE_INTERRUPT: return "SQLITE_INTERRUPT";
case SQLITE_IOERR: return "SQLITE_IOERR";
case SQLITE_CORRUPT: return "SQLITE_CORRUPT";
case SQLITE_FULL: return "SQLITE_FULL";
case SQLITE_CANTOPEN: return "SQLITE_CANTOPEN";
case SQLITE_PROTOCOL: return "SQLITE_PROTOCOL";
case SQLITE_EMPTY: return "SQLITE_EMPTY";
case SQLITE_SCHEMA: return "SQLITE_SCHEMA";
case SQLITE_CONSTRAINT: return "SQLITE_CONSTRAINT";
case SQLITE_MISMATCH: return "SQLITE_MISMATCH";
case SQLITE_MISUSE: return "SQLITE_MISUSE";
case SQLITE_NOLFS: return "SQLITE_NOLFS";
case SQLITE_FORMAT: return "SQLITE_FORMAT";
case SQLITE_RANGE: return "SQLITE_RANGE";
case SQLITE_NOTADB: return "SQLITE_NOTADB";
default: {
sqlite3_snprintf(sizeof(zCode),zCode,"error code %d",iCode);
}
}
return zCode;
}
/* Error logs from SQLite */
void fossil_sqlite_log(void *notUsed, int iCode, const char *zErrmsg){
fossil_warning("%s: %s", sqlite_error_code_name(iCode), zErrmsg);
}
/*
** Print a usage comment and quit
*/
void usage(const char *zFormat){
fprintf(stderr, "Usage: %s %s %s\n", g.argv[0], g.argv[1], zFormat);
exit(1);
|
| ︙ | ︙ | |||
606 607 608 609 610 611 612 613 614 615 616 617 618 619 |
zRepo = &zDir[i];
}
if( stat(zRepo, &sStat)!=0 ){
fossil_fatal("cannot stat() repository: %s", zRepo);
}
setgid(sStat.st_gid);
setuid(sStat.st_uid);
}
#endif
return zRepo;
}
/*
** Preconditions:
| > > > > | 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 |
zRepo = &zDir[i];
}
if( stat(zRepo, &sStat)!=0 ){
fossil_fatal("cannot stat() repository: %s", zRepo);
}
setgid(sStat.st_gid);
setuid(sStat.st_uid);
if( g.db!=0 ){
db_close();
db_open_repository(zRepo);
}
}
#endif
return zRepo;
}
/*
** Preconditions:
|
| ︙ | ︙ | |||
649 650 651 652 653 654 655 656 657 658 659 660 661 662 |
/* To avoid mischief, make sure the repository basename contains no
** characters other than alphanumerics, "-", and "_".
*/
for(j=strlen(g.zRepositoryName)+1, k=0; k<i-1; j++, k++){
if( !isalnum(zRepo[j]) && zRepo[j]!='-' ) zRepo[j] = '_';
}
if( file_size(zRepo)<1024 ){
if( zNotFound ){
cgi_redirect(zNotFound);
}else{
@ <h1>Not Found</h1>
cgi_set_status(404, "not found");
| > | 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 |
/* To avoid mischief, make sure the repository basename contains no
** characters other than alphanumerics, "-", and "_".
*/
for(j=strlen(g.zRepositoryName)+1, k=0; k<i-1; j++, k++){
if( !isalnum(zRepo[j]) && zRepo[j]!='-' ) zRepo[j] = '_';
}
if( zRepo[0]=='/' && zRepo[1]=='/' ) zRepo++;
if( file_size(zRepo)<1024 ){
if( zNotFound ){
cgi_redirect(zNotFound);
}else{
@ <h1>Not Found</h1>
cgi_set_status(404, "not found");
|
| ︙ | ︙ |
Changes to src/name.c.
| ︙ | ︙ | |||
278 279 280 281 282 283 284 |
** This routine is used in test routines to resolve command-line inputs
** into a rid.
*/
int name_to_rid(const char *zName){
int i;
int rid;
Blob name;
| > > > > > | | | | | | | < < | > | | | > | 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
** This routine is used in test routines to resolve command-line inputs
** into a rid.
*/
int name_to_rid(const char *zName){
int i;
int rid;
Blob name;
if( zName==0 || zName[0]==0 ) return 0;
blob_init(&name, zName, -1);
if( name_to_uuid(&name, -1) ){
blob_reset(&name);
for(i=0; zName[i] && isdigit(zName[i]); i++){}
if( zName[i]==0 ){
rid = atoi(zName);
if( db_exists("SELECT 1 FROM blob WHERE rid=%d", rid) ){
return rid;
}
}
fossil_error(1, "no such artifact: %s", zName);
return 0;
}else{
rid = db_int(0, "SELECT rid FROM blob WHERE uuid=%B", &name);
blob_reset(&name);
}
return rid;
}
|
Changes to src/printf.c.
| ︙ | ︙ | |||
50 51 52 53 54 55 56 57 58 59 60 61 62 63 | #define etHTMLIZE 16 /* Make text safe for HTML */ #define etHTTPIZE 17 /* Make text safe for HTTP. "/" encoded as %2f */ #define etURLIZE 18 /* Make text safe for HTTP. "/" not encoded */ #define etFOSSILIZE 19 /* The fossil header encoding format. */ #define etPATH 20 /* Path type */ #define etWIKISTR 21 /* Wiki text rendered from a char* */ #define etWIKIBLOB 22 /* Wiki text rendered from a Blob* */ /* ** An "etByte" is an 8-bit unsigned value. */ typedef unsigned char etByte; | > | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | #define etHTMLIZE 16 /* Make text safe for HTML */ #define etHTTPIZE 17 /* Make text safe for HTTP. "/" encoded as %2f */ #define etURLIZE 18 /* Make text safe for HTTP. "/" not encoded */ #define etFOSSILIZE 19 /* The fossil header encoding format. */ #define etPATH 20 /* Path type */ #define etWIKISTR 21 /* Wiki text rendered from a char* */ #define etWIKIBLOB 22 /* Wiki text rendered from a Blob* */ #define etSTRINGID 23 /* String with length limit for a UUID prefix */ /* ** An "etByte" is an 8-bit unsigned value. */ typedef unsigned char etByte; |
| ︙ | ︙ | |||
99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
{ 'B', 0, 2, etBLOBSQL, 0, 0 },
{ 'w', 0, 2, etWIKISTR, 0, 0 },
{ 'W', 0, 2, etWIKIBLOB, 0, 0 },
{ 'h', 0, 4, etHTMLIZE, 0, 0 },
{ 't', 0, 4, etHTTPIZE, 0, 0 }, /* "/" -> "%2F" */
{ 'T', 0, 4, etURLIZE, 0, 0 }, /* "/" unchanged */
{ 'F', 0, 4, etFOSSILIZE, 0, 0 },
{ 'c', 0, 0, etCHARX, 0, 0 },
{ 'o', 8, 0, etRADIX, 0, 2 },
{ 'u', 10, 0, etRADIX, 0, 0 },
{ 'x', 16, 0, etRADIX, 16, 1 },
{ 'X', 16, 0, etRADIX, 0, 4 },
{ 'f', 0, 1, etFLOAT, 0, 0 },
{ 'e', 0, 1, etEXP, 30, 0 },
| > | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
{ 'B', 0, 2, etBLOBSQL, 0, 0 },
{ 'w', 0, 2, etWIKISTR, 0, 0 },
{ 'W', 0, 2, etWIKIBLOB, 0, 0 },
{ 'h', 0, 4, etHTMLIZE, 0, 0 },
{ 't', 0, 4, etHTTPIZE, 0, 0 }, /* "/" -> "%2F" */
{ 'T', 0, 4, etURLIZE, 0, 0 }, /* "/" unchanged */
{ 'F', 0, 4, etFOSSILIZE, 0, 0 },
{ 'S', 0, 4, etSTRINGID, 0, 0 },
{ 'c', 0, 0, etCHARX, 0, 0 },
{ 'o', 8, 0, etRADIX, 0, 2 },
{ 'u', 10, 0, etRADIX, 0, 0 },
{ 'x', 16, 0, etRADIX, 16, 1 },
{ 'X', 16, 0, etRADIX, 0, 4 },
{ 'f', 0, 1, etFLOAT, 0, 0 },
{ 'e', 0, 1, etEXP, 30, 0 },
|
| ︙ | ︙ | |||
573 574 575 576 577 578 579 580 581 582 583 584 585 586 |
}else{
bufpt[i]=e[i];
}
}
bufpt[length]='\0';
break;
}
case etSTRING:
case etDYNSTRING: {
int limit = flag_alternateform ? va_arg(ap,int) : -1;
bufpt = va_arg(ap,char*);
if( bufpt==0 ){
bufpt = "";
}else if( xtype==etDYNSTRING ){
| > > > > | 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 |
}else{
bufpt[i]=e[i];
}
}
bufpt[length]='\0';
break;
}
case etSTRINGID: {
precision = 16;
/* Fall through */
}
case etSTRING:
case etDYNSTRING: {
int limit = flag_alternateform ? va_arg(ap,int) : -1;
bufpt = va_arg(ap,char*);
if( bufpt==0 ){
bufpt = "";
}else if( xtype==etDYNSTRING ){
|
| ︙ | ︙ |
Changes to src/report.c.
| ︙ | ︙ | |||
920 921 922 923 924 925 926 927 928 929 930 931 932 933 |
if( g.okAdmin
|| (g.okTktFmt && g.zLogin && zOwner && strcmp(g.zLogin,zOwner)==0) ){
style_submenu_element("Edit", "Edit", "rptedit?rn=%d", rn);
}
if( g.okTktFmt ){
style_submenu_element("SQL", "SQL", "rptsql?rn=%d",rn);
}
style_header(zTitle);
output_color_key(zClrKey, 1,
"border=0 cellpadding=3 cellspacing=0 class=\"report\"");
@ <table border=1 cellpadding=2 cellspacing=0 class="report">
sState.rn = rn;
sState.nCount = 0;
sqlite3_set_authorizer(g.db, report_query_authorizer, (void*)&zErr1);
| > > > > | 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 |
if( g.okAdmin
|| (g.okTktFmt && g.zLogin && zOwner && strcmp(g.zLogin,zOwner)==0) ){
style_submenu_element("Edit", "Edit", "rptedit?rn=%d", rn);
}
if( g.okTktFmt ){
style_submenu_element("SQL", "SQL", "rptsql?rn=%d",rn);
}
if( g.okNewTkt ){
style_submenu_element("New Ticket", "Create a new ticket",
"%s/tktnew", g.zTop);
}
style_header(zTitle);
output_color_key(zClrKey, 1,
"border=0 cellpadding=3 cellspacing=0 class=\"report\"");
@ <table border=1 cellpadding=2 cellspacing=0 class="report">
sState.rn = rn;
sState.nCount = 0;
sqlite3_set_authorizer(g.db, report_query_authorizer, (void*)&zErr1);
|
| ︙ | ︙ |
Changes to src/setup.c.
| ︙ | ︙ | |||
179 180 181 182 183 184 185 |
@ <tr><td valign="top"><b>r</b></td>
@ <td><i>Read-Tkt:</i> View tickets</td></tr>
@ <tr><td valign="top"><b>s</b></td>
@ <td><i>Setup/Super-user:</i> Setup and configure this website</td></tr>
@ <tr><td valign="top"><b>t</b></td>
@ <td><i>Tkt-Report:</i> Create new bug summary reports</td></tr>
@ <tr><td valign="top"><b>u</b></td>
| | | | 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
@ <tr><td valign="top"><b>r</b></td>
@ <td><i>Read-Tkt:</i> View tickets</td></tr>
@ <tr><td valign="top"><b>s</b></td>
@ <td><i>Setup/Super-user:</i> Setup and configure this website</td></tr>
@ <tr><td valign="top"><b>t</b></td>
@ <td><i>Tkt-Report:</i> Create new bug summary reports</td></tr>
@ <tr><td valign="top"><b>u</b></td>
@ <td><i>Reader:</i> Inherit privileges of
@ user <tt>reader</tt></td></tr>
@ <tr><td valign="top"><b>v</b></td>
@ <td><i>Developer:</i> Inherit privileges of
@ user <tt>developer</tt></td></tr>
@ <tr><td valign="top"><b>w</b></td>
@ <td><i>Write-Tkt:</i> Edit tickets</td></tr>
@ <tr><td valign="top"><b>z</b></td>
@ <td><i>Zip download:</i> Download a baseline via the
@ <tt>/zip</tt> URL even without check<b>o</b>ut
@ and <b>h</b>istory permissions</td></tr>
|
| ︙ | ︙ | |||
596 597 598 599 600 601 602 | @ @ <li><p> @ Login is prohibited if the password is an empty string. @ </p></li> @ </ul> @ @ <h2>Special Logins</h2> | | | 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 | @ @ <li><p> @ Login is prohibited if the password is an empty string. @ </p></li> @ </ul> @ @ <h2>Special Logins</h2> @ @ <ul> @ <li><p> @ No login is required for user "<b>nobody</b>". The capabilities @ of the <b>nobody</b> user are inherited by all users, regardless of @ whether or not they are logged in. To disable universal access @ to the repository, make sure no user named "<b>nobody</b>" exists or @ that the <b>nobody</b> user has no capabilities enabled. |
| ︙ | ︙ | |||
734 735 736 737 738 739 740 | @ web access coming from 127.0.0.1. When disabled, web access @ from 127.0.0.1 is allows without any login - the user id is selected @ from the ~/.fossil database. Password login is always required @ for incoming web connections on internet addresses other than @ 127.0.0.1.</p></li> @ <hr> | | | | | | < | | > > > > > > > > > | 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 |
@ web access coming from 127.0.0.1. When disabled, web access
@ from 127.0.0.1 is allows without any login - the user id is selected
@ from the ~/.fossil database. Password login is always required
@ for incoming web connections on internet addresses other than
@ 127.0.0.1.</p></li>
@ <hr>
onoff_attribute("Allow REMOTE_USER authentication",
"remote_user_ok", "remote_user_ok", 0);
@ <p>When enabled, if the REMOTE_USER environment variable is set to the
@ login name of a valid user and no other login credentials are available,
@ then the REMOTE_USER is accepted as an authenticated user.
@ </p></li>
@ <hr>
entry_attribute("Login expiration time", 6, "cookie-expire", "cex", "8766");
@ <p>The number of hours for which a login is valid. This must be a
@ positive number. The default is 8760 hours which is approximately equal
@ to a year.</p>
@ <hr>
entry_attribute("Download packet limit", 10, "max-download", "mxdwn",
"5000000");
@ <p>Fossil tries to limit out-bound sync, clone, and pull packets
@ to this many bytes, uncompressed. If the client requires more data
@ than this, then the client will issue multiple HTTP requests.
@ Values below 1 million are not recommended. 5 million is a
@ reasonable number.</p>
@ <hr>
onoff_attribute("Show javascript button to fill in CAPTCHA",
"auto-captcha", "autocaptcha", 0);
@ <p>When enabled, a button appears on the login screen for user
@ "anonymous" that will automatically fill in the CAPTCHA password.
@ This is less secure that forcing the user to do it manually, but is
@ probably secure enough and it is certainly more convenient for
@ anonymous users.</p>
@ <hr>
@ <p><input type="submit" name="submit" value="Apply Changes"></p>
@ </form>
db_end_transaction(0);
style_footer();
}
|
| ︙ | ︙ | |||
799 800 801 802 803 804 805 |
"show-version-diffs", "vdiff", 0);
@ <p>On the version-information pages linked from the timeline can either
@ show complete diffs of all file changes, or can just list the names of
@ the files that have changed. Users can get to either page by
@ clicking. This setting selects the default.</p>
@ <hr>
| | | 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 |
"show-version-diffs", "vdiff", 0);
@ <p>On the version-information pages linked from the timeline can either
@ show complete diffs of all file changes, or can just list the names of
@ the files that have changed. Users can get to either page by
@ clicking. This setting selects the default.</p>
@ <hr>
entry_attribute("Max timeline comment length", 6,
"timeline-max-comment", "tmc", "0");
@ <p>The maximum length of a comment to be displayed in a timeline.
@ "0" there is no length limit.</p>
@ <hr>
@ <p><input type="submit" name="submit" value="Apply Changes"></p>
@ </form>
|
| ︙ | ︙ | |||
904 905 906 907 908 909 910 | @ <input type="submit" name="clear" value="Revert To Default"> @ </form> @ <p><b>Note:</b> Press your browser Reload button after modifying the @ CSS in order to pull in the modified CSS file.</p> @ <hr> @ The default CSS is shown below for reference. Other examples @ of CSS files can be seen on the <a href="setup_skin">skins page</a>. | | | 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 | @ <input type="submit" name="clear" value="Revert To Default"> @ </form> @ <p><b>Note:</b> Press your browser Reload button after modifying the @ CSS in order to pull in the modified CSS file.</p> @ <hr> @ The default CSS is shown below for reference. Other examples @ of CSS files can be seen on the <a href="setup_skin">skins page</a>. @ See also the <a href="setup_header">header</a> and @ <a href="setup_footer">footer</a> editing screens. @ <blockquote><pre> @ %h(zDefaultCSS) @ </pre></blockquote> style_footer(); db_end_transaction(0); } |
| ︙ | ︙ | |||
1007 1008 1009 1010 1011 1012 1013 |
login_needed();
}
db_begin_transaction();
if( P("set")!=0 && zMime && zMime[0] && szImg>0 ){
Blob img;
Stmt ins;
blob_init(&img, aImg, szImg);
| | | 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 |
login_needed();
}
db_begin_transaction();
if( P("set")!=0 && zMime && zMime[0] && szImg>0 ){
Blob img;
Stmt ins;
blob_init(&img, aImg, szImg);
db_prepare(&ins,
"REPLACE INTO config(name, value)"
" VALUES('logo-image',:bytes)"
);
db_bind_blob(&ins, ":bytes", &img);
db_step(&ins);
db_finalize(&ins);
db_multi_exec(
|
| ︙ | ︙ | |||
1031 1032 1033 1034 1035 1036 1037 |
db_end_transaction(0);
cgi_redirect("setup_logo");
}
style_header("Edit Project Logo");
@ <p>The current project logo has a MIME-Type of <b>%h(zMime)</b> and looks
@ like this:</p>
@ <blockquote><img src="%s(g.zTop)/logo" alt="logo"></blockquote>
| | | 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 |
db_end_transaction(0);
cgi_redirect("setup_logo");
}
style_header("Edit Project Logo");
@ <p>The current project logo has a MIME-Type of <b>%h(zMime)</b> and looks
@ like this:</p>
@ <blockquote><img src="%s(g.zTop)/logo" alt="logo"></blockquote>
@
@ <p>The logo is accessible to all users at this URL:
@ <a href="%s(g.zBaseURL)/logo">%s(g.zBaseURL)/logo</a>.
@ The logo may or may not appear on each
@ page depending on the <a href="setup_editcss">CSS</a> and
@ <a href="setup_header">header setup</a>.</p>
@
@ <form action="%s(g.zBaseURL)/setup_logo" method="POST"
|
| ︙ | ︙ |
Changes to src/sqlite3.c.
1 2 | /****************************************************************************** ** This file is an amalgamation of many separate C source files from SQLite | | | 1 2 3 4 5 6 7 8 9 10 | /****************************************************************************** ** This file is an amalgamation of many separate C source files from SQLite ** version 3.6.23.1. By combining all the individual C code files into this ** single large file, the entire code can be compiled as a one translation ** unit. This allows many compilers to do optimizations that would not be ** possible if the files were compiled separately. Performance improvements ** of 5% are more are commonly seen when SQLite is compiled as a single ** translation unit. ** ** This file is all you need to compile SQLite. To use SQLite in other |
| ︙ | ︙ | |||
624 625 626 627 628 629 630 | ** string contains the date and time of the check-in (UTC) and an SHA1 ** hash of the entire source tree. ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ | | | | 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 | ** string contains the date and time of the check-in (UTC) and an SHA1 ** hash of the entire source tree. ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ #define SQLITE_VERSION "3.6.23.1" #define SQLITE_VERSION_NUMBER 3006023 #define SQLITE_SOURCE_ID "2010-03-26 22:28:06 ex-b078b588d617e07886ad156e9f54ade6d823568e" /* ** CAPI3REF: Run-Time Library Version Numbers ** KEYWORDS: sqlite3_version, sqlite3_sourceid ** ** These interfaces provide the same information as the [SQLITE_VERSION], ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros |
| ︙ | ︙ | |||
10423 10424 10425 10426 10427 10428 10429 |
SQLITE_PRIVATE const void *sqlite3ValueText(sqlite3_value*, u8);
SQLITE_PRIVATE int sqlite3ValueBytes(sqlite3_value*, u8);
SQLITE_PRIVATE void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8,
void(*)(void*));
SQLITE_PRIVATE void sqlite3ValueFree(sqlite3_value*);
SQLITE_PRIVATE sqlite3_value *sqlite3ValueNew(sqlite3 *);
| | | 10423 10424 10425 10426 10427 10428 10429 10430 10431 10432 10433 10434 10435 10436 10437 |
SQLITE_PRIVATE const void *sqlite3ValueText(sqlite3_value*, u8);
SQLITE_PRIVATE int sqlite3ValueBytes(sqlite3_value*, u8);
SQLITE_PRIVATE void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8,
void(*)(void*));
SQLITE_PRIVATE void sqlite3ValueFree(sqlite3_value*);
SQLITE_PRIVATE sqlite3_value *sqlite3ValueNew(sqlite3 *);
SQLITE_PRIVATE char *sqlite3Utf16to8(sqlite3 *, const void*, int, u8);
#ifdef SQLITE_ENABLE_STAT2
SQLITE_PRIVATE char *sqlite3Utf8to16(sqlite3 *, u8, char *, int, int *);
#endif
SQLITE_PRIVATE int sqlite3ValueFromExpr(sqlite3 *, Expr *, u8, u8, sqlite3_value **);
SQLITE_PRIVATE void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8);
#ifndef SQLITE_AMALGAMATION
SQLITE_PRIVATE const unsigned char sqlite3OpcodeProperty[];
|
| ︙ | ︙ | |||
10864 10865 10866 10867 10868 10869 10870 10871 10872 10873 10874 10875 10876 10877 | ** created by mkopcodeh.awk during compilation. Data is obtained ** from the comments following the "case OP_xxxx:" statements in ** the vdbe.c file. */ SQLITE_PRIVATE const unsigned char sqlite3OpcodeProperty[] = OPFLG_INITIALIZER; /************** End of global.c **********************************************/ /************** Begin file status.c ******************************************/ /* ** 2008 June 18 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 10864 10865 10866 10867 10868 10869 10870 10871 10872 10873 10874 10875 10876 10877 10878 10879 10880 10881 10882 10883 10884 10885 10886 10887 10888 10889 10890 10891 10892 10893 10894 10895 10896 10897 10898 10899 10900 10901 10902 10903 10904 10905 10906 10907 10908 10909 10910 10911 10912 10913 10914 10915 10916 10917 10918 10919 10920 10921 10922 10923 10924 10925 10926 10927 10928 10929 10930 10931 10932 10933 10934 10935 10936 10937 10938 10939 10940 10941 10942 10943 10944 10945 10946 10947 10948 10949 10950 10951 10952 10953 10954 10955 10956 10957 10958 10959 10960 10961 10962 10963 10964 10965 10966 10967 10968 10969 10970 10971 10972 10973 10974 10975 10976 10977 10978 10979 10980 10981 10982 10983 10984 10985 10986 10987 10988 10989 10990 10991 10992 10993 10994 10995 10996 10997 10998 10999 11000 11001 11002 11003 11004 11005 11006 11007 11008 11009 11010 11011 11012 11013 11014 11015 11016 11017 11018 11019 11020 11021 11022 11023 11024 11025 11026 11027 11028 11029 11030 11031 11032 11033 11034 11035 11036 11037 11038 11039 11040 11041 11042 11043 11044 11045 11046 11047 11048 11049 11050 11051 11052 11053 11054 11055 11056 11057 11058 11059 11060 11061 11062 11063 11064 11065 11066 11067 11068 11069 11070 11071 11072 11073 11074 11075 11076 11077 11078 11079 11080 11081 11082 11083 11084 11085 11086 11087 11088 11089 11090 11091 11092 11093 11094 11095 11096 11097 11098 11099 11100 11101 11102 11103 11104 11105 11106 11107 11108 11109 11110 11111 11112 11113 11114 11115 11116 11117 11118 11119 11120 11121 11122 11123 11124 11125 11126 11127 11128 11129 11130 11131 11132 11133 11134 11135 11136 11137 11138 11139 11140 11141 11142 11143 11144 11145 11146 11147 11148 11149 11150 11151 11152 11153 11154 11155 11156 11157 11158 11159 11160 11161 11162 11163 11164 11165 11166 11167 11168 11169 11170 11171 11172 11173 11174 11175 11176 11177 11178 11179 11180 11181 11182 11183 11184 11185 11186 11187 11188 11189 11190 11191 11192 11193 11194 11195 11196 11197 11198 11199 11200 11201 11202 11203 11204 11205 11206 11207 11208 11209 11210 11211 11212 11213 11214 11215 11216 11217 11218 11219 11220 11221 11222 11223 11224 11225 11226 11227 11228 11229 11230 11231 11232 11233 11234 11235 11236 11237 11238 11239 11240 11241 11242 11243 11244 11245 11246 11247 11248 11249 11250 11251 11252 11253 11254 11255 11256 11257 11258 11259 11260 11261 11262 11263 11264 |
** created by mkopcodeh.awk during compilation. Data is obtained
** from the comments following the "case OP_xxxx:" statements in
** the vdbe.c file.
*/
SQLITE_PRIVATE const unsigned char sqlite3OpcodeProperty[] = OPFLG_INITIALIZER;
/************** End of global.c **********************************************/
/************** Begin file ctime.c *******************************************/
/*
** 2010 February 23
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
**
** May you do good and not evil.
** May you find forgiveness for yourself and forgive others.
** May you share freely, never taking more than you give.
**
*************************************************************************
**
** This file implements routines used to report what compile-time options
** SQLite was built with.
*/
#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
/*
** An array of names of all compile-time options. This array should
** be sorted A-Z.
**
** This array looks large, but in a typical installation actually uses
** only a handful of compile-time options, so most times this array is usually
** rather short and uses little memory space.
*/
static const char * const azCompileOpt[] = {
/* These macros are provided to "stringify" the value of the define
** for those options in which the value is meaningful. */
#define CTIMEOPT_VAL_(opt) #opt
#define CTIMEOPT_VAL(opt) CTIMEOPT_VAL_(opt)
#ifdef SQLITE_32BIT_ROWID
"32BIT_ROWID",
#endif
#ifdef SQLITE_4_BYTE_ALIGNED_MALLOC
"4_BYTE_ALIGNED_MALLOC",
#endif
#ifdef SQLITE_CASE_SENSITIVE_LIKE
"CASE_SENSITIVE_LIKE",
#endif
#ifdef SQLITE_CHECK_PAGES
"CHECK_PAGES",
#endif
#ifdef SQLITE_COVERAGE_TEST
"COVERAGE_TEST",
#endif
#ifdef SQLITE_DEBUG
"DEBUG",
#endif
#ifdef SQLITE_DEFAULT_LOCKING_MODE
"DEFAULT_LOCKING_MODE=" CTIMEOPT_VAL(SQLITE_DEFAULT_LOCKING_MODE),
#endif
#ifdef SQLITE_DISABLE_DIRSYNC
"DISABLE_DIRSYNC",
#endif
#ifdef SQLITE_DISABLE_LFS
"DISABLE_LFS",
#endif
#ifdef SQLITE_ENABLE_ATOMIC_WRITE
"ENABLE_ATOMIC_WRITE",
#endif
#ifdef SQLITE_ENABLE_CEROD
"ENABLE_CEROD",
#endif
#ifdef SQLITE_ENABLE_COLUMN_METADATA
"ENABLE_COLUMN_METADATA",
#endif
#ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT
"ENABLE_EXPENSIVE_ASSERT",
#endif
#ifdef SQLITE_ENABLE_FTS1
"ENABLE_FTS1",
#endif
#ifdef SQLITE_ENABLE_FTS2
"ENABLE_FTS2",
#endif
#ifdef SQLITE_ENABLE_FTS3
"ENABLE_FTS3",
#endif
#ifdef SQLITE_ENABLE_FTS3_PARENTHESIS
"ENABLE_FTS3_PARENTHESIS",
#endif
#ifdef SQLITE_ENABLE_FTS4
"ENABLE_FTS4",
#endif
#ifdef SQLITE_ENABLE_ICU
"ENABLE_ICU",
#endif
#ifdef SQLITE_ENABLE_IOTRACE
"ENABLE_IOTRACE",
#endif
#ifdef SQLITE_ENABLE_LOAD_EXTENSION
"ENABLE_LOAD_EXTENSION",
#endif
#ifdef SQLITE_ENABLE_LOCKING_STYLE
"ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE),
#endif
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
"ENABLE_MEMORY_MANAGEMENT",
#endif
#ifdef SQLITE_ENABLE_MEMSYS3
"ENABLE_MEMSYS3",
#endif
#ifdef SQLITE_ENABLE_MEMSYS5
"ENABLE_MEMSYS5",
#endif
#ifdef SQLITE_ENABLE_OVERSIZE_CELL_CHECK
"ENABLE_OVERSIZE_CELL_CHECK",
#endif
#ifdef SQLITE_ENABLE_RTREE
"ENABLE_RTREE",
#endif
#ifdef SQLITE_ENABLE_STAT2
"ENABLE_STAT2",
#endif
#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY
"ENABLE_UNLOCK_NOTIFY",
#endif
#ifdef SQLITE_ENABLE_UPDATE_DELETE_LIMIT
"ENABLE_UPDATE_DELETE_LIMIT",
#endif
#ifdef SQLITE_HAS_CODEC
"HAS_CODEC",
#endif
#ifdef SQLITE_HAVE_ISNAN
"HAVE_ISNAN",
#endif
#ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX
"HOMEGROWN_RECURSIVE_MUTEX",
#endif
#ifdef SQLITE_IGNORE_AFP_LOCK_ERRORS
"IGNORE_AFP_LOCK_ERRORS",
#endif
#ifdef SQLITE_IGNORE_FLOCK_LOCK_ERRORS
"IGNORE_FLOCK_LOCK_ERRORS",
#endif
#ifdef SQLITE_INT64_TYPE
"INT64_TYPE",
#endif
#ifdef SQLITE_LOCK_TRACE
"LOCK_TRACE",
#endif
#ifdef SQLITE_MEMDEBUG
"MEMDEBUG",
#endif
#ifdef SQLITE_MIXED_ENDIAN_64BIT_FLOAT
"MIXED_ENDIAN_64BIT_FLOAT",
#endif
#ifdef SQLITE_NO_SYNC
"NO_SYNC",
#endif
#ifdef SQLITE_OMIT_ALTERTABLE
"OMIT_ALTERTABLE",
#endif
#ifdef SQLITE_OMIT_ANALYZE
"OMIT_ANALYZE",
#endif
#ifdef SQLITE_OMIT_ATTACH
"OMIT_ATTACH",
#endif
#ifdef SQLITE_OMIT_AUTHORIZATION
"OMIT_AUTHORIZATION",
#endif
#ifdef SQLITE_OMIT_AUTOINCREMENT
"OMIT_AUTOINCREMENT",
#endif
#ifdef SQLITE_OMIT_AUTOINIT
"OMIT_AUTOINIT",
#endif
#ifdef SQLITE_OMIT_AUTOVACUUM
"OMIT_AUTOVACUUM",
#endif
#ifdef SQLITE_OMIT_BETWEEN_OPTIMIZATION
"OMIT_BETWEEN_OPTIMIZATION",
#endif
#ifdef SQLITE_OMIT_BLOB_LITERAL
"OMIT_BLOB_LITERAL",
#endif
#ifdef SQLITE_OMIT_BTREECOUNT
"OMIT_BTREECOUNT",
#endif
#ifdef SQLITE_OMIT_BUILTIN_TEST
"OMIT_BUILTIN_TEST",
#endif
#ifdef SQLITE_OMIT_CAST
"OMIT_CAST",
#endif
#ifdef SQLITE_OMIT_CHECK
"OMIT_CHECK",
#endif
#ifdef SQLITE_OMIT_COMPILEOPTION_DIAGS
"OMIT_COMPILEOPTION_DIAGS",
#endif
#ifdef SQLITE_OMIT_COMPLETE
"OMIT_COMPLETE",
#endif
#ifdef SQLITE_OMIT_COMPOUND_SELECT
"OMIT_COMPOUND_SELECT",
#endif
#ifdef SQLITE_OMIT_DATETIME_FUNCS
"OMIT_DATETIME_FUNCS",
#endif
#ifdef SQLITE_OMIT_DECLTYPE
"OMIT_DECLTYPE",
#endif
#ifdef SQLITE_OMIT_DEPRECATED
"OMIT_DEPRECATED",
#endif
#ifdef SQLITE_OMIT_DISKIO
"OMIT_DISKIO",
#endif
#ifdef SQLITE_OMIT_EXPLAIN
"OMIT_EXPLAIN",
#endif
#ifdef SQLITE_OMIT_FLAG_PRAGMAS
"OMIT_FLAG_PRAGMAS",
#endif
#ifdef SQLITE_OMIT_FLOATING_POINT
"OMIT_FLOATING_POINT",
#endif
#ifdef SQLITE_OMIT_FOREIGN_KEY
"OMIT_FOREIGN_KEY",
#endif
#ifdef SQLITE_OMIT_GET_TABLE
"OMIT_GET_TABLE",
#endif
#ifdef SQLITE_OMIT_GLOBALRECOVER
"OMIT_GLOBALRECOVER",
#endif
#ifdef SQLITE_OMIT_INCRBLOB
"OMIT_INCRBLOB",
#endif
#ifdef SQLITE_OMIT_INTEGRITY_CHECK
"OMIT_INTEGRITY_CHECK",
#endif
#ifdef SQLITE_OMIT_LIKE_OPTIMIZATION
"OMIT_LIKE_OPTIMIZATION",
#endif
#ifdef SQLITE_OMIT_LOAD_EXTENSION
"OMIT_LOAD_EXTENSION",
#endif
#ifdef SQLITE_OMIT_LOCALTIME
"OMIT_LOCALTIME",
#endif
#ifdef SQLITE_OMIT_LOOKASIDE
"OMIT_LOOKASIDE",
#endif
#ifdef SQLITE_OMIT_MEMORYDB
"OMIT_MEMORYDB",
#endif
#ifdef SQLITE_OMIT_OR_OPTIMIZATION
"OMIT_OR_OPTIMIZATION",
#endif
#ifdef SQLITE_OMIT_PAGER_PRAGMAS
"OMIT_PAGER_PRAGMAS",
#endif
#ifdef SQLITE_OMIT_PRAGMA
"OMIT_PRAGMA",
#endif
#ifdef SQLITE_OMIT_PROGRESS_CALLBACK
"OMIT_PROGRESS_CALLBACK",
#endif
#ifdef SQLITE_OMIT_QUICKBALANCE
"OMIT_QUICKBALANCE",
#endif
#ifdef SQLITE_OMIT_REINDEX
"OMIT_REINDEX",
#endif
#ifdef SQLITE_OMIT_SCHEMA_PRAGMAS
"OMIT_SCHEMA_PRAGMAS",
#endif
#ifdef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS
"OMIT_SCHEMA_VERSION_PRAGMAS",
#endif
#ifdef SQLITE_OMIT_SHARED_CACHE
"OMIT_SHARED_CACHE",
#endif
#ifdef SQLITE_OMIT_SUBQUERY
"OMIT_SUBQUERY",
#endif
#ifdef SQLITE_OMIT_TCL_VARIABLE
"OMIT_TCL_VARIABLE",
#endif
#ifdef SQLITE_OMIT_TEMPDB
"OMIT_TEMPDB",
#endif
#ifdef SQLITE_OMIT_TRACE
"OMIT_TRACE",
#endif
#ifdef SQLITE_OMIT_TRIGGER
"OMIT_TRIGGER",
#endif
#ifdef SQLITE_OMIT_TRUNCATE_OPTIMIZATION
"OMIT_TRUNCATE_OPTIMIZATION",
#endif
#ifdef SQLITE_OMIT_UTF16
"OMIT_UTF16",
#endif
#ifdef SQLITE_OMIT_VACUUM
"OMIT_VACUUM",
#endif
#ifdef SQLITE_OMIT_VIEW
"OMIT_VIEW",
#endif
#ifdef SQLITE_OMIT_VIRTUALTABLE
"OMIT_VIRTUALTABLE",
#endif
#ifdef SQLITE_OMIT_WSD
"OMIT_WSD",
#endif
#ifdef SQLITE_OMIT_XFER_OPT
"OMIT_XFER_OPT",
#endif
#ifdef SQLITE_PERFORMANCE_TRACE
"PERFORMANCE_TRACE",
#endif
#ifdef SQLITE_PROXY_DEBUG
"PROXY_DEBUG",
#endif
#ifdef SQLITE_SECURE_DELETE
"SECURE_DELETE",
#endif
#ifdef SQLITE_SMALL_STACK
"SMALL_STACK",
#endif
#ifdef SQLITE_SOUNDEX
"SOUNDEX",
#endif
#ifdef SQLITE_TCL
"TCL",
#endif
#ifdef SQLITE_TEMP_STORE
"TEMP_STORE=" CTIMEOPT_VAL(SQLITE_TEMP_STORE),
#endif
#ifdef SQLITE_TEST
"TEST",
#endif
#ifdef SQLITE_THREADSAFE
"THREADSAFE=" CTIMEOPT_VAL(SQLITE_THREADSAFE),
#endif
#ifdef SQLITE_USE_ALLOCA
"USE_ALLOCA",
#endif
#ifdef SQLITE_ZERO_MALLOC
"ZERO_MALLOC"
#endif
};
/*
** Given the name of a compile-time option, return true if that option
** was used and false if not.
**
** The name can optionally begin with "SQLITE_" but the "SQLITE_" prefix
** is not required for a match.
*/
SQLITE_API int sqlite3_compileoption_used(const char *zOptName){
int i, n;
if( sqlite3StrNICmp(zOptName, "SQLITE_", 7)==0 ) zOptName += 7;
n = sqlite3Strlen30(zOptName);
/* Since ArraySize(azCompileOpt) is normally in single digits, a
** linear search is adequate. No need for a binary search. */
for(i=0; i<ArraySize(azCompileOpt); i++){
if( (sqlite3StrNICmp(zOptName, azCompileOpt[i], n)==0)
&& ( (azCompileOpt[i][n]==0) || (azCompileOpt[i][n]=='=') ) ) return 1;
}
return 0;
}
/*
** Return the N-th compile-time option string. If N is out of range,
** return a NULL pointer.
*/
SQLITE_API const char *sqlite3_compileoption_get(int N){
if( N>=0 && N<ArraySize(azCompileOpt) ){
return azCompileOpt[N];
}
return 0;
}
#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
/************** End of ctime.c ***********************************************/
/************** Begin file status.c ******************************************/
/*
** 2008 June 18
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
**
|
| ︙ | ︙ | |||
12994 12995 12996 12997 12998 12999 13000 |
/*
** Free memory.
*/
static void sqlite3MemFree(void *pPrior){
struct MemBlockHdr *pHdr;
void **pBt;
char *z;
| | > | 13381 13382 13383 13384 13385 13386 13387 13388 13389 13390 13391 13392 13393 13394 13395 13396 |
/*
** Free memory.
*/
static void sqlite3MemFree(void *pPrior){
struct MemBlockHdr *pHdr;
void **pBt;
char *z;
assert( sqlite3GlobalConfig.bMemstat || sqlite3GlobalConfig.bCoreMutex==0
|| mem.mutex!=0 );
pHdr = sqlite3MemsysGetHeader(pPrior);
pBt = (void**)pHdr;
pBt -= pHdr->nBacktraceSlots;
sqlite3_mutex_enter(mem.mutex);
if( pHdr->pPrev ){
assert( pHdr->pPrev->pNext==pHdr );
pHdr->pPrev->pNext = pHdr->pNext;
|
| ︙ | ︙ | |||
15621 15622 15623 15624 15625 15626 15627 15628 15629 15630 15631 15632 15633 15634 15635 |
#ifdef SQLITE_DEBUG
if( p->trace ){
printf("enter mutex %p (%d) with nRef=%d\n", p, p->trace, p->nRef);
}
#endif
}
static int winMutexTry(sqlite3_mutex *p){
DWORD tid = GetCurrentThreadId();
int rc = SQLITE_BUSY;
assert( p->id==SQLITE_MUTEX_RECURSIVE || winMutexNotheld2(p, tid) );
/*
** The sqlite3_mutex_try() routine is very rarely used, and when it
** is used it is merely an optimization. So it is OK for it to always
** fail.
**
| > > | 16009 16010 16011 16012 16013 16014 16015 16016 16017 16018 16019 16020 16021 16022 16023 16024 16025 |
#ifdef SQLITE_DEBUG
if( p->trace ){
printf("enter mutex %p (%d) with nRef=%d\n", p, p->trace, p->nRef);
}
#endif
}
static int winMutexTry(sqlite3_mutex *p){
#ifndef NDEBUG
DWORD tid = GetCurrentThreadId();
#endif
int rc = SQLITE_BUSY;
assert( p->id==SQLITE_MUTEX_RECURSIVE || winMutexNotheld2(p, tid) );
/*
** The sqlite3_mutex_try() routine is very rarely used, and when it
** is used it is merely an optimization. So it is OK for it to always
** fail.
**
|
| ︙ | ︙ | |||
15659 15660 15661 15662 15663 15664 15665 |
/*
** The sqlite3_mutex_leave() routine exits a mutex that was
** previously entered by the same thread. The behavior
** is undefined if the mutex is not currently entered or
** is not currently allocated. SQLite will never do either.
*/
static void winMutexLeave(sqlite3_mutex *p){
| > | > | 16049 16050 16051 16052 16053 16054 16055 16056 16057 16058 16059 16060 16061 16062 16063 16064 16065 |
/*
** The sqlite3_mutex_leave() routine exits a mutex that was
** previously entered by the same thread. The behavior
** is undefined if the mutex is not currently entered or
** is not currently allocated. SQLite will never do either.
*/
static void winMutexLeave(sqlite3_mutex *p){
#ifndef NDEBUG
DWORD tid = GetCurrentThreadId();
#endif
assert( p->nRef>0 );
assert( p->owner==tid );
p->nRef--;
assert( p->nRef==0 || p->id==SQLITE_MUTEX_RECURSIVE );
LeaveCriticalSection(&p->mutex);
#ifdef SQLITE_DEBUG
if( p->trace ){
|
| ︙ | ︙ | |||
18420 18421 18422 18423 18424 18425 18426 | /* ** Convert a UTF-16 string in the native encoding into a UTF-8 string. ** Memory to hold the UTF-8 string is obtained from sqlite3_malloc and must ** be freed by the calling function. ** ** NULL is returned if there is an allocation error. */ | | | | > > | 18812 18813 18814 18815 18816 18817 18818 18819 18820 18821 18822 18823 18824 18825 18826 18827 18828 18829 18830 18831 18832 18833 18834 18835 18836 18837 18838 18839 18840 |
/*
** Convert a UTF-16 string in the native encoding into a UTF-8 string.
** Memory to hold the UTF-8 string is obtained from sqlite3_malloc and must
** be freed by the calling function.
**
** NULL is returned if there is an allocation error.
*/
SQLITE_PRIVATE char *sqlite3Utf16to8(sqlite3 *db, const void *z, int nByte, u8 enc){
Mem m;
memset(&m, 0, sizeof(m));
m.db = db;
sqlite3VdbeMemSetStr(&m, z, nByte, enc, SQLITE_STATIC);
sqlite3VdbeChangeEncoding(&m, SQLITE_UTF8);
if( db->mallocFailed ){
sqlite3VdbeMemRelease(&m);
m.z = 0;
}
assert( (m.flags & MEM_Term)!=0 || db->mallocFailed );
assert( (m.flags & MEM_Str)!=0 || db->mallocFailed );
assert( (m.flags & MEM_Dyn)!=0 || db->mallocFailed );
assert( m.z || db->mallocFailed );
return m.z;
}
/*
** Convert a UTF-8 string to the UTF-16 encoding specified by parameter
** enc. A pointer to the new string is returned, and the value of *pnOut
** is set to the length of the returned string in bytes. The call should
** arrange to call sqlite3DbFree() on the returned pointer when it is
|
| ︙ | ︙ | |||
19234 19235 19236 19237 19238 19239 19240 |
a |= b;
*v = a;
return 2;
}
/* Verify that constants are precomputed correctly */
assert( SLOT_2_0 == ((0x7f<<14) | (0x7f)) );
| | | 19628 19629 19630 19631 19632 19633 19634 19635 19636 19637 19638 19639 19640 19641 19642 |
a |= b;
*v = a;
return 2;
}
/* Verify that constants are precomputed correctly */
assert( SLOT_2_0 == ((0x7f<<14) | (0x7f)) );
assert( SLOT_4_2_0 == ((0xfU<<28) | (0x7f<<14) | (0x7f)) );
p++;
a = a<<14;
a |= *p;
/* a: p0<<14 | p2 (unmasked) */
if (!(a&0x80))
{
|
| ︙ | ︙ | |||
25759 25760 25761 25762 25763 25764 25765 |
flags &= ~(SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE);
openFlags &= ~(O_RDWR|O_CREAT);
flags |= SQLITE_OPEN_READONLY;
openFlags |= O_RDONLY;
fd = open(zName, openFlags, openMode);
}
if( fd<0 ){
| > > | | 26153 26154 26155 26156 26157 26158 26159 26160 26161 26162 26163 26164 26165 26166 26167 26168 26169 |
flags &= ~(SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE);
openFlags &= ~(O_RDWR|O_CREAT);
flags |= SQLITE_OPEN_READONLY;
openFlags |= O_RDONLY;
fd = open(zName, openFlags, openMode);
}
if( fd<0 ){
sqlite3_log(SQLITE_CANTOPEN, "cannot open file [%s]: %s", zName,
strerror(errno));
rc = SQLITE_CANTOPEN;
goto open_finished;
}
}
assert( fd>=0 );
if( pOutFlags ){
*pOutFlags = flags;
}
|
| ︙ | ︙ | |||
33813 33814 33815 33816 33817 33818 33819 33820 33821 33822 33823 33824 33825 33826 |
pPager->changeCountDone = pPager->tempFile;
if( rc==SQLITE_OK ){
zMaster = pPager->pTmpSpace;
rc = readMasterJournal(pPager->jfd, zMaster, pPager->pVfs->mxPathname+1);
testcase( rc!=SQLITE_OK );
}
if( rc==SQLITE_OK ){
rc = pager_end_transaction(pPager, zMaster[0]!='\0');
testcase( rc!=SQLITE_OK );
}
if( rc==SQLITE_OK && zMaster[0] && res ){
/* If there was a master journal and this routine will return success,
** see if it is possible to delete the master journal.
| > > > | 34209 34210 34211 34212 34213 34214 34215 34216 34217 34218 34219 34220 34221 34222 34223 34224 34225 |
pPager->changeCountDone = pPager->tempFile;
if( rc==SQLITE_OK ){
zMaster = pPager->pTmpSpace;
rc = readMasterJournal(pPager->jfd, zMaster, pPager->pVfs->mxPathname+1);
testcase( rc!=SQLITE_OK );
}
if( rc==SQLITE_OK && pPager->noSync==0 && pPager->state>=PAGER_EXCLUSIVE ){
rc = sqlite3OsSync(pPager->fd, pPager->sync_flags);
}
if( rc==SQLITE_OK ){
rc = pager_end_transaction(pPager, zMaster[0]!='\0');
testcase( rc!=SQLITE_OK );
}
if( rc==SQLITE_OK && zMaster[0] && res ){
/* If there was a master journal and this routine will return success,
** see if it is possible to delete the master journal.
|
| ︙ | ︙ | |||
35133 35134 35135 35136 35137 35138 35139 35140 35141 35142 35143 35144 35145 35146 |
}else if( memDb ){
pPager->journalMode = PAGER_JOURNALMODE_MEMORY;
}
/* pPager->xBusyHandler = 0; */
/* pPager->pBusyHandlerArg = 0; */
pPager->xReiniter = xReinit;
/* memset(pPager->aHash, 0, sizeof(pPager->aHash)); */
*ppPager = pPager;
return SQLITE_OK;
}
/*
| > | 35532 35533 35534 35535 35536 35537 35538 35539 35540 35541 35542 35543 35544 35545 35546 |
}else if( memDb ){
pPager->journalMode = PAGER_JOURNALMODE_MEMORY;
}
/* pPager->xBusyHandler = 0; */
/* pPager->pBusyHandlerArg = 0; */
pPager->xReiniter = xReinit;
/* memset(pPager->aHash, 0, sizeof(pPager->aHash)); */
*ppPager = pPager;
return SQLITE_OK;
}
/*
|
| ︙ | ︙ | |||
35282 35283 35284 35285 35286 35287 35288 |
}
iOffset = (pgno-1)*(i64)pPager->pageSize;
rc = sqlite3OsRead(pPager->fd, pPg->pData, pPager->pageSize, iOffset);
if( rc==SQLITE_IOERR_SHORT_READ ){
rc = SQLITE_OK;
}
if( pgno==1 ){
| > > > > > > > > > > > > > > > | | > | 35682 35683 35684 35685 35686 35687 35688 35689 35690 35691 35692 35693 35694 35695 35696 35697 35698 35699 35700 35701 35702 35703 35704 35705 35706 35707 35708 35709 35710 35711 35712 35713 |
}
iOffset = (pgno-1)*(i64)pPager->pageSize;
rc = sqlite3OsRead(pPager->fd, pPg->pData, pPager->pageSize, iOffset);
if( rc==SQLITE_IOERR_SHORT_READ ){
rc = SQLITE_OK;
}
if( pgno==1 ){
if( rc ){
/* If the read is unsuccessful, set the dbFileVers[] to something
** that will never be a valid file version. dbFileVers[] is a copy
** of bytes 24..39 of the database. Bytes 28..31 should always be
** zero. Bytes 32..35 and 35..39 should be page numbers which are
** never 0xffffffff. So filling pPager->dbFileVers[] with all 0xff
** bytes should suffice.
**
** For an encrypted database, the situation is more complex: bytes
** 24..39 of the database are white noise. But the probability of
** white noising equaling 16 bytes of 0xff is vanishingly small so
** we should still be ok.
*/
memset(pPager->dbFileVers, 0xff, sizeof(pPager->dbFileVers));
}else{
u8 *dbFileVers = &((u8*)pPg->pData)[24];
memcpy(&pPager->dbFileVers, dbFileVers, sizeof(pPager->dbFileVers));
}
}
CODEC1(pPager, pPg->pData, pgno, 3, rc = SQLITE_NOMEM);
PAGER_INCR(sqlite3_pager_readdb_count);
PAGER_INCR(pPager->nRead);
IOTRACE(("PGIN %p %d\n", pPager, pgno));
PAGERTRACE(("FETCH %d page %d hash(%08x)\n",
|
| ︙ | ︙ | |||
36784 36785 36786 36787 36788 36789 36790 36791 36792 36793 36794 36795 36796 36797 |
/* If this is a release of the outermost savepoint, truncate
** the sub-journal to zero bytes in size. */
if( op==SAVEPOINT_RELEASE ){
if( nNew==0 && isOpen(pPager->sjfd) ){
/* Only truncate if it is an in-memory sub-journal. */
if( sqlite3IsMemJournal(pPager->sjfd) ){
rc = sqlite3OsTruncate(pPager->sjfd, 0);
}
pPager->nSubRec = 0;
}
}
/* Else this is a rollback operation, playback the specified savepoint.
** If this is a temp-file, it is possible that the journal file has
** not yet been opened. In this case there have been no changes to
| > | 37200 37201 37202 37203 37204 37205 37206 37207 37208 37209 37210 37211 37212 37213 37214 |
/* If this is a release of the outermost savepoint, truncate
** the sub-journal to zero bytes in size. */
if( op==SAVEPOINT_RELEASE ){
if( nNew==0 && isOpen(pPager->sjfd) ){
/* Only truncate if it is an in-memory sub-journal. */
if( sqlite3IsMemJournal(pPager->sjfd) ){
rc = sqlite3OsTruncate(pPager->sjfd, 0);
assert( rc==SQLITE_OK );
}
pPager->nSubRec = 0;
}
}
/* Else this is a rollback operation, playback the specified savepoint.
** If this is a temp-file, it is possible that the journal file has
** not yet been opened. In this case there have been no changes to
|
| ︙ | ︙ | |||
43197 43198 43199 43200 43201 43202 43203 |
return SQLITE_CORRUPT_BKPT;
}
if( nOvfl ){
rc = getOverflowPage(pBt, ovflPgno, &pOvfl, &iNext);
if( rc ) return rc;
}
| | | 43614 43615 43616 43617 43618 43619 43620 43621 43622 43623 43624 43625 43626 43627 43628 |
return SQLITE_CORRUPT_BKPT;
}
if( nOvfl ){
rc = getOverflowPage(pBt, ovflPgno, &pOvfl, &iNext);
if( rc ) return rc;
}
if( ( pOvfl || ((pOvfl = btreePageLookup(pBt, ovflPgno))!=0) )
&& sqlite3PagerPageRefcount(pOvfl->pDbPage)!=1
){
/* There is no reason any cursor should have an outstanding reference
** to an overflow page belonging to a cell that is being deleted/updated.
** So if there exists more than one reference to this page, then it
** must not really be an overflow page and the database must be corrupt.
** It is helpful to detect this before calling freePage2(), as
|
| ︙ | ︙ | |||
43950 43951 43952 43953 43954 43955 43956 |
**
** Unless SQLite is compiled in secure-delete mode. In this case,
** the dropCell() routine will overwrite the entire cell with zeroes.
** In this case, temporarily copy the cell into the aOvflSpace[]
** buffer. It will be copied out again as soon as the aSpace[] buffer
** is allocated. */
if( pBt->secureDelete ){
| | | 44367 44368 44369 44370 44371 44372 44373 44374 44375 44376 44377 44378 44379 44380 44381 |
**
** Unless SQLite is compiled in secure-delete mode. In this case,
** the dropCell() routine will overwrite the entire cell with zeroes.
** In this case, temporarily copy the cell into the aOvflSpace[]
** buffer. It will be copied out again as soon as the aSpace[] buffer
** is allocated. */
if( pBt->secureDelete ){
int iOff = SQLITE_PTR_TO_INT(apDiv[i]) - SQLITE_PTR_TO_INT(pParent->aData);
if( (iOff+szNew[i])>pBt->usableSize ){
rc = SQLITE_CORRUPT_BKPT;
memset(apOld, 0, (i+1)*sizeof(MemPage*));
goto balance_cleanup;
}else{
memcpy(&aOvflSpace[iOff], apDiv[i], szNew[i]);
apDiv[i] = &aOvflSpace[apDiv[i]-pParent->aData];
|
| ︙ | ︙ | |||
47319 47320 47321 47322 47323 47324 47325 |
** and flags gets srcType (either MEM_Ephem or MEM_Static).
*/
SQLITE_PRIVATE void sqlite3VdbeMemShallowCopy(Mem *pTo, const Mem *pFrom, int srcType){
assert( (pFrom->flags & MEM_RowSet)==0 );
sqlite3VdbeMemReleaseExternal(pTo);
memcpy(pTo, pFrom, MEMCELLSIZE);
pTo->xDel = 0;
| | | 47736 47737 47738 47739 47740 47741 47742 47743 47744 47745 47746 47747 47748 47749 47750 |
** and flags gets srcType (either MEM_Ephem or MEM_Static).
*/
SQLITE_PRIVATE void sqlite3VdbeMemShallowCopy(Mem *pTo, const Mem *pFrom, int srcType){
assert( (pFrom->flags & MEM_RowSet)==0 );
sqlite3VdbeMemReleaseExternal(pTo);
memcpy(pTo, pFrom, MEMCELLSIZE);
pTo->xDel = 0;
if( (pFrom->flags&MEM_Static)==0 ){
pTo->flags &= ~(MEM_Dyn|MEM_Static|MEM_Ephem);
assert( srcType==MEM_Ephem || srcType==MEM_Static );
pTo->flags |= srcType;
}
}
/*
|
| ︙ | ︙ | |||
49951 49952 49953 49954 49955 49956 49957 |
db->autoCommit = 1;
}
}
/* If eStatementOp is non-zero, then a statement transaction needs to
** be committed or rolled back. Call sqlite3VdbeCloseStatement() to
** do so. If this operation returns an error, and the current statement
| | > > > > > | | | 50368 50369 50370 50371 50372 50373 50374 50375 50376 50377 50378 50379 50380 50381 50382 50383 50384 50385 50386 50387 50388 50389 50390 50391 50392 |
db->autoCommit = 1;
}
}
/* If eStatementOp is non-zero, then a statement transaction needs to
** be committed or rolled back. Call sqlite3VdbeCloseStatement() to
** do so. If this operation returns an error, and the current statement
** error code is SQLITE_OK or SQLITE_CONSTRAINT, then promote the
** current statement error code.
**
** Note that sqlite3VdbeCloseStatement() can only fail if eStatementOp
** is SAVEPOINT_ROLLBACK. But if p->rc==SQLITE_OK then eStatementOp
** must be SAVEPOINT_RELEASE. Hence the NEVER(p->rc==SQLITE_OK) in
** the following code.
*/
if( eStatementOp ){
rc = sqlite3VdbeCloseStatement(p, eStatementOp);
if( rc && (NEVER(p->rc==SQLITE_OK) || p->rc==SQLITE_CONSTRAINT) ){
p->rc = rc;
sqlite3DbFree(db, p->zErrMsg);
p->zErrMsg = 0;
}
}
/* If this was an INSERT, UPDATE or DELETE and no statement transaction
|
| ︙ | ︙ | |||
52575 52576 52577 52578 52579 52580 52581 52582 |
** do so without loss of information. In other words, if the string
** looks like a number, convert it into a number. If it does not
** look like a number, leave it alone.
*/
static void applyNumericAffinity(Mem *pRec){
if( (pRec->flags & (MEM_Real|MEM_Int))==0 ){
int realnum;
sqlite3VdbeMemNulTerminate(pRec);
| > | < > > | > > > > > | | > > > > > > | 52997 52998 52999 53000 53001 53002 53003 53004 53005 53006 53007 53008 53009 53010 53011 53012 53013 53014 53015 53016 53017 53018 53019 53020 53021 53022 53023 53024 53025 53026 53027 53028 53029 53030 53031 53032 53033 53034 |
** do so without loss of information. In other words, if the string
** looks like a number, convert it into a number. If it does not
** look like a number, leave it alone.
*/
static void applyNumericAffinity(Mem *pRec){
if( (pRec->flags & (MEM_Real|MEM_Int))==0 ){
int realnum;
u8 enc = pRec->enc;
sqlite3VdbeMemNulTerminate(pRec);
if( (pRec->flags&MEM_Str) && sqlite3IsNumber(pRec->z, &realnum, enc) ){
i64 value;
char *zUtf8 = pRec->z;
#ifndef SQLITE_OMIT_UTF16
if( enc!=SQLITE_UTF8 ){
assert( pRec->db );
zUtf8 = sqlite3Utf16to8(pRec->db, pRec->z, pRec->n, enc);
if( !zUtf8 ) return;
}
#endif
if( !realnum && sqlite3Atoi64(zUtf8, &value) ){
pRec->u.i = value;
MemSetTypeFlag(pRec, MEM_Int);
}else{
sqlite3AtoF(zUtf8, &pRec->r);
MemSetTypeFlag(pRec, MEM_Real);
}
#ifndef SQLITE_OMIT_UTF16
if( enc!=SQLITE_UTF8 ){
sqlite3DbFree(pRec->db, zUtf8);
}
#endif
}
}
}
/*
** Processing is determine by the affinity parameter:
**
|
| ︙ | ︙ | |||
53037 53038 53039 53040 53041 53042 53043 53044 53045 53046 53047 53048 53049 53050 |
struct OP_ShiftRight_stack_vars {
i64 a;
i64 b;
} ah;
struct OP_Ge_stack_vars {
int res; /* Result of the comparison of pIn1 against pIn3 */
char affinity; /* Affinity to use for comparison */
} ai;
struct OP_Compare_stack_vars {
int n;
int i;
int p1;
int p2;
const KeyInfo *pKeyInfo;
| > > | 53472 53473 53474 53475 53476 53477 53478 53479 53480 53481 53482 53483 53484 53485 53486 53487 |
struct OP_ShiftRight_stack_vars {
i64 a;
i64 b;
} ah;
struct OP_Ge_stack_vars {
int res; /* Result of the comparison of pIn1 against pIn3 */
char affinity; /* Affinity to use for comparison */
u16 flags1; /* Copy of initial value of pIn1->flags */
u16 flags3; /* Copy of initial value of pIn3->flags */
} ai;
struct OP_Compare_stack_vars {
int n;
int i;
int p1;
int p2;
const KeyInfo *pKeyInfo;
|
| ︙ | ︙ | |||
54571 54572 54573 54574 54575 54576 54577 54578 54579 54580 54581 54582 54583 54584 54585 54586 54587 54588 |
case OP_Lt: /* same as TK_LT, jump, in1, in3 */
case OP_Le: /* same as TK_LE, jump, in1, in3 */
case OP_Gt: /* same as TK_GT, jump, in1, in3 */
case OP_Ge: { /* same as TK_GE, jump, in1, in3 */
#if 0 /* local variables moved into u.ai */
int res; /* Result of the comparison of pIn1 against pIn3 */
char affinity; /* Affinity to use for comparison */
#endif /* local variables moved into u.ai */
pIn1 = &aMem[pOp->p1];
pIn3 = &aMem[pOp->p3];
if( (pIn1->flags | pIn3->flags)&MEM_Null ){
/* One or both operands are NULL */
if( pOp->p5 & SQLITE_NULLEQ ){
/* If SQLITE_NULLEQ is set (which will only happen if the operator is
** OP_Eq or OP_Ne) then take the jump or not depending on whether
** or not both operands are null.
*/
| > > > > | 55008 55009 55010 55011 55012 55013 55014 55015 55016 55017 55018 55019 55020 55021 55022 55023 55024 55025 55026 55027 55028 55029 |
case OP_Lt: /* same as TK_LT, jump, in1, in3 */
case OP_Le: /* same as TK_LE, jump, in1, in3 */
case OP_Gt: /* same as TK_GT, jump, in1, in3 */
case OP_Ge: { /* same as TK_GE, jump, in1, in3 */
#if 0 /* local variables moved into u.ai */
int res; /* Result of the comparison of pIn1 against pIn3 */
char affinity; /* Affinity to use for comparison */
u16 flags1; /* Copy of initial value of pIn1->flags */
u16 flags3; /* Copy of initial value of pIn3->flags */
#endif /* local variables moved into u.ai */
pIn1 = &aMem[pOp->p1];
pIn3 = &aMem[pOp->p3];
u.ai.flags1 = pIn1->flags;
u.ai.flags3 = pIn3->flags;
if( (pIn1->flags | pIn3->flags)&MEM_Null ){
/* One or both operands are NULL */
if( pOp->p5 & SQLITE_NULLEQ ){
/* If SQLITE_NULLEQ is set (which will only happen if the operator is
** OP_Eq or OP_Ne) then take the jump or not depending on whether
** or not both operands are null.
*/
|
| ︙ | ︙ | |||
54629 54630 54631 54632 54633 54634 54635 54636 54637 54638 54639 54640 54641 54642 |
pOut = &aMem[pOp->p2];
MemSetTypeFlag(pOut, MEM_Int);
pOut->u.i = u.ai.res;
REGISTER_TRACE(pOp->p2, pOut);
}else if( u.ai.res ){
pc = pOp->p2-1;
}
break;
}
/* Opcode: Permutation * * * P4 *
**
** Set the permutation used by the OP_Compare operator to be the array
** of integers in P4.
| > > > > | 55070 55071 55072 55073 55074 55075 55076 55077 55078 55079 55080 55081 55082 55083 55084 55085 55086 55087 |
pOut = &aMem[pOp->p2];
MemSetTypeFlag(pOut, MEM_Int);
pOut->u.i = u.ai.res;
REGISTER_TRACE(pOp->p2, pOut);
}else if( u.ai.res ){
pc = pOp->p2-1;
}
/* Undo any changes made by applyAffinity() to the input registers. */
pIn1->flags = (pIn1->flags&~MEM_TypeMask) | (u.ai.flags1&MEM_TypeMask);
pIn3->flags = (pIn3->flags&~MEM_TypeMask) | (u.ai.flags3&MEM_TypeMask);
break;
}
/* Opcode: Permutation * * * P4 *
**
** Set the permutation used by the OP_Compare operator to be the array
** of integers in P4.
|
| ︙ | ︙ | |||
61174 61175 61176 61177 61178 61179 61180 |
CollSeq *p4;
p4 = sqlite3BinaryCompareCollSeq(pParse, pLeft, pRight);
p5 = binaryCompareP5(pLeft, pRight, jumpIfNull);
addr = sqlite3VdbeAddOp4(pParse->pVdbe, opcode, in2, dest, in1,
(void*)p4, P4_COLLSEQ);
sqlite3VdbeChangeP5(pParse->pVdbe, (u8)p5);
| < < < < | 61619 61620 61621 61622 61623 61624 61625 61626 61627 61628 61629 61630 61631 61632 |
CollSeq *p4;
p4 = sqlite3BinaryCompareCollSeq(pParse, pLeft, pRight);
p5 = binaryCompareP5(pLeft, pRight, jumpIfNull);
addr = sqlite3VdbeAddOp4(pParse->pVdbe, opcode, in2, dest, in1,
(void*)p4, P4_COLLSEQ);
sqlite3VdbeChangeP5(pParse->pVdbe, (u8)p5);
return addr;
}
#if SQLITE_MAX_EXPR_DEPTH>0
/*
** Check that argument nHeight is less than or equal to the maximum
** expression depth allowed. If it is not, leave an error message in
|
| ︙ | ︙ | |||
71074 71075 71076 71077 71078 71079 71080 |
sqlite3HashInit(&p->fkeyHash);
p->enc = SQLITE_UTF8;
}
return p;
}
/************** End of callback.c ********************************************/
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 71515 71516 71517 71518 71519 71520 71521 71522 71523 71524 71525 71526 71527 71528 |
sqlite3HashInit(&p->fkeyHash);
p->enc = SQLITE_UTF8;
}
return p;
}
/************** End of callback.c ********************************************/
/************** Begin file delete.c ******************************************/
/*
** 2001 September 15
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
**
|
| ︙ | ︙ | |||
80132 80133 80134 80135 80136 80137 80138 |
assert( ppStmt );
*ppStmt = 0;
if( !sqlite3SafetyCheckOk(db) ){
return SQLITE_MISUSE_BKPT;
}
sqlite3_mutex_enter(db->mutex);
| | | 80186 80187 80188 80189 80190 80191 80192 80193 80194 80195 80196 80197 80198 80199 80200 |
assert( ppStmt );
*ppStmt = 0;
if( !sqlite3SafetyCheckOk(db) ){
return SQLITE_MISUSE_BKPT;
}
sqlite3_mutex_enter(db->mutex);
zSql8 = sqlite3Utf16to8(db, zSql, nBytes, SQLITE_UTF16NATIVE);
if( zSql8 ){
rc = sqlite3LockAndPrepare(db, zSql8, -1, saveSqlFlag, 0, ppStmt, &zTail8);
}
if( zTail8 && pzTail ){
/* If sqlite3_prepare returns a tail pointer, we calculate the
** equivalent pointer into the UTF-16 string by counting the unicode
|
| ︙ | ︙ | |||
97457 97458 97459 97460 97461 97462 97463 |
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
void (*xFinal)(sqlite3_context*)
){
int rc;
char *zFunc8;
sqlite3_mutex_enter(db->mutex);
assert( !db->mallocFailed );
| | | 97511 97512 97513 97514 97515 97516 97517 97518 97519 97520 97521 97522 97523 97524 97525 |
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
void (*xFinal)(sqlite3_context*)
){
int rc;
char *zFunc8;
sqlite3_mutex_enter(db->mutex);
assert( !db->mallocFailed );
zFunc8 = sqlite3Utf16to8(db, zFunctionName, -1, SQLITE_UTF16NATIVE);
rc = sqlite3CreateFunc(db, zFunc8, nArg, eTextRep, p, xFunc, xStep, xFinal);
sqlite3DbFree(db, zFunc8);
rc = sqlite3ApiExit(db, rc);
sqlite3_mutex_leave(db->mutex);
return rc;
}
#endif
|
| ︙ | ︙ | |||
98280 98281 98282 98283 98284 98285 98286 |
void* pCtx,
int(*xCompare)(void*,int,const void*,int,const void*)
){
int rc = SQLITE_OK;
char *zName8;
sqlite3_mutex_enter(db->mutex);
assert( !db->mallocFailed );
| | | 98334 98335 98336 98337 98338 98339 98340 98341 98342 98343 98344 98345 98346 98347 98348 |
void* pCtx,
int(*xCompare)(void*,int,const void*,int,const void*)
){
int rc = SQLITE_OK;
char *zName8;
sqlite3_mutex_enter(db->mutex);
assert( !db->mallocFailed );
zName8 = sqlite3Utf16to8(db, zName, -1, SQLITE_UTF16NATIVE);
if( zName8 ){
rc = createCollation(db, zName8, (u8)enc, SQLITE_COLL_USER, pCtx, xCompare, 0);
sqlite3DbFree(db, zName8);
}
rc = sqlite3ApiExit(db, rc);
sqlite3_mutex_leave(db->mutex);
return rc;
|
| ︙ | ︙ | |||
100271 100272 100273 100274 100275 100276 100277 100278 100279 100280 100281 100282 100283 100284 100285 100286 100287 100288 100289 100290 100291 |
fts3DbExec(&rc, db,
"CREATE TABLE %Q.'%q_stat'(id INTEGER PRIMARY KEY, value BLOB);",
p->zDb, p->zName
);
}
return rc;
}
/*
** Determine if a table currently exists in the database.
*/
static void fts3TableExists(
int *pRc, /* Success code */
sqlite3 *db, /* The database connection to test */
const char *zDb, /* ATTACHed database within the connection */
const char *zName, /* Name of the FTS3 table */
const char *zSuffix, /* Shadow table extension */
u8 *pResult /* Write results here */
){
int rc = SQLITE_OK;
if( *pRc ) return;
| > > > > > > > > > > > > | > > > | | | 100325 100326 100327 100328 100329 100330 100331 100332 100333 100334 100335 100336 100337 100338 100339 100340 100341 100342 100343 100344 100345 100346 100347 100348 100349 100350 100351 100352 100353 100354 100355 100356 100357 100358 100359 100360 100361 100362 100363 100364 100365 100366 100367 100368 100369 100370 |
fts3DbExec(&rc, db,
"CREATE TABLE %Q.'%q_stat'(id INTEGER PRIMARY KEY, value BLOB);",
p->zDb, p->zName
);
}
return rc;
}
/*
** An sqlite3_exec() callback for fts3TableExists.
*/
static int fts3TableExistsCallback(void *pArg, int n, char **pp1, char **pp2){
*(int*)pArg = 1;
return 1;
}
/*
** Determine if a table currently exists in the database.
*/
static void fts3TableExists(
int *pRc, /* Success code */
sqlite3 *db, /* The database connection to test */
const char *zDb, /* ATTACHed database within the connection */
const char *zName, /* Name of the FTS3 table */
const char *zSuffix, /* Shadow table extension */
u8 *pResult /* Write results here */
){
int rc = SQLITE_OK;
int res = 0;
char *zSql;
if( *pRc ) return;
zSql = sqlite3_mprintf(
"SELECT 1 FROM %Q.sqlite_master WHERE name='%q%s'",
zDb, zName, zSuffix
);
rc = sqlite3_exec(db, zSql, fts3TableExistsCallback, &res, 0);
sqlite3_free(zSql);
*pResult = res & 0xff;
if( rc!=SQLITE_ABORT ) *pRc = rc;
}
/*
** This function is the implementation of both the xConnect and xCreate
** methods of the FTS3 virtual table.
**
** The argv[] array contains the following:
|
| ︙ | ︙ | |||
100709 100710 100711 100712 100713 100714 100715 | assert( iVal-*piPrev > 0 || (*piPrev==0 && iVal==0) ); *pp += sqlite3Fts3PutVarint(*pp, iVal-*piPrev); *piPrev = iVal; } /* ** When this function is called, *ppPoslist is assumed to point to the | | > > > > > | 100778 100779 100780 100781 100782 100783 100784 100785 100786 100787 100788 100789 100790 100791 100792 100793 100794 100795 100796 100797 |
assert( iVal-*piPrev > 0 || (*piPrev==0 && iVal==0) );
*pp += sqlite3Fts3PutVarint(*pp, iVal-*piPrev);
*piPrev = iVal;
}
/*
** When this function is called, *ppPoslist is assumed to point to the
** start of a position-list. After it returns, *ppPoslist points to the
** first byte after the position-list.
**
** If pp is not NULL, then the contents of the position list are copied
** to *pp. *pp is set to point to the first byte past the last byte copied
** before this function returns.
*/
static void fts3PoslistCopy(char **pp, char **ppPoslist){
char *pEnd = *ppPoslist;
char c = 0;
/* The end of a position list is marked by a zero encoded as an FTS3
** varint. A single 0x00 byte. Except, if the 0x00 byte is preceded by
|
| ︙ | ︙ | |||
101700 101701 101702 101703 101704 101705 101706 |
if( zQuery==0 && sqlite3_value_type(apVal[0])!=SQLITE_NULL ){
return SQLITE_NOMEM;
}
rc = sqlite3Fts3ExprParse(p->pTokenizer, p->azColumn, p->nColumn,
iCol, zQuery, -1, &pCsr->pExpr
);
| | > > > > > > | 101774 101775 101776 101777 101778 101779 101780 101781 101782 101783 101784 101785 101786 101787 101788 101789 101790 101791 101792 101793 101794 |
if( zQuery==0 && sqlite3_value_type(apVal[0])!=SQLITE_NULL ){
return SQLITE_NOMEM;
}
rc = sqlite3Fts3ExprParse(p->pTokenizer, p->azColumn, p->nColumn,
iCol, zQuery, -1, &pCsr->pExpr
);
if( rc!=SQLITE_OK ){
if( rc==SQLITE_ERROR ){
p->base.zErrMsg = sqlite3_mprintf("malformed MATCH expression: [%s]",
zQuery);
}
return rc;
}
rc = evalFts3Expr(p, pCsr->pExpr, &pCsr->aDoclist, &pCsr->nDoclist, 0);
pCsr->pNextId = pCsr->aDoclist;
pCsr->iPrevId = 0;
}
if( rc!=SQLITE_OK ) return rc;
|
| ︙ | ︙ | |||
101853 101854 101855 101856 101857 101858 101859 |
char *pEnd = &pExpr->aDoclist[pExpr->nDoclist];
char *pCsr = pExpr->pCurrent;
assert( pCsr );
while( pCsr<pEnd ){
if( pExpr->iCurrent<iDocid ){
fts3PoslistCopy(0, &pCsr);
| > | > | 101933 101934 101935 101936 101937 101938 101939 101940 101941 101942 101943 101944 101945 101946 101947 101948 101949 |
char *pEnd = &pExpr->aDoclist[pExpr->nDoclist];
char *pCsr = pExpr->pCurrent;
assert( pCsr );
while( pCsr<pEnd ){
if( pExpr->iCurrent<iDocid ){
fts3PoslistCopy(0, &pCsr);
if( pCsr<pEnd ){
fts3GetDeltaVarint(&pCsr, &pExpr->iCurrent);
}
pExpr->pCurrent = pCsr;
}else{
if( pExpr->iCurrent==iDocid ){
int iThis = 0;
if( iCol<0 ){
/* If iCol is negative, return a pointer to the start of the
** position-list (instead of a pointer to the start of a list
|
| ︙ | ︙ | |||
105103 105104 105105 105106 105107 105108 105109 | /* 1 */ "SELECT NOT EXISTS(SELECT docid FROM %Q.'%q_content' WHERE rowid!=?)", /* 2 */ "DELETE FROM %Q.'%q_content'", /* 3 */ "DELETE FROM %Q.'%q_segments'", /* 4 */ "DELETE FROM %Q.'%q_segdir'", /* 5 */ "DELETE FROM %Q.'%q_docsize'", /* 6 */ "DELETE FROM %Q.'%q_stat'", /* 7 */ "SELECT * FROM %Q.'%q_content' WHERE rowid=?", | | | | 105185 105186 105187 105188 105189 105190 105191 105192 105193 105194 105195 105196 105197 105198 105199 105200 105201 |
/* 1 */ "SELECT NOT EXISTS(SELECT docid FROM %Q.'%q_content' WHERE rowid!=?)",
/* 2 */ "DELETE FROM %Q.'%q_content'",
/* 3 */ "DELETE FROM %Q.'%q_segments'",
/* 4 */ "DELETE FROM %Q.'%q_segdir'",
/* 5 */ "DELETE FROM %Q.'%q_docsize'",
/* 6 */ "DELETE FROM %Q.'%q_stat'",
/* 7 */ "SELECT * FROM %Q.'%q_content' WHERE rowid=?",
/* 8 */ "SELECT (SELECT max(idx) FROM %Q.'%q_segdir' WHERE level = ?) + 1",
/* 9 */ "INSERT INTO %Q.'%q_segments'(blockid, block) VALUES(?, ?)",
/* 10 */ "SELECT coalesce((SELECT max(blockid) FROM %Q.'%q_segments') + 1, 1)",
/* 11 */ "INSERT INTO %Q.'%q_segdir' VALUES(?,?,?,?,?,?)",
/* Return segments in order from oldest to newest.*/
/* 12 */ "SELECT idx, start_block, leaves_end_block, end_block, root "
"FROM %Q.'%q_segdir' WHERE level = ? ORDER BY idx ASC",
/* 13 */ "SELECT idx, start_block, leaves_end_block, end_block, root "
"FROM %Q.'%q_segdir' ORDER BY level DESC, idx ASC",
|
| ︙ | ︙ | |||
108664 108665 108666 108667 108668 108669 108670 108671 108672 108673 108674 |
}
if( rc==SQLITE_OK ){
char aBuffer[64];
sqlite3_snprintf(sizeof(aBuffer), aBuffer,
"%d %d %d %d ", iCol, pTerm-sCtx.aTerm, iStart, iEnd-iStart
);
rc = fts3StringAppend(&res, aBuffer, -1);
}
}
}
if( rc==SQLITE_DONE ){
| > > | | 108746 108747 108748 108749 108750 108751 108752 108753 108754 108755 108756 108757 108758 108759 108760 108761 108762 108763 108764 108765 108766 |
}
if( rc==SQLITE_OK ){
char aBuffer[64];
sqlite3_snprintf(sizeof(aBuffer), aBuffer,
"%d %d %d %d ", iCol, pTerm-sCtx.aTerm, iStart, iEnd-iStart
);
rc = fts3StringAppend(&res, aBuffer, -1);
}else if( rc==SQLITE_DONE ){
rc = SQLITE_CORRUPT;
}
}
}
if( rc==SQLITE_DONE ){
rc = SQLITE_OK;
}
pMod->xClose(pC);
if( rc!=SQLITE_OK ) goto offsets_out;
}
offsets_out:
|
| ︙ | ︙ |
Changes to src/sqlite3.h.
| ︙ | ︙ | |||
103 104 105 106 107 108 109 | ** string contains the date and time of the check-in (UTC) and an SHA1 ** hash of the entire source tree. ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ | | | | 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | ** string contains the date and time of the check-in (UTC) and an SHA1 ** hash of the entire source tree. ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ #define SQLITE_VERSION "3.6.23.1" #define SQLITE_VERSION_NUMBER 3006023 #define SQLITE_SOURCE_ID "2010-03-26 22:28:06 b078b588d617e07886ad156e9f54ade6d823568e" /* ** CAPI3REF: Run-Time Library Version Numbers ** KEYWORDS: sqlite3_version, sqlite3_sourceid ** ** These interfaces provide the same information as the [SQLITE_VERSION], ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros |
| ︙ | ︙ |
Changes to src/style.c.
| ︙ | ︙ | |||
405 406 407 408 409 410 411 412 413 414 |
void page_test_env(void){
style_header("Environment Test");
#if !defined(__MINGW32__)
@ uid=%d(getuid()), gid=%d(getgid())<br>
#endif
@ g.zBaseURL = %h(g.zBaseURL)<br>
@ g.zTop = %h(g.zTop)<br>
cgi_print_all();
style_footer();
}
| > | 405 406 407 408 409 410 411 412 413 414 415 |
void page_test_env(void){
style_header("Environment Test");
#if !defined(__MINGW32__)
@ uid=%d(getuid()), gid=%d(getgid())<br>
#endif
@ g.zBaseURL = %h(g.zBaseURL)<br>
@ g.zTop = %h(g.zTop)<br>
@ g.zRepositoryName = %h(g.zRepositoryName)<br>
cgi_print_all();
style_footer();
}
|
Changes to src/sync.c.
| ︙ | ︙ | |||
82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
void process_sync_args(void){
const char *zUrl = 0;
const char *zPw = 0;
int urlOptional = find_option("autourl",0,0)!=0;
g.dontKeepUrl = find_option("once",0,0)!=0;
url_proxy_options();
db_find_and_open_repository(1);
if( g.argc==2 ){
zUrl = db_get("last-sync-url", 0);
zPw = db_get("last-sync-pw", 0);
}else if( g.argc==3 ){
zUrl = g.argv[2];
}
if( zUrl==0 ){
| > | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
void process_sync_args(void){
const char *zUrl = 0;
const char *zPw = 0;
int urlOptional = find_option("autourl",0,0)!=0;
g.dontKeepUrl = find_option("once",0,0)!=0;
url_proxy_options();
db_find_and_open_repository(1);
db_open_config(0);
if( g.argc==2 ){
zUrl = db_get("last-sync-url", 0);
zPw = db_get("last-sync-pw", 0);
}else if( g.argc==3 ){
zUrl = g.argv[2];
}
if( zUrl==0 ){
|
| ︙ | ︙ |
Changes to src/timeline.c.
| ︙ | ︙ | |||
254 255 256 257 258 259 260 |
int nParent = 0;
int aParent[32];
const char *zBr;
int gidx;
static Stmt qparent;
static Stmt qbranch;
db_static_prepare(&qparent,
| | | 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 |
int nParent = 0;
int aParent[32];
const char *zBr;
int gidx;
static Stmt qparent;
static Stmt qbranch;
db_static_prepare(&qparent,
"SELECT pid FROM plink WHERE cid=:rid ORDER BY isprim DESC /*sort*/"
);
db_static_prepare(&qbranch,
"SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0 AND rid=:rid",
TAG_BRANCH
);
db_bind_int(&qparent, ":rid", rid);
while( db_step(&qparent)==SQLITE_ROW && nParent<32 ){
|
| ︙ | ︙ | |||
405 406 407 408 409 410 411 |
@ var realCanvas = null;
@ function drawBox(color,x0,y0,x1,y1){
@ var n = document.createElement("div");
@ if( x0>x1 ){ var t=x0; x0=x1; x1=t; }
@ if( y0>y1 ){ var t=y0; y0=y1; y1=t; }
@ var w = x1-x0+1;
@ var h = y1-y0+1;
| < > | 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 |
@ var realCanvas = null;
@ function drawBox(color,x0,y0,x1,y1){
@ var n = document.createElement("div");
@ if( x0>x1 ){ var t=x0; x0=x1; x1=t; }
@ if( y0>y1 ){ var t=y0; y0=y1; y1=t; }
@ var w = x1-x0+1;
@ var h = y1-y0+1;
@ n.style.position = "absolute";
@ n.style.overflow = "hidden";
@ n.style.left = x0+"px";
@ n.style.top = y0+"px";
@ n.style.width = w+"px";
@ n.style.height = h+"px";
@ n.style.backgroundColor = color;
@ canvasDiv.appendChild(n);
@ }
@ function absoluteY(id){
@ var obj = document.getElementById(id);
@ if( !obj ) return;
@ var top = 0;
@ if( obj.offsetParent ){
@ do{
|
| ︙ | ︙ | |||
510 511 512 513 514 515 516 |
@ var left = absoluteX(rowinfo[0].id) - absoluteX("canvas") + 15;
@ var width = nrail*20;
@ for(var i in rowinfo){
@ rowinfo[i].y = absoluteY(rowinfo[i].id) + 10 - canvasY;
@ rowinfo[i].x = left + rowinfo[i].r*20;
@ }
@ var btm = rowinfo[rowinfo.length-1].y + 20;
| > | | | | > > > > | 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 |
@ var left = absoluteX(rowinfo[0].id) - absoluteX("canvas") + 15;
@ var width = nrail*20;
@ for(var i in rowinfo){
@ rowinfo[i].y = absoluteY(rowinfo[i].id) + 10 - canvasY;
@ rowinfo[i].x = left + rowinfo[i].r*20;
@ }
@ var btm = rowinfo[rowinfo.length-1].y + 20;
@ if( btm<32768 ){
@ canvasDiv.innerHTML = '<canvas id="timeline-canvas" '+
@ 'style="position:absolute;left:'+(left-5)+'px;"' +
@ ' width="'+width+'" height="'+btm+'"></canvas>';
@ realCanvas = document.getElementById('timeline-canvas');
@ }else{
@ realCanvas = 0;
@ }
@ var context;
@ if( realCanvas && realCanvas.getContext
@ && (context = realCanvas.getContext('2d'))) {
@ drawBox = function(color,x0,y0,x1,y1) {
@ if( y0>32767 || y1>32767 ) return;
@ var colors = {
@ 'white':'rgba(255,255,255,1)',
@ 'black':'rgba(0,0,0,1)'
@ };
@ if( x0>x1 ){ var t=x0; x0=x1; x1=t; }
@ if( y0>y1 ){ var t=y0; y0=y1; y1=t; }
@ if(isNaN(x0) || isNaN(y0) || isNaN(x1) || isNaN(y1)) return;
|
| ︙ | ︙ | |||
673 674 675 676 677 678 679 |
** If n= is missing, the default count is 20.
*/
void page_timeline(void){
Stmt q; /* Query used to generate the timeline */
Blob sql; /* text of SQL used to generate timeline */
Blob desc; /* Description of the timeline */
int nEntry = atoi(PD("n","20")); /* Max number of entries on timeline */
| | | | 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 |
** If n= is missing, the default count is 20.
*/
void page_timeline(void){
Stmt q; /* Query used to generate the timeline */
Blob sql; /* text of SQL used to generate timeline */
Blob desc; /* Description of the timeline */
int nEntry = atoi(PD("n","20")); /* Max number of entries on timeline */
int p_rid = name_to_rid(P("p")); /* artifact p and its parents */
int d_rid = name_to_rid(P("d")); /* artifact d and its descendants */
const char *zUser = P("u"); /* All entries by this user if not NULL */
const char *zType = PD("y","all"); /* Type of events. All if NULL */
const char *zAfter = P("a"); /* Events after this time */
const char *zBefore = P("b"); /* Events before this time */
const char *zCirca = P("c"); /* Events near this time */
const char *zTagName = P("t"); /* Show events with this tag */
const char *zSearch = P("s"); /* Search string */
|
| ︙ | ︙ | |||
869 870 871 872 873 874 875 |
}
}else{
blob_appendf(&sql, " ORDER BY event.mtime DESC");
}
blob_appendf(&sql, " LIMIT %d", nEntry);
db_multi_exec("%s", blob_str(&sql));
| | | 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 |
}
}else{
blob_appendf(&sql, " ORDER BY event.mtime DESC");
}
blob_appendf(&sql, " LIMIT %d", nEntry);
db_multi_exec("%s", blob_str(&sql));
n = db_int(0, "SELECT count(*) FROM timeline /*scan*/");
if( n<nEntry && zAfter ){
cgi_redirect(url_render(&url, "a", 0, "b", 0));
}
if( zAfter==0 && zBefore==0 && zCirca==0 ){
blob_appendf(&desc, "%d most recent %ss", n, zEType);
}else{
blob_appendf(&desc, "%d %ss", n, zEType);
|
| ︙ | ︙ | |||
898 899 900 901 902 903 904 |
blob_appendf(&desc, " occurring around %h.<br>", zCirca);
}
if( zSearch ){
blob_appendf(&desc, " matching \"%h\"", zSearch);
}
if( g.okHistory ){
if( zAfter || n==nEntry ){
| | | | 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 |
blob_appendf(&desc, " occurring around %h.<br>", zCirca);
}
if( zSearch ){
blob_appendf(&desc, " matching \"%h\"", zSearch);
}
if( g.okHistory ){
if( zAfter || n==nEntry ){
zDate = db_text(0, "SELECT min(timestamp) FROM timeline /*scan*/");
timeline_submenu(&url, "Older", "b", zDate, "a");
free(zDate);
}
if( zBefore || (zAfter && n==nEntry) ){
zDate = db_text(0, "SELECT max(timestamp) FROM timeline /*scan*/");
timeline_submenu(&url, "Newer", "a", zDate, "b");
free(zDate);
}else if( tagid==0 ){
if( zType[0]!='a' ){
timeline_submenu(&url, "All Types", "y", "all", 0);
}
if( zType[0]!='w' && g.okRdWiki ){
|
| ︙ | ︙ | |||
929 930 931 932 933 934 935 |
}
if( nEntry<200 ){
timeline_submenu(&url, "200 Events", "n", "200", 0);
}
}
}
blob_zero(&sql);
| | | 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 |
}
if( nEntry<200 ){
timeline_submenu(&url, "200 Events", "n", "200", 0);
}
}
}
blob_zero(&sql);
db_prepare(&q, "SELECT * FROM timeline ORDER BY timestamp DESC /*scan*/");
@ <h2>%b(&desc)</h2>
blob_reset(&desc);
www_print_timeline(&q, tmFlags, 0);
db_finalize(&q);
style_footer();
}
|
| ︙ | ︙ |
Changes to src/vfile.c.
| ︙ | ︙ | |||
322 323 324 325 326 327 328 |
Stmt q;
char zBuf[4096];
db_must_be_within_tree();
db_prepare(&q,
"SELECT %Q || pathname, pathname, file_is_selected(id), rid FROM vfile"
" WHERE NOT deleted AND vid=%d"
| | | 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
Stmt q;
char zBuf[4096];
db_must_be_within_tree();
db_prepare(&q,
"SELECT %Q || pathname, pathname, file_is_selected(id), rid FROM vfile"
" WHERE NOT deleted AND vid=%d"
" ORDER BY pathname /*scan*/",
g.zLocalRoot, vid
);
md5sum_init();
while( db_step(&q)==SQLITE_ROW ){
const char *zFullpath = db_column_text(&q, 0);
const char *zName = db_column_text(&q, 1);
int isSelected = db_column_int(&q, 2);
|
| ︙ | ︙ | |||
384 385 386 387 388 389 390 |
Stmt q;
char zBuf[100];
db_must_be_within_tree();
db_prepare(&q, "SELECT pathname, rid FROM vfile"
" WHERE NOT deleted AND rid>0 AND vid=%d"
| | | 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 |
Stmt q;
char zBuf[100];
db_must_be_within_tree();
db_prepare(&q, "SELECT pathname, rid FROM vfile"
" WHERE NOT deleted AND rid>0 AND vid=%d"
" ORDER BY pathname /*scan*/",
vid);
blob_zero(&file);
md5sum_init();
while( db_step(&q)==SQLITE_ROW ){
const char *zName = db_column_text(&q, 0);
int rid = db_column_int(&q, 1);
md5sum_step_text(zName, -1);
|
| ︙ | ︙ |
Changes to src/wiki.c.
| ︙ | ︙ | |||
670 671 672 673 674 675 676 |
}
@ <ul>
db_prepare(&q,
"SELECT"
" substr(tagname, 6),"
" (SELECT value FROM tagxref WHERE tagid=tag.tagid ORDER BY mtime DESC)"
" FROM tag WHERE tagname GLOB 'wiki-*'"
| | | 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 |
}
@ <ul>
db_prepare(&q,
"SELECT"
" substr(tagname, 6),"
" (SELECT value FROM tagxref WHERE tagid=tag.tagid ORDER BY mtime DESC)"
" FROM tag WHERE tagname GLOB 'wiki-*'"
" ORDER BY lower(tagname) /*sort*/"
);
while( db_step(&q)==SQLITE_ROW ){
const char *zName = db_column_text(&q, 0);
int size = db_column_int(&q, 1);
if( size>0 ){
@ <li><a href="%s(g.zTop)/wiki?name=%T(zName)">%h(zName)</a></li>
}else if( showAll ){
|
| ︙ | ︙ | |||
701 702 703 704 705 706 707 |
const char * zTitle;
login_check_credentials();
if( !g.okRdWiki ){ login_needed(); return; }
zTitle = PD("title","*");
style_header("Wiki Pages Found");
@ <ul>
db_prepare(&q,
| | > | 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 |
const char * zTitle;
login_check_credentials();
if( !g.okRdWiki ){ login_needed(); return; }
zTitle = PD("title","*");
style_header("Wiki Pages Found");
@ <ul>
db_prepare(&q,
"SELECT substr(tagname, 6, 1000) FROM tag WHERE tagname like 'wiki-%%%q%%'"
" ORDER BY lower(tagname) /*sort*/" ,
zTitle);
while( db_step(&q)==SQLITE_ROW ){
const char *zName = db_column_text(&q, 0);
@ <li><a href="%s(g.zBaseURL)/wiki?name=%T(zName)">%h(zName)</a></li>
}
db_finalize(&q);
@ </ul>
|
| ︙ | ︙ | |||
1025 1026 1027 1028 1029 1030 1031 |
}
fossil_fatal("delete not yet implemented.");
}else
if( strncmp(g.argv[2],"list",n)==0 ){
Stmt q;
db_prepare(&q,
"SELECT substr(tagname, 6) FROM tag WHERE tagname GLOB 'wiki-*'"
| | | 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 |
}
fossil_fatal("delete not yet implemented.");
}else
if( strncmp(g.argv[2],"list",n)==0 ){
Stmt q;
db_prepare(&q,
"SELECT substr(tagname, 6) FROM tag WHERE tagname GLOB 'wiki-*'"
" ORDER BY lower(tagname) /*sort*/"
);
while( db_step(&q)==SQLITE_ROW ){
const char *zName = db_column_text(&q, 0);
printf( "%s\n",zName);
}
db_finalize(&q);
}else
|
| ︙ | ︙ |
Changes to www/custom_ticket.wiki.
| ︙ | ︙ | |||
22 23 24 25 26 27 28 29 30 31 32 33 |
</blockquote>
<h2>Next add assignees</h2><blockquote>
<p>
Back to the "Tickets" admin page, and click "Common". Add something like this:
<pre>
set assigned_choices {
tom
dick
harriet
}
</pre>
| > | > > > | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
</blockquote>
<h2>Next add assignees</h2><blockquote>
<p>
Back to the "Tickets" admin page, and click "Common". Add something like this:
<pre>
set assigned_choices {
unassigned
tom
dick
harriet
}
</pre>
Obviously, choose names corresponding to the logins on your system. The
'unassigned' entry is important, as it prevents you from having a NULL in that
field (which causes problems later when editing).
</p>
</blockquote>
<h2>Now modify the 'new ticket' page</h2><blockquote>
<p>
Back to the "Tickets" admin page, and click "New Ticket Page". This is a little
more tricky. Edit the top part:
<pre>
if {[info exists submit]} {
set status Open
set opened_by $login
set assigned_to "unassigned"
submit_ticket
}
</pre>
Note the "set opened_by" bit -- that will automatically set the "opened_by"
field to the login name of the bug reporter. Now, skip to the part with "EMail"
and modify it like so:
<pre>
|
| ︙ | ︙ |