XOSql base component
currently supported base interfaces: mysqltcl, postgres, odbctcl and dbitotcl.
Base Usage Example
1) Connecting mysql
set obj [Sqlinterface loadInterface mysqltcl]
$obj connect {user root dbank mydb}
puts [$obj queryList {select * from mytab}]
2) Connection per tk dialog
set obj [IDEDBConnectDialog setConnectionOn]
See documentation of all methods and classes to get all informations
hompage: http://www.xdobry.de/xosql
XOSql is GPL Software
and comes with ABSOLUTELY NO WARRANTY
See the GNU General Public License for more details.
See file LICENSE for more details
Abstract interface (abstract wrapper interface)
to sql commands handle such function as
1. sql queries
2. sql execute
3. connecting database
4. query metainformation as tables names
5. inserting row (handle primary key)
The interface use so called query objects that are normal xotcl objects.
Following methods are public API
-getconnectionargs
-connect
-diconnect
-isConnected
-hasfunction
-hasDatabase
-escape
-errorMessage
-execute
-returnAffectedRows
-insertRow
-query
-queryList
All interface errors can be read from parameter errorMessage
Instprocs:
connect {par_list}
Await a list of connection parameter for example
{user root db xotcllib}
Use array get to generate such list from array
disconnect {}
disconnect the database connection
The destroing interface object also desconnct from database
escape {string}
mask all sql string by replacing string delmiter with \
for example
sder"ewr - adef\"eer
execute {sql}
execute sql command
if returnAffectedRows anser 1 (yes) the the result
is the number of rows that are affected by the command
getconnectargs {}
return information about connection parameters
list of list with elements
name of argument
type of argument (text integer password)
default of argument
hasfunction {func}
check if the interface or query object support function with name
Insert row and try to compute the autoid for primary key.
The implementation is dependend from undelying base interface
mysql supports autoid, postgres has sequencer
by odbc und sqlite special sequencer database are used
isConnected {}
return the state of connection
query {sql}
return query object see API to
MySql::SqlQuerry to get all documentation
empty string is return if error occurs. The error message can be
retrieve by interface parameter ($interface errorMessage)
Warning!
All queries must be destroyed to free query resource
queryList {sql}
Return result of query statement as Tcl list
returnAffectedRows {}
inform with 1 or 0 if method execute
returns the number of affected rows by DELETE, UPDATE or INSERT statements
Procs:
getInterfaces {}
Return list of list of all supported interfaces
the sublists have elements:
tcl-interface name
xosql name
xosql interface class
base interface package
getInterfacesCleaned {}
Same as getInterfaces method but
not return interfaces that are not installed on the system
getInterfacesNames {}
Get names of all supported interfaces
getInterfacesNamesCleaned {}
Same as getInterfacesNames method but
not return interfaces that are not installed on the system
loadInterface {name}
Load interface with name (same as specified returned from
getInterfacesNames) and return the interface class.
It is factory method for sql interfaces