Jeff Godfrey schrieb:
----- Original Message ----- From: "Michael Schlenker" <[EMAIL PROTECTED]>
set dataType [$db onecolumn {select typeof($colName) from $table}]
should do what you want. Note the {} instead of the "", which prevent
early substitution, so sqlite can use the $colName as a bind variable.
Michael
Hi Michael,
Yeah, I agree that makes sense from a Tcl standpoint. In fact, that's
exactly what I started with. Unfortunately, it doesn't work as expected
and just returns the following:
Error: near "$table": syntax error
So, the curly-braces are preventing the Tcl parser from substituting the
vars (as they should), but then SQLite doesn't substitute the $table var
for some reason. I guess I'm a bit unclear on exactly *what* SQLite is
capable of substituting with regard to Tcl variables. It only seems
capable of substituting variables in certain cases, or certain
locations, or ??? I'm not sure.
Looks like it does not allow variable substitution for identifiers, just
for literal values. The docs for db eval state it.
As a workaround try this:
set datatype [db eval onecolumn \
[format {select typeof($colName) from %s} $table]]
--
Michael Schlenker
Software Engineer
CONTACT Software GmbH Tel.: +49 (421) 20153-80
Wiener Straße 1-3 Fax: +49 (421) 20153-41
28359 Bremen
http://www.contact.de/ E-Mail: [EMAIL PROTECTED]
Sitz der Gesellschaft: Bremen | Geschäftsführer: Karl Heinz Zachries
Eingetragen im Handelsregister des Amtsgerichts Bremen unter HRB 13215
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------