/ Changes On Branch does-not-work
Login

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

Changes In Branch does-not-work Excluding Merge-Ins

This is equivalent to a diff from 6647d1cb8b to 98d10cb52a

2023-02-08
20:29
Back out the 'txn' enhancement to date/time functions. The duration of a "transaction" is confused and needs to be straightened out prior to moving forward with this change. (check-in: 4a145f0732 user: drh tags: trunk)
19:45
Be careful to maintain the value of 'txn' as long as there are active statements. <b>Withdrawn</b> See the attached Wiki page. (Closed-Leaf check-in: 98d10cb52a user: drh tags: does-not-work)
17:28
Always use 64-bit integers for stats associated with STAT1 and STAT4. (check-in: 6647d1cb8b user: drh tags: trunk)
17:28
Better fix the problem where optimizing an fts5 table too often causes it to become unreadable (first attempt was [35bed981]). (check-in: 459d986d38 user: dan tags: trunk)

Changes to src/vdbeaux.c.

3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
    }

    /* Release the locks */
    sqlite3VdbeLeave(p);
  }

  /* We have successfully halted and closed the VM.  Record this fact. */
  db->nVdbeActive--;
  if( !p->readOnly ) db->nVdbeWrite--;
  if( p->bIsReader ) db->nVdbeRead--;
  assert( db->nVdbeActive>=db->nVdbeRead );
  assert( db->nVdbeRead>=db->nVdbeWrite );
  assert( db->nVdbeWrite>=0 );
  p->eVdbeState = VDBE_HALT_STATE;
  checkActiveVdbeCnt(db);
  if( db->mallocFailed ){
    p->rc = SQLITE_NOMEM_BKPT;
  }

  /* If the auto-commit flag is set to true, then any locks that were held
  ** by connection db have now been released. Call sqlite3ConnectionUnlocked() 
  ** to invoke any required unlock-notify callbacks.
  */
  if( db->autoCommit ){
    sqlite3ConnectionUnlocked(db);
    db->txnTime = 0;
  }

  assert( db->nVdbeActive>0 || db->autoCommit==0 || db->nStatement==0 );
  return (p->rc==SQLITE_BUSY ? SQLITE_BUSY : SQLITE_OK);
}









|

















<







3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396

3397
3398
3399
3400
3401
3402
3403
    }

    /* Release the locks */
    sqlite3VdbeLeave(p);
  }

  /* We have successfully halted and closed the VM.  Record this fact. */
  if( (--db->nVdbeActive)==0 && db->autoCommit )  db->txnTime = 0;
  if( !p->readOnly ) db->nVdbeWrite--;
  if( p->bIsReader ) db->nVdbeRead--;
  assert( db->nVdbeActive>=db->nVdbeRead );
  assert( db->nVdbeRead>=db->nVdbeWrite );
  assert( db->nVdbeWrite>=0 );
  p->eVdbeState = VDBE_HALT_STATE;
  checkActiveVdbeCnt(db);
  if( db->mallocFailed ){
    p->rc = SQLITE_NOMEM_BKPT;
  }

  /* If the auto-commit flag is set to true, then any locks that were held
  ** by connection db have now been released. Call sqlite3ConnectionUnlocked() 
  ** to invoke any required unlock-notify callbacks.
  */
  if( db->autoCommit ){
    sqlite3ConnectionUnlocked(db);

  }

  assert( db->nVdbeActive>0 || db->autoCommit==0 || db->nStatement==0 );
  return (p->rc==SQLITE_BUSY ? SQLITE_BUSY : SQLITE_OK);
}


Changes to test/date.test.

552
553
554
555
556
557
558











559
560
561
562
563
564
565
      current_date=$x(cd1),
      current_timestamp=$x(cs1),
      time()=$x(ct2),
      datetime()=$x(cs2);
  }
} {1 1 1 0 0}
db eval {COMMIT}












# Tests of extreme values in date/time functions.  Run with UBSan or the
# equivalent to verify no signed interger overflow warnings.
#
datetest 16.1 {date(147483649)} NULL
datetest 16.2 {datetime(0)} {-4713-11-24 12:00:00}
datetest 16.3 {datetime(5373484.49999999)} {9999-12-31 23:59:59}







>
>
>
>
>
>
>
>
>
>
>







552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
      current_date=$x(cd1),
      current_timestamp=$x(cs1),
      time()=$x(ct2),
      datetime()=$x(cs2);
  }
} {1 1 1 0 0}
db eval {COMMIT}

reset_db
do_test date-15.11 {
  db eval {CREATE TABLE t1(x);}
  db eval {VALUES(1),(2),(3)} {
    db eval {INSERT INTO t1(x) VALUES(julianday('txn'))}
    after 10
  }
  db eval {SELECT count(x), count(DISTINCT x) FROM t1}
} {3 1}


# Tests of extreme values in date/time functions.  Run with UBSan or the
# equivalent to verify no signed interger overflow warnings.
#
datetest 16.1 {date(147483649)} NULL
datetest 16.2 {datetime(0)} {-4713-11-24 12:00:00}
datetest 16.3 {datetime(5373484.49999999)} {9999-12-31 23:59:59}