You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rivet-dev@tcl.apache.org by da...@apache.org on 2004/04/21 19:05:10 UTC
cvs commit: tcl-rivet/rivet/packages/dio dio_Sqlite.tcl pkgIndex.tcl
davidw 2004/04/21 10:05:09
Modified: . ChangeLog
rivet/packages/dio pkgIndex.tcl
Added: rivet/packages/dio dio_Sqlite.tcl
Log:
* rivet/packages/dio/pkgIndex.tcl: Add sqlite interface.
* rivet/packages/dio/dio_Sqlite.tcl: Added incomplete sqlite
interface to DIO.
Revision Changes Path
1.175 +7 -0 tcl-rivet/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /home/cvs/tcl-rivet/ChangeLog,v
retrieving revision 1.174
retrieving revision 1.175
diff -u -r1.174 -r1.175
--- ChangeLog 14 Apr 2004 18:32:25 -0000 1.174
+++ ChangeLog 21 Apr 2004 17:05:09 -0000 1.175
@@ -1,3 +1,10 @@
+2004-04-21 David N. Welton <da...@dedasys.com>
+
+ * rivet/packages/dio/pkgIndex.tcl: Add sqlite interface.
+
+ * rivet/packages/dio/dio_Sqlite.tcl: Added incomplete sqlite
+ interface to DIO.
+
2004-04-14 David N. Welton <da...@dedasys.com>
* rivet/packages/dio/dio.tcl: Removed mysql and postgres specific
1.3 +1 -0 tcl-rivet/rivet/packages/dio/pkgIndex.tcl
Index: pkgIndex.tcl
===================================================================
RCS file: /home/cvs/tcl-rivet/rivet/packages/dio/pkgIndex.tcl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- pkgIndex.tcl 14 Apr 2004 13:39:02 -0000 1.2
+++ pkgIndex.tcl 21 Apr 2004 17:05:09 -0000 1.3
@@ -2,3 +2,4 @@
package ifneeded DIODisplay 1.0 [list source [file join $dir diodisplay.tcl]]
package ifneeded dio_Mysql 0.1 [list source [file join $dir dio_Mysql.tcl]]
package ifneeded dio_Postgresql 0.1 [list source [file join $dir dio_Postgresql.tcl]]
+package ifneeded dio_Sqlite 0.1 [list source [file join $dir dio_Sqlite.tcl]]
1.1 tcl-rivet/rivet/packages/dio/dio_Sqlite.tcl
Index: dio_Sqlite.tcl
===================================================================
# dio_Sqlite.tcl -- DIO interface for sqlite
# Copyright 2004 The Apache Software Foundation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# $Id: dio_Sqlite.tcl,v 1.1 2004/04/21 17:05:09 davidw Exp $
package provide dio_Sqlite 0.1
namespace eval DIO {
::itcl::class Sqlite {
inherit Database
private variable dbcmd ""
private variable dbname sqlitedb
constructor {args} {eval configure $args} {
package require sqlite
eval configure $args
}
destructor {
catch { $dbcmd close }
}
method open {} {
::sqlite [::itcl::scope dbcmd] $db
set db [::itcl::scope dbcmd]
}
method close {} {
catch { $dbcmd close }
}
method exec {req} {
if { $dbcmd == "" } {
open
}
if { [catch {$dbcmd eval $req} result] } {
return -code error $result
}
set errorInfo ""
set obj [result sqlite -resultid $result]
if {[$obj error]} {
set errorinfo [$obj errorinfo]
}
return $obj
}
method nextkey {} {
return [$this string "select nextval( '$sequence' )"]
}
method lastkey {} {
return [$this string "select last_value from $sequence"]
}
## If they change DBs, we need to close the connection and re-open it.
public variable db "" {
if {[info exists conn]} {
close
open
}
}
}
# THIS BIT IS UNFINISHED XXX.
::itcl::class SqliteResult {
inherit Result
constructor {args} {
eval configure $args
if {[lempty $resultid]} {
return -code error "No resultid specified while creating result"
}
set numrows [pg_result $resultid -numTuples]
set fields [pg_result $resultid -attributes]
set errorcode [pg_result $resultid -status]
set errorinfo [pg_result $resultid -error]
if {$errorcode != "PGRES_COMMAND_OK" \
&& $errorcode != "PGRES_TUPLES_OK"} { set error 1 }
## Reconfigure incase we want to overset the default values.
eval configure $args
}
destructor {
pg_result $resultid -clear
}
method clear {} {
pg_result $resultid -clear
}
method nextrow {} {
if {$rowid >= $numrows} { return }
return [pg_result $resultid -getTuple $rowid]
}
} ; ## ::itcl::class PostgresqlResult
}
---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-cvs-help@tcl.apache.org