Index: src/db.c ================================================================== --- src/db.c +++ src/db.c @@ -1872,10 +1872,31 @@ return db_int(dflt, "SELECT value FROM vvar WHERE name=%Q", zName); } void db_lset_int(const char *zName, int value){ db_multi_exec("REPLACE INTO vvar(name,value) VALUES(%Q,%d)", zName, value); } + +/* +** Returns non-0 if the database (which must be open) table identified +** by zTableName has a column named zColName (case-sensitive), else +** returns 0. +*/ +int db_table_has_column( char const *zTableName, char const *zColName ){ + Stmt q = empty_Stmt; + int rc = 0; + db_prepare( &q, "PRAGMA table_info(%Q)", zTableName ); + while(SQLITE_ROW == db_step(&q)){ + /* Columns: (cid, name, type, notnull, dflt_value, pk) */ + char const * zCol = db_column_text(&q, 1); + if(0==fossil_strcmp(zColName, zCol)){ + rc = 1; + break; + } + } + db_finalize(&q); + return rc; +} /* ** Record the name of a local repository in the global_config() database. ** The repository filename %s is recorded as an entry with a "name" field ** of the following form: Index: src/info.c ================================================================== --- src/info.c +++ src/info.c @@ -1723,11 +1723,11 @@ const char *zUuid; char zTktName[UUID_SIZE+1]; Manifest *pTktChng; int modPending; const char *zModAction; - + char *zTktTitle; login_check_credentials(); if( !g.perm.RdTkt ){ login_needed(); return; } rid = name_to_rid_www("name"); if( rid==0 ){ fossil_redirect_home(); } zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid); @@ -1752,10 +1752,13 @@ } if( strcmp(zModAction,"approve")==0 ){ moderation_approve(rid); } } + zTktTitle = db_table_has_column( "ticket", "title" ) + ? db_text("(No title)", "SELECT title FROM ticket WHERE tkt_uuid=%Q", zTktName) + : 0; style_header("Ticket Change Details"); style_submenu_element("Raw", "Raw", "%R/artifact/%S", zUuid); style_submenu_element("History", "History", "%R/tkthistory/%s", zTktName); style_submenu_element("Page", "Page", "%R/tktview/%t", zTktName); style_submenu_element("Timeline", "Timeline", "%R/tkttimeline/%t", zTktName); @@ -1776,17 +1779,22 @@ modPending = moderation_pending(rid); if( modPending ){ @ *** Awaiting Moderator Approval *** } @
@