For Programmers: Free Programming Magazines  


Home > Archive > Tcl > November 2007 > tcl sql - snippet









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author tcl sql - snippet
Chuck

2007-11-04, 10:15 pm

Hi, by following the documentation, I got "invalid command name
SQLConnect", boring....

By setting the namespace prefix, I got this snippet work fine (tcl8.4,
XP, Firebird 2.0)

Here is the code (you need to define first the ODBC DSN with the dba
and password as welll as the sample database location)

package require SQL

set odbc [SQL::SQLConnect Employees "" "" 10]
set rc [$odbc SQLSetStmtAttr SQL_ATTR_QUERY_TIMEOUT 5]
set rc [$odbc SQLSetStmtAttr SQL_ATTR_MAX_ROWS 1000]
$odbc SQLExecDirect "select * from employee"
$odbc SQLFetchAll results headers
foreach z $results {
puts $z
}
puts $headers
$odbc SQLDisconnect


I'llbe glad to hear somebody using this package and hear your
experiences, regards, Carlos

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com