Changeset 7948 in project


Ignore:
Timestamp:
01/27/08 01:47:15 (10 years ago)
Author:
kon
Message:

Minor additions to type sets.

Location:
release/3/mysql
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/3/mysql/tags/1.31/mysql.scm

    r7943 r7948  
    400400        mysql-type-timestamp
    401401        mysql-type-longlong
    402         mysql-type-int24
    403402        mysql-type-date
    404403        mysql-type-time
     
    457456(define-foreign-type mysql-field-ptr (c-pointer "MYSQL_FIELD"))
    458457
    459 ; mysql-row-ptr represents the C type MYSQL_ROW, which is actually a char**,
    460 ; but we're just going to pass it to other mysql functions, hence the generic
    461 ; c-pointer.
    462 (define-foreign-type mysql-row c-pointer)
     458; MYSQL_ROW (we just pass it around, not def-ref'ed)
     459(define-foreign-type mysql-row (c-pointer (c-pointer char)))
     460
     461; my_ulonglong
     462(define-foreign-type my-ulonglong number)
     463
     464; my_bool
     465(define-foreign-type my-bool bool)
     466
     467; MYSQL_FIELD_OFFSET
     468(define-foreign-type mysql-field-offset unsigned-int)
    463469
    464470;-----------------------------------------------------------------------
    465 ; Private enumeration value constants
    466 ;
     471; Enumeration & flag value constants
     472;
     473
     474(define-macro (gen-public-enum ?typ . ?syms)
     475  `(begin
     476     ,@(map
     477        (lambda (sym)
     478          (if (pair? sym)
     479            `(define ,(car sym) ,(cadr sym))
     480            `(define ,(string->symbol (c-name->scheme-name (symbol->string sym))) ,sym)))
     481        ?syms)
     482     (define (,(string->symbol (string-append (symbol->string ?typ) "-value")) . syms)
     483       (,(string->symbol (string-append (symbol->string ?typ) "->number")) syms))
     484     (define (,(string->symbol (string-append (symbol->string ?typ) "-symbol")) val)
     485       (,(string->symbol (string-append "number->" (symbol->string ?typ))) val))) )
    467486
    468487(define-foreign-enum (mysql-server-option (enum "enum_mysql_set_option"))
     
    470489  MYSQL_OPTION_MULTI_STATEMENTS_ON
    471490  MYSQL_OPTION_MULTI_STATEMENTS_OFF )
     491
     492(gen-public-enum mysql-server-option
     493  MYSQL_OPTION_MULTI_STATEMENTS_ON
     494  MYSQL_OPTION_MULTI_STATEMENTS_OFF)
    472495
    473496(define-foreign-enum (mysql-option (enum "mysql_option"))
     
    494517  MYSQL_REPORT_DATA_TRUNCATION )
    495518
     519(gen-public-enum mysql-option
     520  MYSQL_OPT_CONNECT_TIMEOUT
     521  MYSQL_OPT_COMPRESS
     522  MYSQL_OPT_NAMED_PIPE
     523  MYSQL_INIT_COMMAND
     524  MYSQL_READ_DEFAULT_FILE
     525  MYSQL_READ_DEFAULT_GROUP
     526  MYSQL_SET_CHARSET_DIR
     527  MYSQL_SET_CHARSET_NAME
     528  MYSQL_OPT_LOCAL_INFILE
     529  MYSQL_OPT_PROTOCOL
     530  MYSQL_SHARED_MEMORY_BASE_NAME
     531  MYSQL_OPT_READ_TIMEOUT
     532  MYSQL_OPT_WRITE_TIMEOUT
     533  MYSQL_OPT_USE_RESULT
     534  MYSQL_OPT_USE_REMOTE_CONNECTION
     535  MYSQL_OPT_USE_EMBEDDED_CONNECTION
     536  MYSQL_OPT_GUESS_CONNECTION
     537  MYSQL_SET_CLIENT_IP
     538  MYSQL_SECURE_AUTH
     539  MYSQL_REPORT_DATA_TRUNCATION)
     540
    496541(define-foreign-enum (mysql-type (enum "enum_field_types"))
    497542  #f  ; No aliases!
     
    505550  MYSQL_TYPE_TIMESTAMP
    506551  MYSQL_TYPE_LONGLONG
    507   MYSQL_TYPE_INT24
    508552  MYSQL_TYPE_DATE
    509553  MYSQL_TYPE_TIME
     
    524568  MYSQL_TYPE_GEOMETRY )
    525569
     570(gen-public-enum mysql-type
     571  MYSQL_TYPE_DECIMAL
     572        MYSQL_TYPE_TINY
     573  MYSQL_TYPE_SHORT
     574  MYSQL_TYPE_LONG
     575  MYSQL_TYPE_FLOAT
     576  MYSQL_TYPE_DOUBLE
     577  MYSQL_TYPE_NULL
     578  MYSQL_TYPE_TIMESTAMP
     579  MYSQL_TYPE_LONGLONG
     580  MYSQL_TYPE_DATE
     581  MYSQL_TYPE_TIME
     582  MYSQL_TYPE_DATETIME
     583        MYSQL_TYPE_YEAR
     584  MYSQL_TYPE_NEWDATE
     585        MYSQL_TYPE_VARCHAR
     586  MYSQL_TYPE_BIT
     587  MYSQL_TYPE_NEWDECIMAL
     588  MYSQL_TYPE_ENUM
     589  MYSQL_TYPE_SET
     590  MYSQL_TYPE_TINY_BLOB
     591  MYSQL_TYPE_MEDIUM_BLOB
     592  MYSQL_TYPE_LONG_BLOB
     593  MYSQL_TYPE_BLOB
     594  MYSQL_TYPE_VAR_STRING
     595  MYSQL_TYPE_STRING
     596  MYSQL_TYPE_GEOMETRY)
     597
    526598(define-foreign-enum (mysql-field-flags unsigned-int)
    527599  #f  ; No aliases!
     
    541613  BLOB_FLAG                                             ; field is a blob
    542614  TIMESTAMP_FLAG        )                                                       ; field is a timestamp
     615
     616(gen-public-enum mysql-field-flags
     617  NOT_NULL_FLAG
     618  PRI_KEY_FLAG
     619  UNIQUE_KEY_FLAG
     620  MULTIPLE_KEY_FLAG
     621  UNSIGNED_FLAG
     622  ZEROFILL_FLAG
     623  BINARY_FLAG
     624  AUTO_INCREMENT_FLAG
     625  NO_DEFAULT_VALUE_FLAG
     626  NUM_FLAG
     627  ; deprecated
     628  ENUM_FLAG
     629  SET_FLAG
     630  BLOB_FLAG
     631  TIMESTAMP_FLAG)
    543632
    544633(define-foreign-enum (mysql-client-flags unsigned-int)
     
    587676        CLIENT_SSL )
    588677
    589 ;-----------------------------------------------------------------------
    590 ; Public enumeration value constants
    591 ;
    592 
    593 (define-macro (gen-public-enum ?typ . ?syms)
    594   `(begin
    595      ,@(map
    596         (lambda (sym)
    597           (if (pair? sym)
    598             `(define ,(car sym) ,(cadr sym))
    599             `(define ,(string->symbol (c-name->scheme-name (symbol->string sym))) ,sym)))
    600         ?syms)
    601      (define (,(string->symbol (string-append (symbol->string ?typ) "-value")) . syms)
    602        (,(string->symbol (string-append (symbol->string ?typ) "->number")) syms))
    603      (define (,(string->symbol (string-append (symbol->string ?typ) "-symbol")) val)
    604        (,(string->symbol (string-append "number->" (symbol->string ?typ))) val))) )
    605 
    606 (gen-public-enum mysql-server-option
    607   MYSQL_OPTION_MULTI_STATEMENTS_ON
    608   MYSQL_OPTION_MULTI_STATEMENTS_OFF)
    609 
    610 (gen-public-enum mysql-option
    611   MYSQL_OPT_CONNECT_TIMEOUT
    612   MYSQL_OPT_COMPRESS
    613   MYSQL_OPT_NAMED_PIPE
    614   MYSQL_INIT_COMMAND
    615   MYSQL_READ_DEFAULT_FILE
    616   MYSQL_READ_DEFAULT_GROUP
    617   MYSQL_SET_CHARSET_DIR
    618   MYSQL_SET_CHARSET_NAME
    619   MYSQL_OPT_LOCAL_INFILE
    620   MYSQL_OPT_PROTOCOL
    621   MYSQL_SHARED_MEMORY_BASE_NAME
    622   MYSQL_OPT_READ_TIMEOUT
    623   MYSQL_OPT_WRITE_TIMEOUT
    624   MYSQL_OPT_USE_RESULT
    625   MYSQL_OPT_USE_REMOTE_CONNECTION
    626   MYSQL_OPT_USE_EMBEDDED_CONNECTION
    627   MYSQL_OPT_GUESS_CONNECTION
    628   MYSQL_SET_CLIENT_IP
    629   MYSQL_SECURE_AUTH
    630   MYSQL_REPORT_DATA_TRUNCATION)
    631 
    632 (gen-public-enum mysql-type
    633   MYSQL_TYPE_DECIMAL
    634         MYSQL_TYPE_TINY
    635   MYSQL_TYPE_SHORT
    636   MYSQL_TYPE_LONG
    637   MYSQL_TYPE_FLOAT
    638   MYSQL_TYPE_DOUBLE
    639   MYSQL_TYPE_NULL
    640   MYSQL_TYPE_TIMESTAMP
    641   MYSQL_TYPE_LONGLONG
    642   MYSQL_TYPE_INT24
    643   MYSQL_TYPE_DATE
    644   MYSQL_TYPE_TIME
    645   MYSQL_TYPE_DATETIME
    646         MYSQL_TYPE_YEAR
    647   MYSQL_TYPE_NEWDATE
    648         MYSQL_TYPE_VARCHAR
    649   MYSQL_TYPE_BIT
    650   MYSQL_TYPE_NEWDECIMAL
    651   MYSQL_TYPE_ENUM
    652   MYSQL_TYPE_SET
    653   MYSQL_TYPE_TINY_BLOB
    654   MYSQL_TYPE_MEDIUM_BLOB
    655   MYSQL_TYPE_LONG_BLOB
    656   MYSQL_TYPE_BLOB
    657   MYSQL_TYPE_VAR_STRING
    658   MYSQL_TYPE_STRING
    659   MYSQL_TYPE_GEOMETRY)
    660 
    661 (gen-public-enum mysql-field-flags
    662   NOT_NULL_FLAG
    663   PRI_KEY_FLAG
    664   UNIQUE_KEY_FLAG
    665   MULTIPLE_KEY_FLAG
    666   UNSIGNED_FLAG
    667   ZEROFILL_FLAG
    668   BINARY_FLAG
    669   AUTO_INCREMENT_FLAG
    670   NO_DEFAULT_VALUE_FLAG
    671   NUM_FLAG
    672   ; deprecated
    673   ENUM_FLAG
    674   SET_FLAG
    675   BLOB_FLAG
    676   TIMESTAMP_FLAG)
    677 
    678678(gen-public-enum mysql-client-flags
    679679  CLIENT_LONG_PASSWORD
     
    696696
    697697;-----------------------------------------------------------------------
    698 ; MySQL C Structures API
    699 ;
    700 
     698; C Structures
     699;
     700
     701; not "mysql-field-ptr", named so getters have nice name.
    701702(define-foreign-record (mysql-field "MYSQL_FIELD")
    702703  (rename: c-name->scheme-name)
     
    723724  (mysql-type type) )                   ; Type of field. See mysql_com.h for types
    724725
     726; not "my-charset-info-ptr", named so getters have nice name.
    725727(define-foreign-record (my-charset-info "MY_CHARSET_INFO")
    726728  (rename: c-name->scheme-name)
     
    737739;
    738740
    739 (define UNSIGNED-LONG-SIZE (foreign-value "sizeof(unsigned long)" int))
     741(define-constant UNSIGNED-LONG-SIZE 4)
    740742
    741743
     
    774776}
    775777<#
    776 
    777 ; just to be specific
    778 (define-foreign-type my-ulonglong number)
    779778
    780779; 24.2.3.1. mysql_affected_rows()
     
    898897;
    899898
    900 ; just to be specific
    901 (define-foreign-type my-bool bool)
    902 
    903899; 24.2.3.2. mysql_change_user()
    904900; my_bool mysql_change_user(MYSQL *mysql, const char *user,
     
    980976;   MYSQL_FIELD_OFFSET offset)
    981977(define foreign-mysql-field-seek
    982   (foreign-lambda unsigned-integer "mysql_field_seek" mysql-res-ptr
    983                   unsigned-integer))
     978  (foreign-lambda mysql-field-offset "mysql_field_seek" mysql-res-ptr
     979                  mysql-field-offset))
    984980
    985981; 24.2.3.22. mysql_field_tell()
    986982; MYSQL_FIELD_OFFSET mysql_field_tell(MYSQL_RES *result)
    987983(define foreign-mysql-field-tell
    988   (foreign-lambda unsigned-integer "mysql_field_tell" mysql-res-ptr))
     984  (foreign-lambda mysql-field-offset "mysql_field_tell" mysql-res-ptr))
    989985
    990986; 24.2.3.23. mysql_free_result()
     
    17881784  (let ([numtypes (list mysql-type-decimal mysql-type-tiny mysql-type-short
    17891785                            mysql-type-long mysql-type-float mysql-type-double
    1790                         mysql-type-longlong mysql-type-int24
    1791                         mysql-type-newdecimal)])
     1786                        mysql-type-longlong mysql-type-newdecimal
     1787                        mysql-type-bit)])
    17921788    (lambda (fldptr)
    17931789      (apply mysql-field-type-any? fldptr numtypes) ) ) )
     
    18011797(define mysql-field-type-string?
    18021798  (let ([numtypes (list mysql-type-varchar mysql-type-var-string
    1803                         mysql-type-string)])
     1799                        mysql-type-string
     1800                        mysql-type-enum mysql-type-set)])
    18041801    (lambda (fldptr)
    18051802      (apply mysql-field-type-any? fldptr numtypes) ) ) )
  • release/3/mysql/trunk/mysql.scm

    r7943 r7948  
    400400        mysql-type-timestamp
    401401        mysql-type-longlong
    402         mysql-type-int24
    403402        mysql-type-date
    404403        mysql-type-time
     
    457456(define-foreign-type mysql-field-ptr (c-pointer "MYSQL_FIELD"))
    458457
    459 ; mysql-row-ptr represents the C type MYSQL_ROW, which is actually a char**,
    460 ; but we're just going to pass it to other mysql functions, hence the generic
    461 ; c-pointer.
    462 (define-foreign-type mysql-row c-pointer)
     458; MYSQL_ROW (we just pass it around, not def-ref'ed)
     459(define-foreign-type mysql-row (c-pointer (c-pointer char)))
     460
     461; my_ulonglong
     462(define-foreign-type my-ulonglong number)
     463
     464; my_bool
     465(define-foreign-type my-bool bool)
     466
     467; MYSQL_FIELD_OFFSET
     468(define-foreign-type mysql-field-offset unsigned-int)
    463469
    464470;-----------------------------------------------------------------------
    465 ; Private enumeration value constants
    466 ;
     471; Enumeration & flag value constants
     472;
     473
     474(define-macro (gen-public-enum ?typ . ?syms)
     475  `(begin
     476     ,@(map
     477        (lambda (sym)
     478          (if (pair? sym)
     479            `(define ,(car sym) ,(cadr sym))
     480            `(define ,(string->symbol (c-name->scheme-name (symbol->string sym))) ,sym)))
     481        ?syms)
     482     (define (,(string->symbol (string-append (symbol->string ?typ) "-value")) . syms)
     483       (,(string->symbol (string-append (symbol->string ?typ) "->number")) syms))
     484     (define (,(string->symbol (string-append (symbol->string ?typ) "-symbol")) val)
     485       (,(string->symbol (string-append "number->" (symbol->string ?typ))) val))) )
    467486
    468487(define-foreign-enum (mysql-server-option (enum "enum_mysql_set_option"))
     
    470489  MYSQL_OPTION_MULTI_STATEMENTS_ON
    471490  MYSQL_OPTION_MULTI_STATEMENTS_OFF )
     491
     492(gen-public-enum mysql-server-option
     493  MYSQL_OPTION_MULTI_STATEMENTS_ON
     494  MYSQL_OPTION_MULTI_STATEMENTS_OFF)
    472495
    473496(define-foreign-enum (mysql-option (enum "mysql_option"))
     
    494517  MYSQL_REPORT_DATA_TRUNCATION )
    495518
     519(gen-public-enum mysql-option
     520  MYSQL_OPT_CONNECT_TIMEOUT
     521  MYSQL_OPT_COMPRESS
     522  MYSQL_OPT_NAMED_PIPE
     523  MYSQL_INIT_COMMAND
     524  MYSQL_READ_DEFAULT_FILE
     525  MYSQL_READ_DEFAULT_GROUP
     526  MYSQL_SET_CHARSET_DIR
     527  MYSQL_SET_CHARSET_NAME
     528  MYSQL_OPT_LOCAL_INFILE
     529  MYSQL_OPT_PROTOCOL
     530  MYSQL_SHARED_MEMORY_BASE_NAME
     531  MYSQL_OPT_READ_TIMEOUT
     532  MYSQL_OPT_WRITE_TIMEOUT
     533  MYSQL_OPT_USE_RESULT
     534  MYSQL_OPT_USE_REMOTE_CONNECTION
     535  MYSQL_OPT_USE_EMBEDDED_CONNECTION
     536  MYSQL_OPT_GUESS_CONNECTION
     537  MYSQL_SET_CLIENT_IP
     538  MYSQL_SECURE_AUTH
     539  MYSQL_REPORT_DATA_TRUNCATION)
     540
    496541(define-foreign-enum (mysql-type (enum "enum_field_types"))
    497542  #f  ; No aliases!
     
    505550  MYSQL_TYPE_TIMESTAMP
    506551  MYSQL_TYPE_LONGLONG
    507   MYSQL_TYPE_INT24
    508552  MYSQL_TYPE_DATE
    509553  MYSQL_TYPE_TIME
     
    524568  MYSQL_TYPE_GEOMETRY )
    525569
     570(gen-public-enum mysql-type
     571  MYSQL_TYPE_DECIMAL
     572        MYSQL_TYPE_TINY
     573  MYSQL_TYPE_SHORT
     574  MYSQL_TYPE_LONG
     575  MYSQL_TYPE_FLOAT
     576  MYSQL_TYPE_DOUBLE
     577  MYSQL_TYPE_NULL
     578  MYSQL_TYPE_TIMESTAMP
     579  MYSQL_TYPE_LONGLONG
     580  MYSQL_TYPE_DATE
     581  MYSQL_TYPE_TIME
     582  MYSQL_TYPE_DATETIME
     583        MYSQL_TYPE_YEAR
     584  MYSQL_TYPE_NEWDATE
     585        MYSQL_TYPE_VARCHAR
     586  MYSQL_TYPE_BIT
     587  MYSQL_TYPE_NEWDECIMAL
     588  MYSQL_TYPE_ENUM
     589  MYSQL_TYPE_SET
     590  MYSQL_TYPE_TINY_BLOB
     591  MYSQL_TYPE_MEDIUM_BLOB
     592  MYSQL_TYPE_LONG_BLOB
     593  MYSQL_TYPE_BLOB
     594  MYSQL_TYPE_VAR_STRING
     595  MYSQL_TYPE_STRING
     596  MYSQL_TYPE_GEOMETRY)
     597
    526598(define-foreign-enum (mysql-field-flags unsigned-int)
    527599  #f  ; No aliases!
     
    541613  BLOB_FLAG                                             ; field is a blob
    542614  TIMESTAMP_FLAG        )                                                       ; field is a timestamp
     615
     616(gen-public-enum mysql-field-flags
     617  NOT_NULL_FLAG
     618  PRI_KEY_FLAG
     619  UNIQUE_KEY_FLAG
     620  MULTIPLE_KEY_FLAG
     621  UNSIGNED_FLAG
     622  ZEROFILL_FLAG
     623  BINARY_FLAG
     624  AUTO_INCREMENT_FLAG
     625  NO_DEFAULT_VALUE_FLAG
     626  NUM_FLAG
     627  ; deprecated
     628  ENUM_FLAG
     629  SET_FLAG
     630  BLOB_FLAG
     631  TIMESTAMP_FLAG)
    543632
    544633(define-foreign-enum (mysql-client-flags unsigned-int)
     
    587676        CLIENT_SSL )
    588677
    589 ;-----------------------------------------------------------------------
    590 ; Public enumeration value constants
    591 ;
    592 
    593 (define-macro (gen-public-enum ?typ . ?syms)
    594   `(begin
    595      ,@(map
    596         (lambda (sym)
    597           (if (pair? sym)
    598             `(define ,(car sym) ,(cadr sym))
    599             `(define ,(string->symbol (c-name->scheme-name (symbol->string sym))) ,sym)))
    600         ?syms)
    601      (define (,(string->symbol (string-append (symbol->string ?typ) "-value")) . syms)
    602        (,(string->symbol (string-append (symbol->string ?typ) "->number")) syms))
    603      (define (,(string->symbol (string-append (symbol->string ?typ) "-symbol")) val)
    604        (,(string->symbol (string-append "number->" (symbol->string ?typ))) val))) )
    605 
    606 (gen-public-enum mysql-server-option
    607   MYSQL_OPTION_MULTI_STATEMENTS_ON
    608   MYSQL_OPTION_MULTI_STATEMENTS_OFF)
    609 
    610 (gen-public-enum mysql-option
    611   MYSQL_OPT_CONNECT_TIMEOUT
    612   MYSQL_OPT_COMPRESS
    613   MYSQL_OPT_NAMED_PIPE
    614   MYSQL_INIT_COMMAND
    615   MYSQL_READ_DEFAULT_FILE
    616   MYSQL_READ_DEFAULT_GROUP
    617   MYSQL_SET_CHARSET_DIR
    618   MYSQL_SET_CHARSET_NAME
    619   MYSQL_OPT_LOCAL_INFILE
    620   MYSQL_OPT_PROTOCOL
    621   MYSQL_SHARED_MEMORY_BASE_NAME
    622   MYSQL_OPT_READ_TIMEOUT
    623   MYSQL_OPT_WRITE_TIMEOUT
    624   MYSQL_OPT_USE_RESULT
    625   MYSQL_OPT_USE_REMOTE_CONNECTION
    626   MYSQL_OPT_USE_EMBEDDED_CONNECTION
    627   MYSQL_OPT_GUESS_CONNECTION
    628   MYSQL_SET_CLIENT_IP
    629   MYSQL_SECURE_AUTH
    630   MYSQL_REPORT_DATA_TRUNCATION)
    631 
    632 (gen-public-enum mysql-type
    633   MYSQL_TYPE_DECIMAL
    634         MYSQL_TYPE_TINY
    635   MYSQL_TYPE_SHORT
    636   MYSQL_TYPE_LONG
    637   MYSQL_TYPE_FLOAT
    638   MYSQL_TYPE_DOUBLE
    639   MYSQL_TYPE_NULL
    640   MYSQL_TYPE_TIMESTAMP
    641   MYSQL_TYPE_LONGLONG
    642   MYSQL_TYPE_INT24
    643   MYSQL_TYPE_DATE
    644   MYSQL_TYPE_TIME
    645   MYSQL_TYPE_DATETIME
    646         MYSQL_TYPE_YEAR
    647   MYSQL_TYPE_NEWDATE
    648         MYSQL_TYPE_VARCHAR
    649   MYSQL_TYPE_BIT
    650   MYSQL_TYPE_NEWDECIMAL
    651   MYSQL_TYPE_ENUM
    652   MYSQL_TYPE_SET
    653   MYSQL_TYPE_TINY_BLOB
    654   MYSQL_TYPE_MEDIUM_BLOB
    655   MYSQL_TYPE_LONG_BLOB
    656   MYSQL_TYPE_BLOB
    657   MYSQL_TYPE_VAR_STRING
    658   MYSQL_TYPE_STRING
    659   MYSQL_TYPE_GEOMETRY)
    660 
    661 (gen-public-enum mysql-field-flags
    662   NOT_NULL_FLAG
    663   PRI_KEY_FLAG
    664   UNIQUE_KEY_FLAG
    665   MULTIPLE_KEY_FLAG
    666   UNSIGNED_FLAG
    667   ZEROFILL_FLAG
    668   BINARY_FLAG
    669   AUTO_INCREMENT_FLAG
    670   NO_DEFAULT_VALUE_FLAG
    671   NUM_FLAG
    672   ; deprecated
    673   ENUM_FLAG
    674   SET_FLAG
    675   BLOB_FLAG
    676   TIMESTAMP_FLAG)
    677 
    678678(gen-public-enum mysql-client-flags
    679679  CLIENT_LONG_PASSWORD
     
    696696
    697697;-----------------------------------------------------------------------
    698 ; MySQL C Structures API
    699 ;
    700 
     698; C Structures
     699;
     700
     701; not "mysql-field-ptr", named so getters have nice name.
    701702(define-foreign-record (mysql-field "MYSQL_FIELD")
    702703  (rename: c-name->scheme-name)
     
    723724  (mysql-type type) )                   ; Type of field. See mysql_com.h for types
    724725
     726; not "my-charset-info-ptr", named so getters have nice name.
    725727(define-foreign-record (my-charset-info "MY_CHARSET_INFO")
    726728  (rename: c-name->scheme-name)
     
    737739;
    738740
    739 (define UNSIGNED-LONG-SIZE (foreign-value "sizeof(unsigned long)" int))
     741(define-constant UNSIGNED-LONG-SIZE 4)
    740742
    741743
     
    774776}
    775777<#
    776 
    777 ; just to be specific
    778 (define-foreign-type my-ulonglong number)
    779778
    780779; 24.2.3.1. mysql_affected_rows()
     
    898897;
    899898
    900 ; just to be specific
    901 (define-foreign-type my-bool bool)
    902 
    903899; 24.2.3.2. mysql_change_user()
    904900; my_bool mysql_change_user(MYSQL *mysql, const char *user,
     
    980976;   MYSQL_FIELD_OFFSET offset)
    981977(define foreign-mysql-field-seek
    982   (foreign-lambda unsigned-integer "mysql_field_seek" mysql-res-ptr
    983                   unsigned-integer))
     978  (foreign-lambda mysql-field-offset "mysql_field_seek" mysql-res-ptr
     979                  mysql-field-offset))
    984980
    985981; 24.2.3.22. mysql_field_tell()
    986982; MYSQL_FIELD_OFFSET mysql_field_tell(MYSQL_RES *result)
    987983(define foreign-mysql-field-tell
    988   (foreign-lambda unsigned-integer "mysql_field_tell" mysql-res-ptr))
     984  (foreign-lambda mysql-field-offset "mysql_field_tell" mysql-res-ptr))
    989985
    990986; 24.2.3.23. mysql_free_result()
     
    17881784  (let ([numtypes (list mysql-type-decimal mysql-type-tiny mysql-type-short
    17891785                            mysql-type-long mysql-type-float mysql-type-double
    1790                         mysql-type-longlong mysql-type-int24
    1791                         mysql-type-newdecimal)])
     1786                        mysql-type-longlong mysql-type-newdecimal
     1787                        mysql-type-bit)])
    17921788    (lambda (fldptr)
    17931789      (apply mysql-field-type-any? fldptr numtypes) ) ) )
     
    18011797(define mysql-field-type-string?
    18021798  (let ([numtypes (list mysql-type-varchar mysql-type-var-string
    1803                         mysql-type-string)])
     1799                        mysql-type-string
     1800                        mysql-type-enum mysql-type-set)])
    18041801    (lambda (fldptr)
    18051802      (apply mysql-field-type-any? fldptr numtypes) ) ) )
Note: See TracChangeset for help on using the changeset viewer.