This is an automated email from the ASF dual-hosted git repository.

mxmanghi pushed a commit to branch quattuor
in repository https://gitbox.apache.org/repos/asf/tcl-rivet.git

commit 0d5b56687d9ff258fe976ca4c8759453e8e84898
Author: Massimo Manghi <mxman...@apache.org>
AuthorDate: Tue Mar 9 12:28:27 2021 +0100

    patching various packages applying changes made in master
---
 rivet/packages/dio/dio.tcl               |  8 ++++-
 rivet/packages/dio/dio_Mysql.tcl         | 35 ++++++++++++++++++--
 rivet/packages/formbroker/formbroker.tcl | 55 +++++++++++++++++---------------
 3 files changed, 70 insertions(+), 28 deletions(-)

diff --git a/rivet/packages/dio/dio.tcl b/rivet/packages/dio/dio.tcl
index 2906a96..4aaa476 100644
--- a/rivet/packages/dio/dio.tcl
+++ b/rivet/packages/dio/dio.tcl
@@ -617,7 +617,7 @@ proc handle {interface args} {
     method exec    {args} {}
     method nextkey {args} {}
     method lastkey {args} {}
-    method now {} {}
+    method now     {}     {}
 
     ##
     ## Functions to get and set public variables.
@@ -648,6 +648,12 @@ proc handle {interface args} {
     public variable host        ""
     public variable port        ""
 
+    protected method handle_client_arguments {cargs} { }
+
+    public variable clientargs  "" {
+        handle_client_arguments $clientargs
+    }
+
     public variable keyfield    "" {
         if {[llength $keyfield] > 1 && $autokey} {
             return -code error "Cannot have autokey and multiple keyfields"
diff --git a/rivet/packages/dio/dio_Mysql.tcl b/rivet/packages/dio/dio_Mysql.tcl
index d9a85ad..aa1ca05 100644
--- a/rivet/packages/dio/dio_Mysql.tcl
+++ b/rivet/packages/dio/dio_Mysql.tcl
@@ -19,7 +19,7 @@
 
 # $Id$
 
-package provide dio_Mysql 0.3
+package provide dio_Mysql 0.4
 
 namespace eval DIO {
     ::itcl::class Mysql {
@@ -28,7 +28,7 @@ namespace eval DIO {
         constructor {args} {eval configure $args} {
             if {       [catch {package require Mysqltcl}]   \
                     && [catch {package require mysqltcl}]   \
-                    && [catch {package require mysql}   ] } {
+                    && [catch {package require mysql}] } {
                 return -code error "No MySQL Tcl package available"
             }
 
@@ -53,6 +53,14 @@ namespace eval DIO {
             if {![::rivet::lempty $pass]} { lappend command -password $pass }
             if {![::rivet::lempty $port]} { lappend command -port $port }
             if {![::rivet::lempty $host]} { lappend command -host $host }
+            #if {![::rivet::lempty $encoding]} { lappend command -encoding 
$encoding }
+
+            if {$clientargs != ""} {
+                set command [lappend command {*}$clientargs]
+            }
+
+            #puts stderr "evaluating $command"
+
             if {[catch $command error]} { return -code error $error }
 
             set conn $error
@@ -198,6 +206,29 @@ namespace eval DIO {
             }
         }
 
+        protected method handle_client_arguments {cargs} { 
+
+            # we assign only the accepted options
+
+            set clientargs {}
+
+            foreach {a v} $cargs {
+
+                if {($a == "-encoding") || \
+                    ($a == "-localfiles") || \
+                    ($a == "-ssl") || \
+                    ($a == "-sslkey") || \
+                    ($a == "-sslcert") || \
+                    ($a == "-sslca") || \
+                    ($a == "-sslcapath") || \
+                    ($a == "-sslcipher") || \
+                    ($a == "-socket")} {
+                    lappend clientargs $a $v
+                }
+
+            }
+        }
+
         public  variable interface "Mysql"
         private variable conn
 
diff --git a/rivet/packages/formbroker/formbroker.tcl 
b/rivet/packages/formbroker/formbroker.tcl
index 3edca9b..f81363f 100644
--- a/rivet/packages/formbroker/formbroker.tcl
+++ b/rivet/packages/formbroker/formbroker.tcl
@@ -1,7 +1,7 @@
 # -- formbroker.tcl
 # 
-# Form validation and sanitation tool. Kindly donated by
-# Karl Lehenbauer (Flightaware.com)
+# Form validation and sanitation tool. Developed starting from
+# code initially donated by Karl Lehenbauer (Flightaware.com)
 #
 # Copyright 2017 The Rivet Team
 #
@@ -25,7 +25,7 @@
 namespace eval FormBroker {
     variable form_definitions   [dict create]
     variable form_list          [dict create]
-    variable string_quote       force_quote
+    variable string_quoting     force_quote
     variable form_count         0
     #
     # response_security_error - issue an error with errorCode
@@ -104,7 +104,7 @@ namespace eval FormBroker {
         force_sanitize_response_strings response {*}$args
 
         foreach var $args {
-            set response($var) [$string_quote $response($var)]
+            set response($var) [$string_quoting $response($var)]
         }
 
     }
@@ -122,7 +122,7 @@ namespace eval FormBroker {
         require_response_vars response {*}$args
 
         foreach var $args {
-            set response($var) [$string_quote $response($var)]
+            set response($var) [$string_quoting $response($var)]
         }
 
     }
@@ -303,19 +303,19 @@ namespace eval FormBroker {
 
         set value [dict get $variable_d var] 
         if {[dict get $variable_d force_quote] || $force_quote_var} {
-            set value  [$string_quote $value]
+            set value  [$string_quoting $value]
         }
         return $valid
     }
 
-    # -- constrain_bounds
+    # -- bounds_consistency
     #
     # During the form creation stage this method is called
     # to correct possible inconsistencies with a field bounds 
     # definition
     #
 
-    proc constrain_bounds {field_type _bounds} {
+    proc bounds_consistency {field_type _bounds} {
         upvar $_bounds bounds
 
         switch $field_type {
@@ -457,10 +457,10 @@ namespace eval FormBroker {
     proc validate { form_name args } {
         variable form_definitions
         variable form_list
-        variable string_quote
+        variable string_quoting
 
         set force_quote_vars 0
-        set arguments        $args
+        set arguments $args
         if {[llength $arguments] == 0} { 
             error "missing required arguments" 
         } elseif {[llength $arguments] > 3} {
@@ -531,7 +531,7 @@ namespace eval FormBroker {
 
                 if {[dict get $variable_d force_quote] || $force_quote_vars} {
 
-                    set response_a($var)  [$string_quote [dict get $variable_d 
var]]
+                    set response_a($var)  [$string_quoting [dict get 
$variable_d var]]
 
                 }
             }
@@ -570,7 +570,7 @@ namespace eval FormBroker {
                     set response($var_name) $var
                 } elseif {[info exists default]} {
                     set response($var_name) $default
-                } 
+                }
 
             }
 
@@ -594,7 +594,7 @@ namespace eval FormBroker {
     # -- destroy
     #
     # this method is designed to be called
-    # by an 'trace unset' event on the variable
+    # by a 'trace unset' event on the variable
     # keeping the form description object. 
     #
 
@@ -629,7 +629,7 @@ namespace eval FormBroker {
         variable form_definitions
         variable form_list
         variable form_count
-        variable string_quote
+        variable string_quoting
 
         set form_name "form${form_count}"
         incr form_count
@@ -637,10 +637,10 @@ namespace eval FormBroker {
         catch { namespace delete $form_name }
         namespace eval $form_name {
 
-            foreach cmd { validate failing      \
-                          form_definition       \
-                          result validate_var   \
-                          destroy validation_error \
+            foreach cmd { validate failing          \
+                          form_definition           \
+                          result validate_var       \
+                          destroy validation_error  \
                           response reset } {
                 lappend cmdmap $cmd [list [namespace parent] $cmd [namespace 
tail [namespace current]]]
             }
@@ -656,7 +656,7 @@ namespace eval FormBroker {
                                                           form_validation 
FB_OK  \
                                                           failing         {}   
  \
                                                           default         ""   
  \
-                                                          quoting         
$string_quote]
+                                                          quoting         
$string_quoting]
 
         while {[llength $args]} {
 
@@ -671,7 +671,7 @@ namespace eval FormBroker {
                         error [list RIVET INVALID_QUOTING_PROC \
                                           "Non existing quoting proc 
'$quoting'"]
                     }
-                    set string_quote $quoting
+                    set string_quoting $quoting
                 }
                 continue
 
@@ -734,16 +734,15 @@ namespace eval FormBroker {
 
                 while {[llength $e] > 0} {
                     set e [::lassign $e field_spec]
-                    
                     switch $field_spec {
                         check_routine -
                         validator {
                             set e [::lassign $e validator]
                         }
-                        length -
+                        maxlength -
                         bounds {
                             set e [::lassign $e bounds]
-                            constrain_bounds $field_type bounds
+                            bounds_consistency $field_type bounds
                         }
                         default {
                             set e [::lassign $e default]
@@ -788,10 +787,16 @@ namespace eval FormBroker {
         return [namespace current]::$form_name 
     }
 
-    proc form_exists {form_cmd} {
+    # -- form_exists
+    #
+    # check the existence of the form named 'form_name' in the form broker
+    # database. The check is done by simply checking one of dictionaries that
+    # keep the internal database of form definitions
+
+    proc form_exists {form_command_name} {
         variable form_definitions
 
-        return [dict exists $form_definitions [namespace tail $form_cmd]]
+        return [dict exists $form_definitions [namespace tail 
$form_command_name]]
     }
 
     proc creategc {varname args} {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@tcl.apache.org
For additional commands, e-mail: commits-h...@tcl.apache.org

Reply via email to