Page MenuHomeDevCentral

D1237.id3177.diff
No OneTemporary

D1237.id3177.diff

diff --git a/Core.tcl b/Core.tcl
--- a/Core.tcl
+++ b/Core.tcl
@@ -282,6 +282,29 @@
sql "SELECT LAST_INSERT_ID()"
}
+proc sqlconnect {{sqlinstance "sql"} {defaultsfile ""}} {
+ if {$defaultsfile == ""} {
+ global env
+ set defaultsfile $env(HOME)/.my.cnf
+ }
+
+ set config [readmycnf $defaultsfile]
+ $sqlinstance connect [dict get $config host] [dict get $config user] [dict get $config password]
+}
+
+proc readmycnf {defaultsfile} {
+ set config {}
+ set fd [open $defaultsfile]
+ while {[gets $fd line] != -1} {
+ set entry [split $line =]
+ if {[llength $entry] == 2} {
+ dict set config {*}$entry
+ }
+ }
+ close $fd
+ return $config
+}
+
#
# Registry
#

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 07:46 (18 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2259432
Default Alt Text
D1237.id3177.diff (677 B)

Event Timeline