"Jeff Godfrey" <[EMAIL PROTECTED]> wrote:
> Hi All,
> 
> I'm trying to determine the datatype of a given column using Tcl and the 
> following code snippet...
> 
> set dataType [$db onecolumn "select typeof($colName) from $table"]
> 

Try this:

   set quotedColName [string subst {" ""} $colName]
   set dataType [$db onecolumn "SELECT typeof(\"$quotedColName\") FROM $table"]

Note you will also need to quote $table if it contains spaces or
special characters.

You cannot use curly brackes, like this:

   set datatype [$db onecolumn {SELECT typeof($colName) FROM $table}]

The reason is that TCL variable names are only allowed in places 
where you can put a host parameter "?".  In face, TCL variable
names are just another way of writing SQL host parameters.  Before
evaluating each statement, TCL checks for host parameter names and
binds the values of corresponding TCL variables to those parameters.

The TCL interface is working correctly and as designed.
--
D. Richard Hipp  <[EMAIL PROTECTED]>


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to