At Sat, 05 May 2018 14:37:54 +0200 Cecil Westerhof <
Ce...@decebal.nl> wrote:
>
> Just playing with 'file channels'. I wrote the following program:
> #!/usr/bin/env tclsh
>
> package require sqlite3
>
> puts "Start: [file channels]"
> set fileHndl [open dummy.txt]
> puts "Opened file: [file channels]"
> sqlite3 db dummy.sqlite
> puts "Opened db: [file channels]"
> puts "Version db: [db version]"
> db close
> close ${fileHndl}
> puts "End: [file channels]"
>
> This generates the following output:
> Start: stdin stdout stderr
> Opened file: stdin stdout stderr file3
> Opened db: stdin stdout stderr file3
> Version db: 3.16.2
> End: stdin stdout stderr
>
> After opening a file I see an extra channel as expected. But after
> open the sqlite3 database I do not see an extra channel.
> Why is this?
There is no "Tcl Channel" when the database is opened. The sqlite3 DB library
does that internally. The "file channels" is only going to report (return)
the channels *Tcl* knows about and were opened with the Tcl_Channel API. If a
extension library calls a C library function to open a file (eg open(),
creat(), fopen(), socket(), etc.), *Tcl* doesn't know about it, unless the
extension library is specificly using the Tcl_Channel API and exposing a
channel to Tcl that way.
>
--
Robert Heller --
978-544-6933
Deepwoods Software -- Custom Software Services
http://www.deepsoft.com/ -- Linux Administration Services
hel...@deepsoft.com -- Webhosting Services