Forum OpenACS Q&A: NSTCL. Using ODBC Driver

Posted by Simon at TCB on
Hello all!

I wonder if anyone can give me a little heads-up on nstcl. (assuming its ok to post here)

I'm thinking of using it to drive and ODBC database (SQL Server 2000). I've installed the 1.0 version (latest I think) and got it working ok (ish), but I wondered if anyone has used it in anger in a similar setup.

The reason I ask is that I noticed what may be a bug in that rows returned from ODBC/SQL Server are numbered from '-1' up, rather than from 0 as nstcl expects.

Perhaps this is my ignorance of ODBC, or perhaps its a Microshitism but if anyone can offer *any* advice it would be most welcome.

Simon Millward

PS, its all running on XP Pro (well, running is a bit generous. Its rebooting a lot)

Posted by Michael A. Cleverly on

IIRC (and I haven't used nstcl with ODBC much myself, other than general proof-of-concept--my personal use being limited to Postgres, Solid, Oracle, and SQLite), this was a bug that has been corrected in either nstcl 1.1 or 1.2.

You can grab nstcl 1.2 from

Posted by Simon at TCB on
Many thanks Michael. Works a treat.

I assume you got my earlier email to you. Just checking whether there are any limitations/problems I need to be aware of.

Once again thanks. I juts don't know how I survive without db_foreach these days ;o)

Posted by Simon at TCB on
Oh No..

I've just discovered that db_foreach (and others) are not setting variables in the calling context. i.e. I do a db_foreach like {select myId from myTable}

but referencing myId just throws an error complaining the variable doesn't exist.

Does anyone have any thoughts?

Thanksin advance

Posted by Simon at TCB on
No hang on, I've got it. The database calls all do a string tolower on column/variable names so my variable 'myVar' actually gets set in the calling context to 'myvar'