Changeset 7942 in project


Ignore:
Timestamp:
01/26/08 17:28:56 (12 years ago)
Author:
Kon Lovett
Message:

Save.

Location:
release/3/mysql/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/3/mysql/trunk/eggdoc-mysql.scm

    r7930 r7942  
    751751        "All MySQL result data (except NULL) are returned as Scheme strings. "
    752752        "The NULL value is represented by " (tt "#f") ". Booleans are expressed "
    753         "as Scheme strings " (tt "\"1\"") " and " (tt "\"0\"") ". All remaining "
    754         "types, including numeric types and strings are returned as Scheme "
     753        "as the Scheme strings " (tt "\"1\"") " and " (tt "\"0\"") ". All remaining "
     754        "types, including numeric types, blobs, and strings are returned as Scheme "
    755755        "strings.")
    756756    ) ; section "Data Type Conversion"
    757757
    758758    (section "Bugs"
     759      (p
     760        "No prepared statement support.")
    759761      (p
    760762        "This is alpha quality software. Only very basic functionality "
  • release/3/mysql/trunk/mysql.scm

    r7930 r7942  
    7474;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    7575
    76 #>
    77 #include <mysql.h>
    78 <#
     76#>#include <mysql.h><#
    7977
    8078(use srfi-1 srfi-4 srfi-12)
     
    9088  (generic)
    9189  (no-procedure-checks-for-usual-bindings)
     90  (inline)
    9291  (unused
    9392    my-charset-info-name-set!
     
    119118                mysql-field-length-set! )
    120119  (bound-to-procedure
    121     mysql-error)
     120    mysql-error
     121    mysql-field-binary? )
    122122  (export
    123123    ;; direct api
     
    278278
    279279    ;; MY_CHARSET_INFO api
    280     ; getters
     280    ; slot getters
    281281    my-charset-info-name
    282282    my-charset-info-csname
     
    287287
    288288    ;; MYSQL_FIELD api
     289    ; predicates
     290    mysql-field-flags-on?
     291    mysql-field-flags-off?
     292    mysql-field-primary-key?
     293    mysql-field-not-null?
     294    mysql-field-numeric?
     295    mysql-field-type-any?
     296    mysql-field-type=?
     297    mysql-field-type-clock?
     298    mysql-field-type-number?
     299    mysql-field-type-string?
     300    mysql-field-type-blob?
     301    mysql-field-type-magnitude?
     302    mysql-field-type-binary?
     303    mysql-field-type-text?
     304    ;
     305    mysql-fetch-field-specific
    289306    ; multi-field getters
    290307    mysql-field-slots
     
    293310    mysql-fetch-field-slot-direct
    294311    mysql-fetch-field-slot
    295     ; getters
     312    ; slot getters
    296313                mysql-field-name
    297314                mysql-field-org-name
     
    317334    ;; connection client flags
    318335    ; values
     336    client-long-password
     337    client-long-flag
     338    client-connect-with-db
     339    client-protocol-41
     340    client-secure-connection
     341    client-transactions
    319342    client-compress
    320343    client-found-rows
     
    512535  AUTO_INCREMENT_FLAG                                   ; field is a autoincrement field
    513536  NO_DEFAULT_VALUE_FLAG         ; field doesn't have default value
     537  NUM_FLAG                      ; field is num (for clients)
    514538  ; deprecated
    515539  ENUM_FLAG                                             ; field is an enum
    516540  SET_FLAG                                              ; field is a set
    517541  BLOB_FLAG                                             ; field is a blob
    518   TIMESTAMP_FLAG)                                                               ; field is a timestamp
     542  TIMESTAMP_FLAG        )                                                       ; field is a timestamp
    519543
    520544(define-foreign-enum (mysql-client-flags unsigned-int)
    521545        #f      ; No aliases!
    522         ; Use compression protocol.
    523         CLIENT_COMPRESS
    524         ; Return the number of found (matched) rows, not the number of changed rows.
     546  CLIENT_LONG_PASSWORD          ; new more secure passwords
     547  CLIENT_LONG_FLAG              ; Get all column flags
     548  CLIENT_CONNECT_WITH_DB        ; One can specify db on connect
     549  CLIENT_PROTOCOL_41            ; New 4.1 protocol
     550  CLIENT_SECURE_CONNECTION      ; New 4.1 authentication
     551  CLIENT_TRANSACTIONS           ; Client knows about transactions
     552        CLIENT_COMPRESS               ; Can use compression protocol
     553        ; Return the number of found (matched) rows, not the number of affected rows.
    525554        CLIENT_FOUND_ROWS
    526555        ; Prevents the client library from installing a SIGPIPE signal handler. This
     
    556585        ; programs; it is set internally in the client library. Instead, use
    557586        ; mysql_ssl_set() before calling mysql_real_connect().
    558         CLIENT_SSL)
     587        CLIENT_SSL )
    559588
    560589;-----------------------------------------------------------------------
     
    640669  AUTO_INCREMENT_FLAG
    641670  NO_DEFAULT_VALUE_FLAG
     671  NUM_FLAG
    642672  ; deprecated
    643673  ENUM_FLAG
     
    647677
    648678(gen-public-enum mysql-client-flags
     679  CLIENT_LONG_PASSWORD
     680  CLIENT_LONG_FLAG
     681  CLIENT_CONNECT_WITH_DB
     682  CLIENT_PROTOCOL_41
     683  CLIENT_SECURE_CONNECTION
     684  CLIENT_TRANSACTIONS
    649685  CLIENT_COMPRESS
    650686  CLIENT_FOUND_ROWS
     
    699735
    700736;-----------------------------------------------------------------------
     737;
     738
     739(define UNSIGNED-LONG-SIZE (foreign-value "sizeof(unsigned long)" int))
     740
     741
     742;-----------------------------------------------------------------------
    701743; Foreign function definitions for the MySQL C API using the
    702744; MySQL "my_ulonglong" type.
     
    781823
    782824(define (%mysql-options mysqlptr option value)
    783   (cond [(null? value)
    784           ((foreign-lambda int "C_mysql_options_none" mysql-ptr mysql-option)
    785            mysqlptr option)]
    786         [(string? value)
    787           ((foreign-lambda int "C_mysql_options_string" mysql-ptr mysql-option c-string)
    788             mysqlptr option value)]
    789         [(number? value)
    790           ((foreign-lambda int "C_mysql_options_ulong" mysql-ptr mysql-option unsigned-long)
    791             mysqlptr option value)]) )
     825  (cond
     826    [(null? value)
     827      ((foreign-lambda int "C_mysql_options_none" mysql-ptr mysql-option)
     828       mysqlptr option)]
     829    [(string? value)
     830      ((foreign-lambda int "C_mysql_options_string" mysql-ptr mysql-option c-string)
     831        mysqlptr option value)]
     832    [(number? value)
     833      ((foreign-lambda int "C_mysql_options_ulong" mysql-ptr mysql-option unsigned-long)
     834        mysqlptr option value)]) )
    792835
    793836;-----------------------------------------------------------------------
     
    11271170
    11281171#>
    1129 /*
    1130  * Returns NULL if the idx is out of bounds; the string value of the requested
    1131  * field, otherwise.
    1132  */
    1133 static char *mysqlaux_column_idx(MYSQL *mysql, MYSQL_RES *result, MYSQL_ROW row,
    1134                                                                 unsigned int idx)
     1172static int
     1173mysqlaux_field_index (MYSQL *mysql, MYSQL_RES *result, const char *name)
    11351174{
    1136   if (idx >= 0 && mysql_num_fields(result) > idx) {
    1137     return (char*)row[idx];
    1138   } else {
    1139     return NULL;
    1140   }
    1141 }
    1142 
    1143 /*
    1144  * Returns NULL if the name doesn't exist as a column name in the result
    1145  * set (case insensitive comparison). Otherwise, the string value of the
    1146  * resquested field is returned.
    1147  *
    1148  * (According to
    1149  *    http://dev.mysql.com/doc/mysql/en/name-case-sensitivity.html
    1150  * column names are never case sensitive.)
    1151  */
    1152 static char *mysqlaux_column_name(MYSQL *mysql, MYSQL_RES *result, MYSQL_ROW row,
    1153                                                                 const char *name)
    1154 {
    1155   unsigned int num_fields;
     1175  unsigned int num_fields = mysql_field_count(mysql);
     1176  MYSQL_FIELD *fields = mysql_fetch_fields(result);
    11561177  unsigned int i;
    1157   MYSQL_FIELD *fields;
    1158 
    1159   num_fields = mysql_field_count(mysql);
    1160   fields = mysql_fetch_fields(result);
    1161 
    1162   for(i = 0; i < num_fields; i++) {
    1163     if (strcasecmp(name, fields[i].name) == 0) {
    1164       return row[i];
     1178
     1179  for (i = 0; i < num_fields; i++) {
     1180    if (0 == strcasecmp (name, fields[i].name)) {
     1181      return (i);
    11651182    }
    11661183  }
    11671184
    1168   return NULL;
     1185  return (-1);
    11691186}
    11701187<#
    11711188
    1172 ; char *mysqlaux_column_idx(MYSQL *, MYSQL_RES *, MYSQL_ROW, unsigned int);
    1173 (define foreign-mysqlaux-column-idx
    1174   (foreign-lambda c-string "mysqlaux_column_idx" mysql-ptr mysql-res-ptr
    1175                   mysql-row unsigned-integer))
    1176 
    1177 ; char *mysqlaux_column_name(MYSQL *, MYSQL_RES *, MYSQL_ROW, const char *);
    1178 (define foreign-mysqlaux-column-name
    1179   (foreign-lambda c-string "mysqlaux_column_name" mysql-ptr mysql-res-ptr
    1180                   mysql-row nonnull-c-string))
     1189; int mysqlaux_field_index (MYSQL *mysql, MYSQL_RES *result, const char *name)
     1190(define foreign-mysqlaux-field-index
     1191  (foreign-lambda int "mysqlaux_field_index" mysql-ptr mysql-res-ptr nonnull-c-string) )
     1192
     1193; char *mysqlaux_fetch_column_direct(MYSQL_ROW, unsigned int);
     1194(define foreign-mysqlaux-fetch-column-direct
     1195  (foreign-lambda* c-pointer ((mysql-row row) (unsigned-integer idx))
     1196    "return (((MYSQL_ROW)row)[idx]);") )
     1197
     1198;
     1199(define (%mysql-get-field-index connptr resptr field)
     1200  (if (number? field)
     1201      field
     1202      (foreign-mysqlaux-field-index connptr resptr (->string field)) ) )
    11811203
    11821204;=======================================================================
     
    11901212; record printer helper
    11911213(define (record-slot->string val lbl #!optional (tst val))
    1192   (if tst (conc #\space lbl #\: #\space #\" val #\") "") )
     1214  (if tst
     1215      (conc #\space lbl #\: #\space #\" val #\")
     1216      "") )
     1217
     1218(define foreign-char-pointer->string
     1219  (foreign-lambda* c-string ((nonnull-c-pointer chrptr))
     1220    "return ((char *) chrptr);") )
     1221
     1222(define (foreign-unsigned-long-pointer->u32vector ulptr cnt)
     1223  (let* ([siz (* cnt UNSIGNED-LONG-SIZE)]
     1224         [store (make-blob siz)])
     1225    (move-memory! ulptr store siz)
     1226    (blob->u32vector/shared store) ) )
     1227
     1228(define foreign-char-pointer->string
     1229  (foreign-lambda* c-string ((c-pointer chrptr))
     1230    "return ((char *) chrptr);") )
     1231
     1232(define (foreign-binary-char-pointer->string chrptr size)
     1233  (let ([blob (make-blob size)])
     1234    (move-memory! chrptr blob size)
     1235    (blob->string blob) ) )
    11931236
    11941237;-----------------------------------------------------------------------
     
    13931436              (signal-mysql-condition 'mysql-connect
    13941437               (foreign-mysql-error mysql)
    1395                host user passwd db port unix-socket client-flag) ) ) ]
     1438               host user passwd db port unix-socket client-flag options ssl options) ) ) ]
    13961439      [else
    13971440        (signal-mysql-condition 'mysql-connect "failed to initialize mysql") ] ) ) )
     
    14431486; returns a u32vector of length num-fields.
    14441487; returns #f when no result set.
     1488(define (%mysql-fetch-lengths resptr cnt)
     1489  (and-let* ([ulptr (foreign-mysql-fetch-lengths resptr)])
     1490    (foreign-unsigned-long-pointer->u32vector ulptr cnt) ) )
     1491
     1492; returns a u32vector of length num-fields.
     1493; returns #f when no result set.
    14451494(define (mysql-fetch-lengths conn)
    1446   (and-let* ([resptr (mysql-connection-result conn)]
    1447              [ulongptr (foreign-mysql-fetch-lengths resptr)])
    1448     (let* ([siz (* (foreign-mysql-num-fields resptr) 4)]
    1449            [store (make-blob siz)])
    1450       (move-memory! ulongptr store siz)
    1451       (blob->u32vector/shared store) ) ) )
     1495  (and-let* ([resptr (mysql-connection-result conn)])
     1496    (%mysql-fetch-lengths resptr (foreign-mysql-num-fields resptr)) ) )
    14521497
    14531498; After a mysql-query that has results, use mysql-fetch-row to retrieve
     
    14581503; column name).
    14591504(define (mysql-fetch-row conn)
    1460   (and-let* [(result (mysql-connection-result conn))]
    1461     (let* [(row (foreign-mysql-fetch-row result))
    1462            (connptr (mysql-connection-ptr conn))
    1463            (row-lambda
    1464             (lambda (field)
    1465               (cond [(number? field)
    1466                      (foreign-mysqlaux-column-idx connptr
    1467                                                   result row field)]
    1468                     [else
    1469                      (foreign-mysqlaux-column-name connptr
    1470                                                    result row (->string field))])))]
    1471       (and row
    1472            row-lambda ) ) ) )
     1505  (and-let* ([resptr (mysql-connection-result conn)]
     1506             [row (foreign-mysql-fetch-row resptr)])
     1507    (let* ([connptr (mysql-connection-ptr conn)]
     1508           [fldcnt (foreign-mysql-num-fields resptr)]
     1509           [fldlens (%mysql-fetch-lengths resptr fldcnt)])
     1510      (lambda (field)
     1511        (let ([fldidx (%mysql-get-field-index connptr resptr field)])
     1512          (and (<= 0 fldidx) (< fldidx fldcnt)
     1513               (let ([chrptr (foreign-mysqlaux-fetch-column-direct resptr fldidx)])
     1514                  (if (mysql-field-binary? (foreign-mysql-fetch-field-direct resptr fldidx))
     1515                      (foreign-binary-char-pointer->string
     1516                       chrptr (u32vector-ref fldlens fldidx))
     1517                      (foreign-char-pointer->string chrptr) ) ) ) ) ) ) ) )
    14731518
    14741519(define (mysql-field-count conn)
     
    16701715
    16711716;-----------------------------------------------------------------------
     1717; The MySQL Field structure predicate API.
     1718;
     1719
     1720(define (mysql-field-flags-test fldptr mask)
     1721  (bitwise-and (mysql-field-flags fldptr) mask) )
     1722
     1723(define (mysql-field-flags-mask flags)
     1724  (apply mysql-field-flags-value flags) )
     1725
     1726;;
     1727
     1728(define (mysql-field-flags-on? fldptr . flags)
     1729  (let ([mask (mysql-field-flags-mask flags)])
     1730    (= mask (mysql-field-flags-test fldptr mask)) ) )
     1731
     1732(define (mysql-field-flags-off? fldptr . flags)
     1733  (zero? (mysql-field-flags-test fldptr (mysql-field-flags-mask flags))) )
     1734
     1735;;
     1736
     1737(define (mysql-field-type-any? fldptr types)
     1738  (memv (mysql-field-type fldptr) types) )
     1739
     1740(define (mysql-field-type=? fldptr type)
     1741  (eqv? type (mysql-field-type fldptr)) )
     1742
     1743;;
     1744
     1745(define (mysql-field-primary-key? fldptr)
     1746  (mysql-field-flags-on? fldptr pri-key-flag) )
     1747
     1748(define (mysql-field-not-null? fldptr)
     1749  (mysql-field-flags-on? fldptr not-null-flag) )
     1750
     1751(define (mysql-field-binary? fldptr)
     1752  (= 63 (mysql-field-charsetnr fldptr)) )
     1753
     1754(define (mysql-field-numeric? fldptr)
     1755  (mysql-field-flags-on? fldptr num-flag) )
     1756
     1757;;
     1758
     1759(define mysql-field-type-clock?
     1760  (let ([numtypes (list mysql-type-timestamp mysql-type-datetime
     1761                        mysql-type-date mysql-type-time
     1762                        mysql-type-newdate mysql-type-year)])
     1763    (lambda (fldptr)
     1764      (mysql-field-type-any? fldptr numtypes) ) ) )
     1765
     1766; note - not the same as the "IS_NUM" macro.
     1767(define mysql-field-type-number?
     1768  (let ([numtypes (list mysql-type-decimal mysql-type-tiny mysql-type-short
     1769                            mysql-type-long mysql-type-float mysql-type-double
     1770                        mysql-type-longlong mysql-type-int24
     1771                        mysql-type-newdecimal)])
     1772    (lambda (fldptr)
     1773      (mysql-field-type-any? fldptr numtypes) ) ) )
     1774
     1775(define mysql-field-type-blob?
     1776  (let ([blobtypes (list mysql-type-tiny-blob mysql-type-medium-blob
     1777                         mysql-type-long-blob mysql-type-blob)])
     1778    (lambda (fldptr)
     1779      (mysql-field-type-any? fldptr blobtypes) ) ) )
     1780
     1781(define mysql-field-type-string?
     1782  (let ([numtypes (list mysql-type-varchar mysql-type-var-string
     1783                        mysql-type-string)])
     1784    (lambda (fldptr)
     1785      (mysql-field-type-any? fldptr numtypes) ) ) )
     1786
     1787;;
     1788
     1789; note - the same as the "IS_NUM" macro.
     1790(define mysql-field-type-magnitude?
     1791  (let ([magtypes (list mysql-type-timestamp mysql-type-year mysql-type-null)])
     1792    (lambda (fldptr)
     1793      (or (mysql-field-type-number? fldptr)
     1794          (mysql-field-type-any? fldptr magtypes) ) ) ) )
     1795
     1796(define (mysql-field-type-binary? fldptr)
     1797  (and (mysql-field-binary? fldptr)
     1798       (or (mysql-field-type-blob? fldptr)
     1799           (mysql-field-type-string? fldptr) ) ) )
     1800
     1801(define (mysql-field-type-text? fldptr)
     1802  (and (not (mysql-field-binary? fldptr))
     1803       (or (mysql-field-type-blob? fldptr)
     1804           (mysql-field-type-string? fldptr) ) ) )
     1805
     1806;-----------------------------------------------------------------------
    16721807; The MySQL Field structure multi-slot API.
    16731808;
     
    16951830  (and-let* ([lst (mysql-field-slots (mysql-fetch-field conn) getter)])
    16961831    (car lst) ) )
     1832
     1833; returns a field pointer or #f.
     1834(define (mysql-fetch-field-specific conn field)
     1835  (and-let* ([resptr (mysql-connection-result conn)])
     1836    (let ([fldidx (%mysql-get-field-index (mysql-connection-ptr conn) resptr field)]
     1837          [fldcnt (foreign-mysql-num-fields resptr)])
     1838      (and (<= 0 fldcnt) (< fldidx fldcnt)
     1839           (foreign-mysql-fetch-field-direct resptr fldidx) ) ) ) )
     1840
     1841#|
     1842;-----------------------------------------------------------------------
     1843; The MySQL row field value string form conversion
     1844;
     1845
     1846(define (chrbuf2obj-string->number _ x) (string->number x))
     1847(define (chrbuf2obj-string->blob _ x) (string->blob x))
     1848(define (chrbuf2obj-identity _ x) (identity x))
     1849
     1850(define *character-buffer->object*
     1851  `(
     1852        (((,mysql-field-type=? ,mysql-type-null))
     1853                  (,chrbuf2obj-identity))
     1854
     1855        (((,mysql-field-type=? ,mysql-type-bit))
     1856                  (,chrbuf2obj-identity))
     1857        (((,mysql-field-type=? ,mysql-type-enum))
     1858                  (,chrbuf2obj-identity))
     1859        (((,mysql-field-type=? ,mysql-type-set))
     1860                  (,chrbuf2obj-identity))
     1861        (((,mysql-field-type=? ,mysql-type-geometry))
     1862                  (,chrbuf2obj-identity))
     1863
     1864        (((,mysql-field-type=? ,mysql-type-decimal))
     1865                        (,chrbuf2obj-string->number))
     1866        (((,mysql-field-type=? ,mysql-type-tiny))
     1867                        (,chrbuf2obj-string->number))
     1868        (((,mysql-field-type=? ,mysql-type-short))
     1869                        (,chrbuf2obj-string->number))
     1870        (((,mysql-field-type=? ,mysql-type-long))
     1871                        (,chrbuf2obj-string->number))
     1872        (((,mysql-field-type=? ,mysql-type-float))
     1873                        (,chrbuf2obj-string->number))
     1874        (((,mysql-field-type=? ,mysql-type-double))
     1875                        (,chrbuf2obj-string->number))
     1876        (((,mysql-field-type=? ,mysql-type-longlong))
     1877                        (,chrbuf2obj-string->number))
     1878        (((,mysql-field-type=? ,mysql-type-int24))
     1879                        (,chrbuf2obj-string->number))
     1880        (((,mysql-field-type=? ,mysql-type-newdecimal))
     1881                        (,chrbuf2obj-string->number))
     1882
     1883        (((,mysql-field-type=? ,mysql-type-timestamp))
     1884                  (,chrbuf2obj-identity))
     1885        (((,mysql-field-type=? ,mysql-type-date))
     1886                  (,chrbuf2obj-identity))
     1887        (((,mysql-field-type=? ,mysql-type-time))
     1888                  (,chrbuf2obj-identity))
     1889        (((,mysql-field-type=? ,mysql-type-datetime))
     1890                  (,chrbuf2obj-identity))
     1891        (((,mysql-field-type=? ,mysql-type-year))
     1892                  (,chrbuf2obj-identity))
     1893        (((,mysql-field-type=? ,mysql-type-newdate))
     1894                  (,chrbuf2obj-identity))
     1895
     1896        (((,mysql-field-type=? ,mysql-type-tiny-blob) (,mysql-field-binary?))
     1897                  (,chrbuf2obj-string->blob))
     1898        (((,mysql-field-type=? ,mysql-type-medium-blob) (,mysql-field-binary?))
     1899                  (,chrbuf2obj-string->blob))
     1900        (((,mysql-field-type=? ,mysql-type-long-blob) (,mysql-field-binary?))
     1901                  (,chrbuf2obj-string->blob))
     1902        (((,mysql-field-type=? ,mysql-type-blob) (,mysql-field-binary?))
     1903                  (,chrbuf2obj-string->blob))
     1904
     1905        (((,mysql-field-type=? ,mysql-type-varchar) (,mysql-field-binary?))
     1906                  (,chrbuf2obj-string->blob))
     1907    (((,mysql-field-type=? ,mysql-type-var-string) (,mysql-field-binary?))
     1908                  (,chrbuf2obj-string->blob))
     1909        (((,mysql-field-type=? ,mysql-type-string) (,mysql-field-binary?))
     1910                  (,chrbuf2obj-string->blob))
     1911
     1912        (((,mysql-field-type=? ,mysql-type-tiny-blob))
     1913                        (,chrbuf2obj-identity))
     1914        (((,mysql-field-type=? ,mysql-type-medium-blob))
     1915                        (,chrbuf2obj-identity))
     1916        (((,mysql-field-type=? ,mysql-type-long-blob))
     1917                        (,chrbuf2obj-identity))
     1918        (((,mysql-field-type=? ,mysql-type-blob))
     1919                        (,chrbuf2obj-identity))
     1920
     1921        (((,mysql-field-type=? ,mysql-type-varchar))
     1922                        (,chrbuf2obj-identity))
     1923        (((,mysql-field-type=? ,mysql-type-var-string))
     1924                        (,chrbuf2obj-identity))
     1925        (((,mysql-field-type=? ,mysql-type-string))
     1926                        (,chrbuf2obj-identity))
     1927  ) )
     1928
     1929(define (call-with-template obj def)
     1930  (apply (car def) obj (cdr def)) )
     1931
     1932(define (test-with-templates obj defs)
     1933  (every (cut call-with-template obj <>) defs) )
     1934
     1935; returns field object value for the string form.
     1936(define (mysql-field-string-form->object fldptr str)
     1937  (let ([def (find (lambda (def) (test-with-templates fldptr (first def)))
     1938                   *character-buffer->object*)])
     1939    (if def
     1940        (call-with-template fldptr (append (second def) `(,str)))
     1941        (signal-mysql-condition 'mysql-field-string-form->object
     1942                                "unknown field type") ) ) )
     1943
     1944; returns list of field object value for the specified row.
     1945(define (mysql-row-string-form->object rowprc . field-ids)
     1946  (map (lambda (fld-id)
     1947         (let ([fldptr (mysql-fetch-field-specific conn fld-id)])
     1948           (if fldptr
     1949               (mysql-field-string-form->object fldptr (rowprc fld-id))
     1950               (signal-mysql-condition 'mysql-row-string-form->object
     1951                                       "no such field") ) ) )
     1952       field-ids) )
     1953|#
Note: See TracChangeset for help on using the changeset viewer.