[plt-scheme] SrPersist and bind-parameter

From: Alex Peake (alex.peake at comac.com)
Date: Thu Feb 19 14:40:51 EST 2004

This is a variable parameter. This is done so you can compile the query once, and rebind the
variable to different values (usually in a loop). This is typical stuff with databases (and so
ODBC).

And of course this is the part causing the difficulty.

Alex

> -----Original Message-----
> From: ifconfig [mailto:ifconfignslookup at hotmail.com]
> Sent: Thursday, February 19, 2004 11:29 AM
> To: Alex Peake; plt-scheme at list.cs.brown.edu
> Subject: Re: [plt-scheme] SrPersist and bind-parameter
>
>
> Why the "AND rel = ?"?
>
> ifconfig
> BAGOS
> http://bagos.sourceforge.net
>
>
> ----- Original Message -----
> From: "Alex Peake" <alex.peake at comac.com>
> To: <plt-scheme at list.cs.brown.edu>
> Sent: Thursday, February 19, 2004 2:12 AM
> Subject: [plt-scheme] SrPersist and bind-parameter
>
>
> >   For list-related administrative tasks:
> >   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> >
> > 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.