Page MenuHomeDevCentral

D1237.diff
No OneTemporary

D1237.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, 03:19 (42 m, 38 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2259432
Default Alt Text
D1237.diff (677 B)

Event Timeline