需要OS-X和Windows + SQLite跨平台开发环境的建议
我需要一个简单的维护程序在 OS-X 和 Windows 机器上运行以更新 SQLite 数据库,一次。
用例:
在 OS-X 和 Windows 上对应用程序的 SQLite 数据库进行数据库维护。
要求
- 用于选择 SQLite 数据库和目录的文件对话框的简单 GUI
- 没有安装运行时环境。
- 适用于 Windows 和 OS-X 的相同代码
- 这就是我不喜欢 Java 的原因,因为在新版本的 OS-X 上没有安装 Java
- 支持 SQLite。需要根据某些逻辑运行多个 SQL 脚本
- 用户应该只启动和停止应用程序,选择系统某处的本地 SQLite 数据库并启动维护程序 = 脚本。
- (数据库管理工具对用户来说太复杂了)
- 开源、免费软件或免费用于商业用途
一次性维护,越简单越好
我最适合使用哪种开发环境?
最佳答案
我建议你使用 Tcl/Tk。
- SQlite began as Tcl extension
- SQlite 扩展由 SQlite 作者维护。
- Tcl/Tk 适用于许多平台。
- Tk 是一个古老但仍在维护、不断发展的 GUI 工具包。
- 您可以将代码包装在 Starpack 中,一个包含所有内容的可执行文件:Tcl/Tk 运行时、SQlite 扩展、您的脚本。
- Tcl/Tk 是根据 BSD 样式许可获得许可的。
这里是 GUI 的示例脚本。
package require Tk
package require sqlite3
ttk::label .lbldb -text "Database:"
ttk::entry .db -textvariable db
set db {}
ttk::button .seldb -command seldb -text "..."
grid .lbldb .db .seldb -sticky nesw -columnspan 2
ttk::label .lbldir -text "Directory:"
ttk::entry .dir -textvariable dir
set dir {}
ttk::button .seldir -command seldir -text "..."
grid .lbldir .dir .seldir -sticky nesw -columnspan 2
ttk::button .go -command go -text "Go!" -default active
ttk::button .exit -command exit -text "Exit"
grid .go .exit -sticky nesw -columnspan 3
grid columnconfigure . 2 -weight 1
grid columnconfigure . 3 -weight 1
grid rowconfigure . 2 -weight 1
proc seldb {} {
set res [tk_getOpenFile -initialfile $::db]
if {$res ne {}} {
set ::db $res
}
}
proc seldir {} {
set res [tk_chooseDirectory -initialdir $::dir]
if {$res ne {}} {
set ::dir $res
}
}
proc go {} {
# Connect with the database
sqlite3 db $::db
# Do some stuff...
}
关于windows - 需要建议 : simple cross platform (OS-X and Windows) + SQLite development without installation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17475311/