Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3768136
D1237.id3184.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
677 B
Referenced Files
None
Subscribers
None
D1237.id3184.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 06:46 (10 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2259432
Default Alt Text
D1237.id3184.diff (677 B)
Attached To
Mode
D1237: Allow to read MySQL credentials from my.cnf
Attached
Detach File
Event Timeline
Log In to Comment