| | @@ -1134,10 +1134,23 @@ |
| 1134 | 1134 | "synchronous requests are not yet implemented", 0, 0); |
| 1135 | 1135 | blob_reset(&payload); |
| 1136 | 1136 | return TH_ERROR; |
| 1137 | 1137 | } |
| 1138 | 1138 | } |
| 1139 | + |
| 1140 | +/* |
| 1141 | +** Attempts to open the configuration ("user") database. Optionally, also |
| 1142 | +** attempts to try to find the repository and open it. |
| 1143 | +*/ |
| 1144 | +void Th_OpenConfig( |
| 1145 | + int openRepository |
| 1146 | +){ |
| 1147 | + if( openRepository ){ |
| 1148 | + db_find_and_open_repository(OPEN_ANY_SCHEMA | OPEN_OK_NOT_FOUND, 0); |
| 1149 | + } |
| 1150 | + db_open_config(0); |
| 1151 | +} |
| 1139 | 1152 | |
| 1140 | 1153 | /* |
| 1141 | 1154 | ** Make sure the interpreter has been initialized. Initialize it if |
| 1142 | 1155 | ** it has not been already. |
| 1143 | 1156 | ** |
| | @@ -1191,12 +1204,11 @@ |
| 1191 | 1204 | ** This function uses several settings which may be defined in the |
| 1192 | 1205 | ** repository and/or the global configuration. Since the caller |
| 1193 | 1206 | ** passed a non-zero value for the needConfig parameter, make sure |
| 1194 | 1207 | ** the necessary database connections are open prior to continuing. |
| 1195 | 1208 | */ |
| 1196 | | - db_find_and_open_repository(OPEN_ANY_SCHEMA | OPEN_OK_NOT_FOUND, 0); |
| 1197 | | - db_open_config(0); |
| 1209 | + Th_OpenConfig(1); |
| 1198 | 1210 | } |
| 1199 | 1211 | if( forceReset || forceTcl || g.interp==0 ){ |
| 1200 | 1212 | int created = 0; |
| 1201 | 1213 | int i; |
| 1202 | 1214 | if( g.interp==0 ){ |
| | @@ -1420,12 +1432,11 @@ |
| 1420 | 1432 | */ |
| 1421 | 1433 | void test_th_render(void){ |
| 1422 | 1434 | Blob in; |
| 1423 | 1435 | Th_InitTraceLog(); |
| 1424 | 1436 | if( find_option("th-open-config", 0, 0)!=0 ){ |
| 1425 | | - db_find_and_open_repository(OPEN_ANY_SCHEMA | OPEN_OK_NOT_FOUND, 0); |
| 1426 | | - db_open_config(0); |
| 1437 | + Th_OpenConfig(1); |
| 1427 | 1438 | } |
| 1428 | 1439 | if( g.argc<3 ){ |
| 1429 | 1440 | usage("FILE"); |
| 1430 | 1441 | } |
| 1431 | 1442 | blob_zero(&in); |
| | @@ -1440,12 +1451,11 @@ |
| 1440 | 1451 | void test_th_eval(void){ |
| 1441 | 1452 | int rc; |
| 1442 | 1453 | const char *zRc; |
| 1443 | 1454 | Th_InitTraceLog(); |
| 1444 | 1455 | if( find_option("th-open-config", 0, 0)!=0 ){ |
| 1445 | | - db_find_and_open_repository(OPEN_ANY_SCHEMA | OPEN_OK_NOT_FOUND, 0); |
| 1446 | | - db_open_config(0); |
| 1456 | + Th_OpenConfig(1); |
| 1447 | 1457 | } |
| 1448 | 1458 | if( g.argc!=3 ){ |
| 1449 | 1459 | usage("script"); |
| 1450 | 1460 | } |
| 1451 | 1461 | Th_FossilInit(TH_INIT_DEFAULT); |
| 1452 | 1462 | |