[plt-scheme] SrPersist and bind-parameter

From: Alex Peake (alex.peake at comac.com)
Date: Wed Feb 18 19:12:38 EST 2004

Could someone please help with this?

(define table-select
  (string-append
    "SELECT rel, attr, domain, domlength, domprec, nullable, PKCOLSEQNUM AS pkpos, fkpos, fktable,
fkattr "
    " FROM Gen_Schema, syspkconstraints PK"
    " WHERE Gen_Schema.rel = PK.Name (+)"
    " AND Gen_Schema.attr = PK.ColName (+)"
    " AND rel = ?"))

(define tname-buffer (make-buffer '(sql-c-char 18)))
(define tname-indicator (make-indicator))
(write-buffer! tname-buffer "INVENTORY")
(prepare hstmt table-select)
(bind-parameter hstmt 1 'sql-param-input 'sql-varchar 18 tname-buffer tname-indicator)
(sql-execute hstmt)

returns no rows, even though a check of tname-buffer reveals "INVENTORY". The database gets a NULL
binding - the parameter is empty.


and yet with:     " AND rel = 'INVENTORY'"))

I get all the appropriate rows.

I obviously have the process wrong, but cannot find what.

Alex



Posted on the users mailing list.