System.Data.SQLite

Check-in [dfbf105067]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Avoid recompiling the C# based workloads.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | stress
Files: files | file ages | folders
SHA1: dfbf1050672644a8d4b12af2f4bead6486c9ea8f
User & Date: mistachkin 2012-07-11 07:40:42.348
Context
2012-07-11
07:41
Cleanup 'compiled' script variable. check-in: 3a2d7926a6 user: mistachkin tags: stress
07:40
Avoid recompiling the C# based workloads. check-in: dfbf105067 user: mistachkin tags: stress
07:17
More refinements to stress test. check-in: 3622f106ea user: mistachkin tags: stress
Changes
Unified Diff Ignore Whitespace Patch
Changes to Tests/stress.eagle.
64
65
66
67
68
69
70





71
72
73
74
75
76
77
      "---- workloads will repeat " $count(0) " time(s)...\n"]

  tputs $test_channel [appendArgs \
      "---- workloads will have " $count(1) " iteration(s)...\n"]

  #############################################################################






  set fileName(1) "file::memory:?cache=shared"
  set fileName(2) [file join [getDatabaseDirectory] stress.db]

  #############################################################################

  setupDb $fileName(1) "" "" "" "" "" false true srcDb
  setupDb $fileName(2)







>
>
>
>
>







64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
      "---- workloads will repeat " $count(0) " time(s)...\n"]

  tputs $test_channel [appendArgs \
      "---- workloads will have " $count(1) " iteration(s)...\n"]

  #############################################################################

  set compiled(12) ""
  set compiled(13) ""

  #############################################################################

  set fileName(1) "file::memory:?cache=shared"
  set fileName(2) [file join [getDatabaseDirectory] stress.db]

  #############################################################################

  setupDb $fileName(1) "" "" "" "" "" false true srcDb
  setupDb $fileName(2)
335
336
337
338
339
340
341




342
343
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
384
385
386
387
388
389
390




