Fossil

Diff
Login

Differences From Artifact [f32bd1bb3d]:

To Artifact [cf6d41165c]:


1354
1355
1356
1357
1358
1359
1360
1361

1362


1363





1364

1365
1366



1367

1368

1369
1370
1371
1372
1373
1374


1375

1376
1377
1378
1379
1380
1381
1382


1383
1384




1385

1386


1387

1388
1389
1390
1391
1392
1393
1394
1354
1355
1356
1357
1358
1359
1360

1361
1362
1363
1364

1365
1366
1367
1368
1369
1370
1371


1372
1373
1374
1375
1376

1377
1378
1379
1380
1381
1382
1383
1384
1385

1386
1387
1388
1389
1390
1391


1392
1393
1394
1395
1396
1397
1398
1399

1400
1401
1402
1403

1404
1405
1406
1407
1408
1409
1410
1411







-
+

+
+
-
+
+
+
+
+

+
-
-
+
+
+

+
-
+






+
+
-
+





-
-
+
+


+
+
+
+
-
+

+
+
-
+







  }else if( argc==2 ){
    zP = (const char*)sqlite4_value_text(argv[1]);
    if( zP ) sqlite4_result_text(context, zP, -1, SQLITE_TRANSIENT);
  }
}

/*
** This is used by the [commit] command.
** SQL function:
**
**       is_selected(id)
**       if_selected(id, X, Y)
** Return true if either:
**
** On the commit command, when filenames are specified (in order to do
** a partial commit) the vfile.id values for the named files are loaded
** into the g.aCommitFile[] array.  This function looks at that array
** to see if a file is named on the command-line.
**
** In the first form (1 argument) return TRUE if either no files are
**     a) Global.aCommitFile is NULL, or
**     b) Global.aCommitFile contains the integer passed as an argument.
** named on the command line (g.aCommitFile is NULL meaning that all
** changes are to be committed) or if id is found in g.aCommitFile[]
** (meaning that id was named on the command-line).
**
** In the second form (3 arguments) return argument X if true and Y
** Otherwise return false.
** if false.
*/
static void file_is_selected(
  sqlite4_context *context,
  int argc,
  sqlite4_value **argv
){
  int rc = 0;

  assert(argc==1);
  assert(argc==1 || argc==3);
  if( g.aCommitFile ){
    int iId = sqlite4_value_int(argv[0]);
    int ii;
    for(ii=0; g.aCommitFile[ii]; ii++){
      if( iId==g.aCommitFile[ii] ){
        sqlite4_result_int(context, 1);
        return;
        rc = 1;
        break;
      }
    }
  }else{
    rc = 1;
  }
  if( argc==1 ){
    sqlite4_result_int(context, 0);
    sqlite4_result_int(context, rc);
  }else{
    assert( argc==3 );
    assert( rc==0 || rc==1 );
    sqlite4_result_int(context, 1);
    sqlite4_result_value(context, argv[2-rc]);
  }
}

/*
** Convert the input string into an SHA1.  Make a notation in the
** CONCEALED table so that the hash can be undo using the db_reveal()
** function at some later time.
1453
1454
1455
1456
1457
1458
1459
1460




1461
1462
1463
1464
1465
1466
1467
1470
1471
1472
1473
1474
1475
1476

1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487







-
+
+
+
+







LOCAL void db_connection_init(void){
  sqlite4_exec(g.db, "PRAGMA foreign_keys=OFF;", 0, 0, 0);
  sqlite4_create_function(g.db, "user", 0, SQLITE_ANY, 0, db_sql_user, 0, 0);
  sqlite4_create_function(g.db, "cgi", 1, SQLITE_ANY, 0, db_sql_cgi, 0, 0);
  sqlite4_create_function(g.db, "cgi", 2, SQLITE_ANY, 0, db_sql_cgi, 0, 0);
  sqlite4_create_function(g.db, "print", -1, SQLITE_UTF8, 0,db_sql_print,0,0);
  sqlite4_create_function(
    g.db, "file_is_selected", 1, SQLITE_UTF8, 0, file_is_selected,0,0
    g.db, "is_selected", 1, SQLITE_UTF8, 0, file_is_selected,0,0
  );
  sqlite4_create_function(
    g.db, "if_selected", 3, SQLITE_UTF8, 0, file_is_selected,0,0
  );
  if( g.fSqlTrace ){
    sqlite4_trace(g.db, db_sql_trace, 0);
  }
}

/*