Changeset 14754 in project


Ignore:
Timestamp:
05/23/09 17:04:45 (10 years ago)
Author:
sjamaan
Message:

Add a few more tests, tweak layout of code a bit

Location:
release/4/postgresql/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/4/postgresql/trunk/postgresql.scm

    r14753 r14754  
    2323  char-parser bool-parser bytea-parser numeric-parser
    2424  update-type-unparsers! default-type-unparsers
     25  bool-unparser
     26 
    2527  connect reset-connection disconnect connection?
     28 
    2629  exec-simple-queries exec-query
     30 
    2731  result? clear-result! result-row-count result-column-count
    2832  result-column-index result-column result-column-format
     
    3034  result-table-oid result-table-column-index
    3135  result-value result-values result-alist result-affected-rows
    32   result-inserted-oid invalid-oid escape-string escape-bytea unescape-bytea
     36  result-inserted-oid invalid-oid
     37 
     38  escape-string escape-bytea unescape-bytea
     39 
    3340  query-fold query-fold* query-for-each query-for-each*)
    3441
     
    4552(define-foreign-variable PGRES_POLLING_WRITING pg-polling-status)
    4653(define-foreign-variable PGRES_POLLING_OK pg-polling-status)
    47 (define-foreign-variable PGRES_POLLING_ACTIVE pg-polling-status)
    4854
    4955(define-foreign-type pg-exec-status (enum "ExecStatusType"))
     
    262268  (pg-connection-type-unparsers-set! conn new-type-unparsers))
    263269
    264 ;;;;;;;;;;;;;;;;;;;;;;;;
     270;;;;;;;;;;;;;;;;;;;;
    265271;;;; Connections
    266 ;;;;;;;;;;;;;;;;;;;;;;;;
     272;;;;;;;;;;;;;;;;;;;;
    267273
    268274(define-record pg-connection ptr type-parsers oid-parsers type-unparsers)
     
    352358  (void))
    353359
    354 ;;;;;;;;;;;;;;;;;;;;;
    355 ;;;;;; Results
    356 ;;;;;;;;;;;;;;;;;;;;;
     360;;;;;;;;;;;;;;;
     361;;;; Results
     362;;;;;;;;;;;;;;;
    357363
    358364(define-record pg-result ptr value-parsers)
     
    491497  (let ((oid (PQoidValue (pg-result-ptr result))))
    492498    (and (not (= oid invalid-oid)) oid)))
     499
     500
     501;;;;;;;;;;;;;;;;;;;;;;;;
     502;;;; Query procedures
     503;;;;;;;;;;;;;;;;;;;;;;;;
    493504
    494505;; Buffer all available input, yielding if nothing is available:
     
    664675
    665676;;;;;;;;;;;;;;;;;;;;;;
    666 ;; Value escaping
     677;;;; Value escaping
    667678;;;;;;;;;;;;;;;;;;;;;;
    668679
  • release/4/postgresql/trunk/tests/run.scm

    r14753 r14754  
    228228        (unescape-bytea "What's\\012up?")))
    229229
     230(test-group "type parsers"
     231  (test "Integer parsed correctly"
     232        1234
     233        (numeric-parser "1234"))
     234  (test "Float parsed correctly"
     235        123.456
     236        (numeric-parser "123.456"))
     237  (test-error "Non-integer is an error"
     238              (numeric-parser "not an integer"))
     239  (test "Boolean true parsed correctly"
     240        #t
     241        (bool-parser "t"))
     242  (test "Boolean false parsed correctly"
     243        #f
     244        (bool-parser "f"))
     245  (test "Byte array parsed correctly"
     246        (blob->u8vector/shared (string->blob "abc\x01\x02\xffdef"))
     247        (bytea-parser "abc\\001\\002\\377def"))
     248  (test "Char parser"
     249        #\x
     250        (char-parser "x")))
     251
     252(test-group "type unparsers"
     253  (test "Boolean true unparsed correctly"
     254        "TRUE"
     255        (bool-unparser #t))
     256  (test "Boolean false unparsed correctly"
     257        "FALSE"
     258        (bool-unparser #f)))
     259
    230260(test-group "high-level interface"
    231261  (test "query-fold"
Note: See TracChangeset for help on using the changeset viewer.