391
392
393
394
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

  #############################################################################

  set workload(12) [list [list srcFileName dstFileName table count] {
    #
    # NOTE: Workload #12, backup to in-memory database.
    #




    set id [object invoke Interpreter.GetActive NextId]

    set code [compileCSharpWith [subst {
      using System;
      using System.Data.SQLite;
      using System.Text;

      namespace _Dynamic${id}
      {
        public static class Test${id}
        {
          public static void BackupAndGetData()
          {
            using (SQLiteConnection source = new SQLiteConnection(
                "FullUri=${srcFileName};"))
            {
              source.Open();
              using (SQLiteConnection destination = new SQLiteConnection(
                  "FullUri=${dstFileName};"))
              {
                destination.Open();


                source.BackupDatabase(destination, "main", "main", -1, null, 0);
              }
            }
          }

          /////////////////////////////////////////////////////////////////////

          public static void Main()
          {
            // do nothing.
          }
        }
      }
    }] true true true results errors System.Data.SQLite.dll]
    if {$code eq "Ok"} then {

      object invoke _Dynamic${id}.Test${id} BackupAndGetData
    } else {
      error $errors

    }
    showTest C
  }]

  #############################################################################

  set workload(13) [list [list srcFileName dstFileName table count] {
    #
    # NOTE: Workload #13, backup from an in-memory database.
    #




    set id [object invoke Interpreter.GetActive NextId]

    set code [compileCSharpWith [subst {
      using System;
      using System.Data.SQLite;
      using System.Text;

      namespace _Dynamic${id}
      {
        public static class Test${id}
        {
          public static void BackupAndGetData()
          {
            using (SQLiteConnection source = new SQLiteConnection(
                "FullUri=${dstFileName};"))
            {
              source.Open();
              using (SQLiteConnection destination = new SQLiteConnection(
                  "FullUri=${srcFileName};"))
              {
                destination.Open();


                source.BackupDatabase(destination, "main", "main", -1, null, 0);
              }
            }
          }

          /////////////////////////////////////////////////////////////////////

          public static void Main()
          {
            // do nothing.
          }
        }
      }
    }] true true true results errors System.Data.SQLite.dll]
    if {$code eq "Ok"} then {

      object invoke _Dynamic${id}.Test${id} BackupAndGetData
    } else {
      error $errors

    }
    showTest D
  }]
} -body {
  for {set index(0) 0} {$index(0) < $count(0)} {incr index(0)} {
    sql execute $db "CREATE TABLE IF NOT EXISTS t1(x PRIMARY KEY, y, z);"








>
>
>
>
|
<
|
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
>
|
|
|
|

|

|
|
|
|
|
|
|
|
>
|
|
|
>










>
>
>
>
|
<
|
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
>
|
|
|
|

|

|
|
|
|
|
|
|
|
>
|
|
|
>







340
341
342
343
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
384
385
386
387
388
389
390
391
392
393
394
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
445
446
447
448
449
450
451
452
453
454
455

  #############################################################################

  set workload(12) [list [list srcFileName dstFileName table count] {
    #
    # NOTE: Workload #12, backup to in-memory database.
    #
    if {[string is integer -strict $::compiled(12)]} then {
      set id $::compiled(12); # NOTE: Already compiled.
      object invoke _Dynamic${id}.Test${id} BackupAndGetData
    } else {
      set id [object invoke Interpreter.GetActive NextId]

      set code [compileCSharpWith [subst {
        using System;
        using System.Data.SQLite;
        using System.Text;

        namespace _Dynamic${id}
        {
          public static class Test${id}
          {
            public static void BackupAndGetData()
            {
              using (SQLiteConnection source = new SQLiteConnection(
                  "FullUri=${srcFileName};"))
              {
                source.Open();
                using (SQLiteConnection destination = new SQLiteConnection(
                    "FullUri=${dstFileName};"))
                {
                  destination.Open();

                  source.BackupDatabase(
                      destination, "main", "main", -1, null, 0);
                }
              }
            }

            ///////////////////////////////////////////////////////////////////

            public static void Main()
            {
              // do nothing.
            }
          }
        }
      }] true true true results errors System.Data.SQLite.dll]
      if {$code eq "Ok"} then {
        set ::compiled(12) $id; # NOTE: Compiled OK.
        object invoke _Dynamic${id}.Test${id} BackupAndGetData
      } else {
        error $errors
      }
    }
    showTest C
  }]

  #############################################################################

  set workload(13) [list [list srcFileName dstFileName table count] {
    #
    # NOTE: Workload #13, backup from an in-memory database.
    #
    if {[string is integer -strict $::compiled(13)]} then {
      set id $::compiled(13); # NOTE: Already compiled.
      object invoke _Dynamic${id}.Test${id} BackupAndGetData
    } else {
      set id [object invoke Interpreter.GetActive NextId]

      set code [compileCSharpWith [subst {
        using System;
        using System.Data.SQLite;
        using System.Text;

        namespace _Dynamic${id}
        {
          public static class Test${id}
          {
            public static void BackupAndGetData()
            {
              using (SQLiteConnection source = new SQLiteConnection(
                  "FullUri=${dstFileName};"))
              {
                source.Open();
                using (SQLiteConnection destination = new SQLiteConnection(
                    "FullUri=${srcFileName};"))
                {
                  destination.Open();

                  source.BackupDatabase(
                      destination, "main", "main", -1, null, 0);
                }
              }
            }

            ///////////////////////////////////////////////////////////////////

            public static void Main()
            {
              // do nothing.
            }
          }
        }
      }] true true true results errors System.Data.SQLite.dll]
      if {$code eq "Ok"} then {
        set ::compiled(13) $id; # NOTE: Compiled OK.
        object invoke _Dynamic${id}.Test${id} BackupAndGetData
      } else {
        error $errors
      }
    }
    showTest D
  }]
} -body {
  for {set index(0) 0} {$index(0) < $count(0)} {incr index(0)} {
    sql execute $db "CREATE TABLE IF NOT EXISTS t1(x PRIMARY KEY, y, z);"