Megatest

Check-in [fab9bf9c5c]
Login
Overview
Comment:Move sync transaction in an attempt to free up bound time in .mtdb/*.db files
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | v1.81-better sync
Files: files | file ages | folders
SHA1: fab9bf9c5cda31f48191421191e2e0f3d5a163eb
User & Date: mrwellan on 2024-07-17 17:13:14
Other Links: branch diff | manifest | tags
Context
2024-07-17
17:13
Move sync transaction in an attempt to free up bound time in .mtdb/*.db files Leaf check-in: fab9bf9c5c user: mrwellan tags: v1.81-better sync
2024-07-15
15:47
Changed Megatest version to 1.8102 check-in: 98f3441b4f user: icfadm tags: v1.81
Changes

Modified dbmod.scm from [7686817692] to [18e9c24629].

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
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







-
-
-
-
-
+













+
+
+
+
-
-
-
+
+
+
+
-
-
+
+
+

-
+







                (is-trigger-dropped (if has-last-update
                                        (db:is-trigger-dropped db tablename)
					#f)) 
		(stmth  (sqlite3:prepare db full-ins))
                (changed-rows 0))
	   (for-each
	    (lambda (fromdat-lst)
	      (mutex-lock! *db-transaction-mutex*)
	      (sqlite3:with-transaction
	       db
	       (lambda ()
		 (for-each ;; 
	      	 (for-each ;; 
		  (lambda (fromrow)
		    (let* ((a    (vector-ref fromrow 0))
			   (curr (hash-table-ref/default todat a #f))
			   (same #t))
		      (let loop ((i 0))
			(if (or (not curr)
				(not (equal? (vector-ref fromrow i)(vector-ref curr i))))
			    (set! same #f))
			(if (and same
				 (< i (- num-fields 1)))
			    (loop (+ i 1))))
		      (if (not same)
			  (begin
			    (mutex-lock! *db-transaction-mutex*)
			    (sqlite3:with-transaction
			     db
			     (lambda ()
			    (apply sqlite3:execute stmth (vector->list fromrow))
			    (hash-table-set! numrecs tablename (+ 1 (hash-table-ref/default numrecs tablename 0)))
			    (set! changed-rows (+ changed-rows 1))))))
			       (apply sqlite3:execute stmth (vector->list fromrow))
			       (hash-table-set! numrecs tablename
						(+ 1 (hash-table-ref/default numrecs tablename 0)))
			       (set! changed-rows (+ changed-rows 1))))
		  fromdat-lst)))
	      (mutex-unlock! *db-transaction-mutex*))
			    (mutex-unlock! *db-transaction-mutex*)
			    ))))
		  fromdat-lst))
	    fromdats)
		       ;; (debug:print 0 *default-log-port* "row="row)
	   ;; (debug:print 0 *default-log-port* "row="row)
	   
	   (sqlite3:finalize! stmth)
           (if (member "last_update" field-names)
               (db:create-trigger db tablename)))
	 ))
     tbls)
    (let* ((runtime      (- (current-milliseconds) start-time))

Modified matt/buttontest.scm from [4c1acbf3a4] to [7bf96cb14f].

43
44
45
46
47
48
49
50

51
52
53
43
44
45
46
47
48
49

50
51
52
53







-
+



    (iup:attribute-set! img1 "2" bgcolor) ;; "BGCOLOR")
    (iup:attribute-set! img1 "3" tcolor)
    name))

(iup:show
 (iup:dialog
  (iup:vbox
   (iup:button " " image: (make-image "GreenBlack" "0 255 0" "0 0 0")))))
   (iup:button " " image: (make-image "YellowBlack" "255 255 0" "0 0 0")))))

(iup:main-loop)
)