619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
|
;; schema is list of SQL statements - can be used to extend db with more tables
;;
(define (open-queue-db dbpath dbfile #!key (schema '()))
(let* ((dbfname (conc dbpath "/" dbfile))
(dbexists (if (file-exists? dbfname) #t (begin (create-directory dbpath #t) #f)))
(db (dbi:open 'sqlite3 (list (cons 'dbname dbfname)))))
;; (set-busy-handler! db (busy-timeout 10000))
(if (not dbexists) ;; NOTE: In the archive we allow duplicates and other messiness.
(for-each
(lambda (stmt)
(dbi:exec db stmt))
(cons "CREATE TABLE IF NOT EXISTS pkts
(id INTEGER PRIMARY KEY,
group_id INTEGER NOT NULL,
|
|
|
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
|
;; schema is list of SQL statements - can be used to extend db with more tables
;;
(define (open-queue-db dbpath dbfile #!key (schema '()))
(let* ((dbfname (conc dbpath "/" dbfile))
(dbexists (if (file-exists? dbfname) #t (begin (create-directory dbpath #t) #f)))
(db (dbi:open 'sqlite3 (list (cons 'dbname dbfname)))))
;; (set-busy-handler! (dbi:db-conn db) (busy-timeout 10000))
(if (not dbexists) ;; NOTE: In the archive we allow duplicates and other messiness.
(for-each
(lambda (stmt)
(dbi:exec db stmt))
(cons "CREATE TABLE IF NOT EXISTS pkts
(id INTEGER PRIMARY KEY,
group_id INTEGER NOT NULL,
|