Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Factor out the ALTER TABLE statements that add the JX column to the USER and REPORTFMT tables into separate subroutines. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | json-meta-data |
| Files: | files | file ages | folders |
| SHA3-256: |
8f6d7dacbbfeb165b37efa6eb169e8e6 |
| User & Date: | drh 2022-11-18 12:11:50.307 |
Context
|
2022-11-18
| ||
| 18:33 | Give the JX column of USER and REPORTFMT a default value which is valid JSON. check-in: 2433964d8f user: drh tags: json-meta-data | |
| 12:11 | Factor out the ALTER TABLE statements that add the JX column to the USER and REPORTFMT tables into separate subroutines. check-in: 8f6d7dacbb user: drh tags: json-meta-data | |
|
2022-11-17
| ||
| 23:38 | Add the "jx" column to the "user" and "reportfmt" tables, with the intent of using the column for JSON metadata. Currently unused. Make arrangements to sync the "jx" column (using the "fossil config" command) in a way that is backwards compatible with older versions that do not have the "jx" column. check-in: b7ac178c4f user: drh tags: json-meta-data | |
Changes
Changes to src/configure.c.
| ︙ | ︙ | |||
445 446 447 448 449 450 451 |
azToken[1] /*safe-for-%s*/, azToken[0]/*safe-for-%s*/);
for(jj=2; jj<nToken; jj+=2){
blob_append_sql(&sql, ",%s", azToken[jj+1] /*safe-for-%s*/);
}
db_protect_only(PROTECT_SENSITIVE);
/* Make sure tables have the "jx" column */
| | | < < < | | < < | 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 |
azToken[1] /*safe-for-%s*/, azToken[0]/*safe-for-%s*/);
for(jj=2; jj<nToken; jj+=2){
blob_append_sql(&sql, ",%s", azToken[jj+1] /*safe-for-%s*/);
}
db_protect_only(PROTECT_SENSITIVE);
/* Make sure tables have the "jx" column */
if( strcmp(&zName[1],"user")==0 ){
user_update_user_table();
}else if( strcmp(&zName[1],"reportfmt")==0 ){
report_update_reportfmt_table();
}
db_multi_exec("%s)", blob_sql_text(&sql));
if( db_changes()==0 ){
blob_reset(&sql);
blob_append_sql(&sql, "UPDATE \"%w\" SET mtime=%s",
|
| ︙ | ︙ |
Changes to src/report.c.
| ︙ | ︙ | |||
251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
*(char**)pError = mprintf("only SELECT statements are allowed");
rc = SQLITE_DENY;
break;
}
}
return rc;
}
/*
** Activate the ticket report query authorizer. Must be followed by an
** eventual call to report_unrestrict_sql().
*/
void report_restrict_sql(char **pzErr){
db_set_authorizer(report_query_authorizer,(void*)pzErr,"Ticket-Report");
| > > > > > > > > > > > > > | 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 |
*(char**)pError = mprintf("only SELECT statements are allowed");
rc = SQLITE_DENY;
break;
}
}
return rc;
}
/*
** Make sure the reportfmt table is up-to-date. It should contain
** the "jx" column (as of version 2.21). If it does not, add it.
**
** The "jx" column is intended to hold a JSON object containing optional
** key-value pairs.
*/
void report_update_reportfmt_table(void){
if( db_table_has_column("repository","reportfmt","jx")==0 ){
db_multi_exec("ALTER TABLE repository.reportfmt ADD COLUMN jx TEXT;");
}
}
/*
** Activate the ticket report query authorizer. Must be followed by an
** eventual call to report_unrestrict_sql().
*/
void report_restrict_sql(char **pzErr){
db_set_authorizer(report_query_authorizer,(void*)pzErr,"Ticket-Report");
|
| ︙ | ︙ |
Changes to src/user.c.
| ︙ | ︙ | |||
571 572 573 574 575 576 577 578 579 580 581 582 583 584 |
url_parse(0, URL_USE_CONFIG);
fossil_print("URL user: %s\n", g.url.user);
user_select();
fossil_print("Final g.zLogin: %s\n", g.zLogin);
fossil_print("Final g.userUid: %d\n", g.userUid);
}
/*
** COMMAND: test-hash-passwords
**
** Usage: %fossil test-hash-passwords REPOSITORY
**
** Convert all local password storage to use a SHA1 hash of the password
| > > > > > > > > > > > > > | 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 |
url_parse(0, URL_USE_CONFIG);
fossil_print("URL user: %s\n", g.url.user);
user_select();
fossil_print("Final g.zLogin: %s\n", g.zLogin);
fossil_print("Final g.userUid: %d\n", g.userUid);
}
/*
** Make sure the USER table is up-to-date. It should contain
** the "JX" column (as of version 2.21). If it does not, add it.
**
** The "JX" column is intended to hold a JSON object containing optional
** key-value pairs.
*/
void user_update_user_table(void){
if( db_table_has_column("repository","user","jx")==0 ){
db_multi_exec("ALTER TABLE repository.user ADD COLUMN jx TEXT;");
}
}
/*
** COMMAND: test-hash-passwords
**
** Usage: %fossil test-hash-passwords REPOSITORY
**
** Convert all local password storage to use a SHA1 hash of the password
|
| ︙ | ︙ |