Hi all,
I am searching a lot but not able to settle with anything
Till date, I have worked with CSVs for storing and retrieving data, now need DB.
please help me with a DB and a command line DB tool to work with ahk.
working example would be highly appreciated.
Thank You in advance
any DataBase with AHK please Plus command line
-
- Posts: 313
- Joined: 23 Jan 2015, 01:49
Re: any DataBase with AHK please Plus command line
I would recommend SQlite
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
-
- Posts: 313
- Joined: 23 Jan 2015, 01:49
-
- Posts: 313
- Joined: 23 Jan 2015, 01:49
Re: any DataBase with AHK please Plus command line
Thanks "jNizM"
I am happy with sqlite3
I am stuck at a place, how to get the resultset from ahk script. I tried and is successful with only first query not second and third and so on...
I am attaching a sample script, and zip with all the resources to test it.
plz help. thanks in advance.
Zip with sqlite dll exe and test db
https://drive.google.com/open?id=0B3U5e ... k9rcDF5Vk0
I am happy with sqlite3
I am stuck at a place, how to get the resultset from ahk script. I tried and is successful with only first query not second and third and so on...
I am attaching a sample script, and zip with all the resources to test it.
plz help. thanks in advance.
Zip with sqlite dll exe and test db
https://drive.google.com/open?id=0B3U5e ... k9rcDF5Vk0
Code: Select all
#persistent
#SingleInstance Force
MsgBox % RunWaitOne(".help")
MsgBox % RunWaitOne(".open db.db `n select * from test;")
MsgBox % RunWaitMany(".help")
MsgBox % RunWaitMany(".open db.db `n select * from test;")
RunWaitOne(command) {
; WshShell object: http://msdn.microsoft.com/en-us/library/aew9yb99
shell := ComObjCreate("WScript.Shell")
; Execute a single command via cmd.exe
exec := shell.Exec("sqlite3.exe" " /C " command)
exec.StdIn.WriteLine(commands) ; Always exit at the end!
; Read and return the command's output
return exec.StdOut.ReadAll()
}
RunWaitMany(commands) {
shell := ComObjCreate("WScript.Shell")
; Open cmd.exe with echoing of commands disabled
exec := shell.Exec("sqlite3.exe" " /Q /K echo off")
; Send the commands to execute, separated by newline
exec.StdIn.WriteLine(commands) ; Always exit at the end!
; Read and return the output of all commands
return exec.StdOut.ReadAll()
}
Re: any DataBase with AHK please Plus command line
I'm not familiar with the WScript.Shell.Exec() method, so there might be other options, but this is working here:
Why do you want to use sqlite3.exe in this case?
Code: Select all
MsgBox % RunWaitOne(".open db.db`nselect * from test;")
RunWaitOne(command) {
; WshShell object: http://msdn.microsoft.com/en-us/library/aew9yb99
shell := ComObjCreate("WScript.Shell")
; Execute a single command via cmd.exe
exec := shell.Exec("sqlite3.exe")
exec.StdIn.WriteLine(command . "`n.quit") ; Always exit at the end!
; Read and return the command's output
return exec.StdOut.ReadAll()
}
-
- Posts: 313
- Joined: 23 Jan 2015, 01:49
Re: any DataBase with AHK please Plus command line
Thanks a lot "just me" & "jNizM"
I was unable to understand in which variables the output was stored from "SQLiteDB_sample.ahk" , spent nearly 4 days to figure out, and totally lost hope, so was trying luck with "sqlite3.exe."
Yday night figured out this:
I was unable to understand in which variables the output was stored from "SQLiteDB_sample.ahk" , spent nearly 4 days to figure out, and totally lost hope, so was trying luck with "sqlite3.exe."
Yday night figured out this:
Code: Select all
ShowTable(Table) {
Global
Local ColCount, RowCount, Row
MsgBox, 262144,%AppName% %A_LineNumber%, % ColCount "|" RowCount "|" Row
; GuiControl, -ReDraw, ResultsLV
LV_Delete()
Sleep 100
ColCount := LV_GetCount("Column")
MsgBox, 262144,ColCount %A_LineNumber%, % ColCount
Loop, %ColCount%
LV_DeleteCol(1)
MsgBox, 262144,%AppName% %A_LineNumber%, % Table.HasNames
If (Table.HasNames)
{
Loop, % Table.ColumnCount
{
LV_InsertCol(A_Index,"", Table.ColumnNames[A_Index])
MsgBox, 262144,%AppName% %A_LineNumber%, % Table.ColumnNames[A_Index]
}
If (Table.HasRows)
{
MsgBox, 262144,%AppName% %A_LineNumber%, % Table.RowCount
Loop, % Table.RowCount
{
RowCount := LV_Add("", "")
Table.Next(Row)
Loop, % Table.ColumnCount
{
LV_Modify(RowCount, "Col" . A_Index, Row[A_Index])
List1 .= RowCount "|" " Col" . A_Index "|" Row[A_Index] "`r`n"
}
MsgBox, 262144,%AppName% %A_LineNumber%, % List1
}
}
MsgBox, 262144,%AppName% %A_LineNumber%, % Table.ColumnCount
Loop, % Table.ColumnCount
LV_ModifyCol(A_Index, "AutoHdr")
}
GuiControl, +ReDraw, ResultsLV
}
Re: any DataBase with AHK please Plus command line
Hi ahklearner,
congratulations on finally finding a solution by yourself. If you have further questions, feel free to post them in the SQLite thread (unless they're a related to SQL syntax).
congratulations on finally finding a solution by yourself. If you have further questions, feel free to post them in the SQLite thread (unless they're a related to SQL syntax).