Megatest

Check-in [a719a06cf7]
Login
Overview
Comment:fixed prepare statement for postgres
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.63-configdbsync
Files: files | file ages | folders
SHA1: a719a06cf7f8a187ee5008c1556f43924b9e2595
User & Date: srehman on 2017-01-23 14:08:38
Other Links: branch diff | manifest | tags
Context
2017-01-24
16:32
inserts into pgsql now working check-in: 70843b7e20 user: srehman tags: v1.63-configdbsync
2017-01-23
14:08
fixed prepare statement for postgres check-in: a719a06cf7 user: srehman tags: v1.63-configdbsync
2017-01-17
14:16
merged with latest 1.63 check-in: acf8e3060c user: srehman tags: v1.63-configdbsync
Changes

Modified db.scm from [7d89017e41] to [524b1bd5c1].

678
679
680
681
682
683
684
685

686
687
688
689
690
691
692
693
694
695
696
697
698
699
678
679
680
681
682
683
684

685
686
687
688
689
690
691

692
693
694
695
696
697
698







-
+






-







        (if (eqv? (dbi:db-dbtype targdb) 'pg)
          (let* ((prep ""))
            (for-each 
              (lambda (row)
                (set! tabletypes (cons (cons (string->symbol (vector-ref row 1)) (vector-ref row 2)) tabletypes)))
              (dbi:pull-metadata (db:dbdat-get-db fromdb) tablename))
            (set! prep (string-intersperse (map (lambda (x) (alist-ref (string->symbol (car x)) tabletypes)) fields) ","))
            (set! prep (conc "PREPARE fullins (" prep ") AS REPLACE INTO " tablename " ( " (string-intersperse (map car fields) ",") " ) VALUES ( "))
            (set! prep (conc "PREPARE fullins (" prep ") AS INSERT INTO " tablename " ( " (string-intersperse (map car fields) ",") " ) VALUES ( "))
              (let loop ((i 1))
                  (set! prep (conc prep "$" i ","))
                (if (< i (- num-fields 1))
                (loop (+ i 1))
                (set! prep (conc prep "$" (+ i 1) " );"))))
            (set! full-ins prep)))

	       (let* ((db (dbi:convert (db:dbdat-get-db targdb)))
		      (stmth  (dbi:prepare db full-ins)))
		 ;; (db:delay-if-busy targdb) ;; NO WAITING
		 (for-each
		  (lambda (fromdat-lst)
		    (dbi:with-transaction
		     db