You are viewing a plain text version of this content. The canonical link for it is here.
Posted to site-cvs@tcl.apache.org by mx...@apache.org on 2013/12/06 14:58:21 UTC
svn commit: r1548519 - in /tcl/rivet/trunk: ChangeLog doc/xml/install.xml
rivet/packages/dio/dio_Mysql.tcl rivet/packages/dio/dio_Postgresql.tcl
Author: mxmanghi
Date: Fri Dec 6 13:58:20 2013
New Revision: 1548519
URL: http://svn.apache.org/r1548519
Log:
* rivet/packages/dio/dio_Postgres.tcl: minor changes (code indentation revised)
* rivet/packages/dio/dio_Tdbc.tcl: experimental support for the tdbc
abstraction library
* doc/xml/install.xml: the manual still suggested to call make install-packages,
whereas 'make install' does everything now as it was before 2.1.2
Modified:
tcl/rivet/trunk/ChangeLog
tcl/rivet/trunk/doc/xml/install.xml
tcl/rivet/trunk/rivet/packages/dio/dio_Mysql.tcl
tcl/rivet/trunk/rivet/packages/dio/dio_Postgresql.tcl
Modified: tcl/rivet/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/ChangeLog?rev=1548519&r1=1548518&r2=1548519&view=diff
==============================================================================
--- tcl/rivet/trunk/ChangeLog (original)
+++ tcl/rivet/trunk/ChangeLog Fri Dec 6 13:58:20 2013
@@ -1,6 +1,13 @@
+2013-12-06 Massimo Manghi <mx...@apache.org>
+ * rivet/packages/dio/dio_Postgres.tcl: minor changes (code indentation revised)
+ * rivet/packages/dio/dio_Tdbc.tcl: experimental support for the tdbc
+ abstraction library
+ * doc/xml/install.xml: the manual still suggested to call make install-packages,
+ whereas 'make install' does everything now as it was before 2.1.2
+
2013-12-04 Massimo Manghi <mx...@apache.org>
* src/apache-2/apache_request.c: log message in ApacheRequest___parse()
- commented out
+ commented out (Bug #55845)
2013-12-03 Massimo Manghi <mx...@apache.org>
* src/apache-2/mod_rivet.c: Rivet template preprocessor symbols renamed in
Modified: tcl/rivet/trunk/doc/xml/install.xml
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/doc/xml/install.xml?rev=1548519&r1=1548518&r2=1548519&view=diff
==============================================================================
--- tcl/rivet/trunk/doc/xml/install.xml (original)
+++ tcl/rivet/trunk/doc/xml/install.xml Fri Dec 6 13:58:20 2013
@@ -75,23 +75,23 @@ tar -xvf rivet-X.X.X.tar.gz</programlist
<substeps>
<step>
<para>
- On Linux or Unix systems, Rivet uses the standard <command>./configure ; make ; make install
- (; make install-packages)</command>
- sequence.
+ On Linux or Unix systems, Rivet uses the standard <command>./configure ; make ; make install</command>
+ sequence which installs to their target directories the Apache module, the binary libraries and the
+ Tcl code
</para>
<para>
There are several rivet specific options to configure that might be useful (or needed):
<variablelist>
- <varlistentry>
- <term>--with-tcl</term>
- <listitem>
- <para>
- This points to the directory where the
- <filename>tclConfig.sh</filename> file is located.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
+ <varlistentry>
+ <term>--with-tcl</term>
+ <listitem>
+ <para>
+ This points to the directory where the
+ <filename>tclConfig.sh</filename> file is located.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
<term>--with-tclsh</term>
<listitem>
<para>This points to the location of the
Modified: tcl/rivet/trunk/rivet/packages/dio/dio_Mysql.tcl
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/rivet/packages/dio/dio_Mysql.tcl?rev=1548519&r1=1548518&r2=1548519&view=diff
==============================================================================
--- tcl/rivet/trunk/rivet/packages/dio/dio_Mysql.tcl (original)
+++ tcl/rivet/trunk/rivet/packages/dio/dio_Mysql.tcl Fri Dec 6 13:58:20 2013
@@ -86,8 +86,9 @@ namespace eval DIO {
return $obj
}
if {[catch {mysqlcol $conn -current name} fields]} { set fields "" }
- set obj [result Mysql -resultid $conn \
- -numrows [::list $error] -fields [::list $fields]]
+ set obj [result Mysql -resultid $conn \
+ -numrows [::list $error] \
+ -fields [::list $fields]]
return $obj
}
@@ -111,66 +112,72 @@ namespace eval DIO {
method handle {} {
if {![info exists conn] || ![mysqlping $conn]} { open }
-
return $conn
}
method makeDBFieldValue {table_name field_name val {convert_to {}}} {
- if {[info exists specialFields(${table_name}@${field_name})]} {
- switch $specialFields(${table_name}@${field_name}) {
- DATE {
- set secs [clock scan $val]
- set my_val [clock format $secs -format {%Y-%m-%d}]
- return "DATE_FORMAT('$my_val', '%Y-%m-%d')"
- }
- DATETIME {
- set secs [clock scan $val]
- set my_val [clock format $secs -format {%Y-%m-%d %T}]
- return "DATE_FORMAT('$my_val', '%Y-%m-%d %T')"
- }
- NOW {
- switch $convert_to {
- # we try to be coherent with the original purpose of this method whose
- # goal is to provide to the programmer a uniform way to handle timestamps.
- # E.g.: Package session expects this case to return a timestamp in seconds
- # so that differences with timestamps returned by [clock seconds]
- # can be done and session expirations are computed consistently.
- # (Bug #53703)
-
- SECS {
- if {[::string compare $val "now"] == 0} {
-# set secs [clock seconds]
-# set my_val [clock format $secs -format {%Y%m%d%H%M%S}]
-# return $my_val
- return [clock seconds]
- } else {
- return "UNIX_TIMESTAMP($field_name)"
- }
- }
- default {
- if {[::string compare $val, "now"] == 0} {
- set secs [clock seconds]
- } else {
- set secs [clock scan $val]
- }
+ if {[info exists specialFields(${table_name}@${field_name})]} {
+ switch $specialFields(${table_name}@${field_name}) {
+ DATE {
+ set secs [clock scan $val]
+ set my_val [clock format $secs -format {%Y-%m-%d}]
+ return "DATE_FORMAT('$my_val','%Y-%m-%d')"
+ }
+ DATETIME {
+ set secs [clock scan $val]
+ set my_val [clock format $secs -format {%Y-%m-%d %T}]
+ return "DATE_FORMAT('$my_val','%Y-%m-%d %T')"
+ }
+ NOW {
+ switch $convert_to {
+
+ # we try to be coherent with the original purpose of this method whose
+ # goal is endow the class with a uniform way to handle timestamps.
+ # E.g.: Package session expects this case to return a timestamp in seconds
+ # so that differences with timestamps returned by [clock seconds]
+ # can be done and session expirations are computed consistently.
+ # (Bug #53703)
+
+ SECS {
+ if {[::string compare $val "now"] == 0} {
+
+# set secs [clock seconds]
+# set my_val [clock format $secs -format {%Y%m%d%H%M%S}]
+# return $my_val
- # this is kind of going back and forth from the same
- # format,
+ return [clock seconds]
- #set my_val [clock format $secs -format {%Y-%m-%d %T}]
- return "FROM_UNIXTIME('$secs')"
+ } else {
+ return "UNIX_TIMESTAMP($field_name)"
}
}
- }
- default {
- # no special code for that type!!
- return "'[quote $val]'"
+ default {
+
+ if {[::string compare $val, "now"] == 0} {
+ set secs [clock seconds]
+ } else {
+ set secs [clock scan $val]
+ }
+
+ # this is kind of going back and forth from the same
+ # format,
+
+ #set my_val [clock format $secs -format {%Y-%m-%d %T}]
+ return "FROM_UNIXTIME('$secs')"
+ }
}
}
- } else {
+ default {
+ # no special code for that type!!
return "'[quote $val]'"
+ }
}
+
+ } else {
+ return "'[quote $val]'"
+ }
+
}
public variable db "" {
@@ -179,7 +186,7 @@ namespace eval DIO {
}
}
- public variable interface "Mysql"
+ public variable interface "Mysql"
private variable conn
} ; ## ::itcl::class Mysql
Modified: tcl/rivet/trunk/rivet/packages/dio/dio_Postgresql.tcl
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/rivet/packages/dio/dio_Postgresql.tcl?rev=1548519&r1=1548518&r2=1548519&view=diff
==============================================================================
--- tcl/rivet/trunk/rivet/packages/dio/dio_Postgresql.tcl (original)
+++ tcl/rivet/trunk/rivet/packages/dio/dio_Postgresql.tcl Fri Dec 6 13:58:20 2013
@@ -6,7 +6,7 @@
# 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
+# 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,
@@ -20,157 +20,157 @@ package provide dio_Postgresql 0.1
namespace eval DIO {
::itcl::class Postgresql {
- inherit Database
+ inherit Database
- constructor {args} {eval configure $args} {
- package require Pgtcl
- set_conn_defaults
- eval configure $args
- }
-
- destructor {
- close
- }
-
- ## Setup our variables with the default conninfo from Postgres.
- private method set_conn_defaults {} {
- foreach list [pg_conndefaults] {
- set var [lindex $list 0]
- set val [lindex $list end]
- switch -- $var {
- "dbname" { set db $val }
- default { set $var $val }
- }
- }
- }
-
- method open {} {
- set command "pg_connect"
-
- set info ""
- if {![lempty $user]} { append info " user=$user" }
- if {![lempty $pass]} { append info " password=$pass" }
- if {![lempty $host]} { append info " host=$host" }
- if {![lempty $port]} { append info " port=$port" }
- if {![lempty $db]} { append info " dbname=$db" }
-
- if {![lempty $info]} { append command " -conninfo [::list $info]" }
-
- if {[catch $command error]} { return -code error $error }
-
- set conn $error
- }
-
- method close {} {
- if {![info exists conn]} { return }
- pg_disconnect $conn
- unset conn
- }
-
- method exec {req} {
- if {![info exists conn]} { open }
-
- set command pg_exec
- if {[catch {$command $conn $req} result]} { return -code error $result }
-
- set errorinfo ""
- set obj [result Postgresql -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"]
- }
-
- method sql_limit_syntax {limit {offset ""}} {
- set sql " LIMIT $limit"
- if {![lempty $offset]} { append sql " OFFSET $offset" }
- return $sql
- }
-
- #
- # handle - return the internal database handle, in the postgres
- # case, the postgres connection handle
- #
- method handle {} {
- if {![info exists conn]} { open }
- return $conn
- }
-
-
- method makeDBFieldValue {table_name field_name val {convert_to {}}} {
- if {[info exists specialFields(${table_name}@${field_name})]} {
- switch $specialFields(${table_name}@${field_name}) {
- DATE {
- set secs [clock scan $val]
- set my_val [clock format $secs -format {%Y-%m-%d}]
- return "'$my_val'"
- }
- DATETIME {
- set secs [clock scan $val]
- set my_val [clock format $secs -format {%Y-%m-%d %T}]
- return "'$my_val'"
- }
- NOW {
- switch $convert_to {
+ constructor {args} {eval configure $args} {
+ package require Pgtcl
+ set_conn_defaults
+ eval configure $args
+ }
+
+ destructor {
+ close
+ }
+
+ ## Setup our variables with the default conninfo from Postgres.
+ private method set_conn_defaults {} {
+ foreach list [pg_conndefaults] {
+ set var [lindex $list 0]
+ set val [lindex $list end]
+ switch -- $var {
+ "dbname" { set db $val }
+ default { set $var $val }
+ }
+ }
+ }
+
+ method open {} {
+ set command "pg_connect"
+
+ set info ""
+ if {![lempty $user]} { append info " user=$user" }
+ if {![lempty $pass]} { append info " password=$pass" }
+ if {![lempty $host]} { append info " host=$host" }
+ if {![lempty $port]} { append info " port=$port" }
+ if {![lempty $db]} { append info " dbname=$db" }
+
+ if {![lempty $info]} { append command " -conninfo [::list $info]" }
+
+ if {[catch $command error]} { return -code error $error }
+
+ set conn $error
+ }
+
+ method close {} {
+ if {![info exists conn]} { return }
+ pg_disconnect $conn
+ unset conn
+ }
+
+ method exec {req} {
+ if {![info exists conn]} { open }
+
+ set command pg_exec
+ if {[catch {$command $conn $req} result]} { return -code error $result }
+
+ set errorinfo ""
+ set obj [result Postgresql -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"]
+ }
+
+ method sql_limit_syntax {limit {offset ""}} {
+ set sql " LIMIT $limit"
+ if {![lempty $offset]} { append sql " OFFSET $offset" }
+ return $sql
+ }
+
+ #
+ # handle - return the internal database handle, in the postgres
+ # case, the postgres connection handle
+ #
+ method handle {} {
+ if {![info exists conn]} { open }
+ return $conn
+ }
- # we try to be coherent with the original purpose of this method whose
- # goal is to provide to the programmer a uniform way to handle timestamps.
- # E.g.: Package session expects this case to return a timestamp in seconds
- # so that differences with timestamps returned by [clock seconds]
- # can be done and session expirations are computed consistently.
- # (Bug #53703)
-
- SECS {
- if {[::string compare $val "now"] == 0} {
-# set secs [clock seconds]
-# set my_val [clock format $secs -format {%Y%m%d%H%M%S}]
-# return $my_val
- return [clock seconds]
- } else {
- return "extract(epoch from $field_name)"
- }
- }
- default {
- if {[::string compare $val, "now"] == 0} {
- set secs [clock seconds]
- } else {
- set secs [clock scan $val]
- }
- # this is kind of going back and forth from the same
- # format,
+ method makeDBFieldValue {table_name field_name val {convert_to {}}} {
+ if {[info exists specialFields(${table_name}@${field_name})]} {
+ switch $specialFields(${table_name}@${field_name}) {
+ DATE {
+ set secs [clock scan $val]
+ set my_val [clock format $secs -format {%Y-%m-%d}]
+ return "'$my_val'"
+ }
+ DATETIME {
+ set secs [clock scan $val]
+ set my_val [clock format $secs -format {%Y-%m-%d %T}]
+ return "'$my_val'"
+ }
+ NOW {
+ switch $convert_to {
- return "'[clock format $secs -format {%Y-%m-%d %T}]'"
+ # we try to be coherent with the original purpose of this method whose
+ # goal is to provide to the programmer a uniform way to handle timestamps.
+ # E.g.: Package session expects this case to return a timestamp in seconds
+ # so that differences with timestamps returned by [clock seconds]
+ # can be done and session expirations are computed consistently.
+ # (Bug #53703)
+
+ SECS {
+ if {[::string compare $val "now"] == 0} {
+# set secs [clock seconds]
+# set my_val [clock format $secs -format {%Y%m%d%H%M%S}]
+# return $my_val
+ return [clock seconds]
+ } else {
+ return "extract(epoch from $field_name)"
}
}
- }
- default {
- # no special code for that type!!
- return "'[quote $val]'"
+ default {
+ if {[::string compare $val, "now"] == 0} {
+ set secs [clock seconds]
+ } else {
+ set secs [clock scan $val]
+ }
+
+ # this is kind of going back and forth from the same
+ # format,
+
+ return "'[clock format $secs -format {%Y-%m-%d %T}]'"
+ }
}
}
- } else {
+ default {
+ # no special code for that type!!
return "'[quote $val]'"
+ }
}
- }
-
-
- ## If they change DBs, we need to close the connection and re-open it.
- public variable db "" {
- if {[info exists conn]} {
- close
- open
- }
- }
+ } else {
+ return "'[quote $val]'"
+ }
+ }
+
+
+ ## If they change DBs, we need to close the connection and re-open it.
+ public variable db "" {
+ if {[info exists conn]} {
+ close
+ open
+ }
+ }
- public variable interface "Postgresql"
- private variable conn
+ public variable interface "Postgresql"
+ private variable conn
} ; ## ::itcl::class Postgresql
@@ -179,49 +179,49 @@ namespace eval DIO {
#
#
::itcl::class PostgresqlResult {
- inherit Result
+ inherit Result
- constructor {args} {
- eval configure $args
+ 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 numrows is zero, see if cmdrows returned anything and if it
- # did, put that in in place of numrows, hiding a postgresql
- # idiosyncracy from DIO
- if {$numrows == 0} {
- set cmdrows [pg_result $resultid -cmdTuples]
- if {$cmdrows != ""} {
- set numrows $cmdrows
- }
- }
-
- 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]
- }
+ 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 numrows is zero, see if cmdrows returned anything and if it
+ # did, put that in in place of numrows, hiding a postgresql
+ # idiosyncracy from DIO
+ if {$numrows == 0} {
+ set cmdrows [pg_result $resultid -cmdTuples]
+ if {$cmdrows != ""} {
+ set numrows $cmdrows
+ }
+ }
+
+ 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: site-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: site-cvs-help@tcl.apache.org