cannot get AHK query to work

Forum for users that want to write their own custom queries against the PT database either via the Structured Query Language (SQL) or using the PT3 custom stats/reports interface.

Moderator: Moderators

cannot get AHK query to work

Postby MaxWeiss » Thu Mar 27, 2008 4:54 am

Hello all. I am trying to get a list of players that I have 3K+ hands on, and exactly how many hands I have on them, into a text file using postresfunctions.ahk from overcards.com. For the life of me, I cannot get this to work. I don't suppose you all can tell me what is wrong with my query... I have made sure that all the info in the postgresfunctions file is correct, including the DB name. The text file that is created just shows up blank.

[code53h]sql := "SELECT p.player_name, COUNT(hhps.id_player) AS hands FROM player p, holdem_hand_player_statistics hhps WHERE p.id_player = hhps.id_player GROUP BY p.player_name HAVING COUNT(hhps.id_player) > 3000 ORDER BY COUNT(hhps.id_player) DESC;"

;//The rest of this is just AHK stuff, and I'm pretty sure the problem is in the query...
result := psql(sql)
desktoppath:="C:\Documents and Settings\Owner\desktop\"
FileAppend, %result%, %desktoppath%%A_Now%.txt
[/code53h]
MaxWeiss
 
Posts: 43
Joined: Sun Feb 10, 2008 10:40 pm

Re: cannot get AHK query to work

Postby advis0r » Thu Mar 27, 2008 7:45 am

the query works fine for me when running it with pgAdmin

i dunno what A_now is supposed to mean

do you realize that you usually will get back a result set when running the query? maybe FileAppend doesnt know how to append a SQL result to a file?

i dunno AHK that well, dave might help you ;)
advis0r
 
Posts: 137
Joined: Thu Jan 24, 2008 8:39 pm
Location: Southern Germany

Re: cannot get AHK query to work

Postby APerfect10 » Thu Mar 27, 2008 12:21 pm

[codejyt]desktoppath:="C:\Documents and Settings\Owner\desktop\"[/codejyt]

That may be the problem. The desktop has special permissions and AHK probably cannot access it. Try changing the file path to a different (non-desktop) directory and see if it works.

Best regards,

Derek
APerfect10
Site Admin
 
Posts: 4489
Joined: Sat Dec 08, 2007 6:03 pm

Re: cannot get AHK query to work

Postby MaxWeiss » Thu Mar 27, 2008 7:33 pm

The query works fine for you huh??? Interesting. I haven't tried it in PGAdmin, but I did try it without the FileAppend, and just told it to pop up with a message box with the result in it, and that still did not work which is what made me think there was something in my query. I have used that same code I showed you, except the query itself it slightly different, in order to query the PT2 database for the same thing and that worked just fine in every respect, so I assumed my query to the PT3 database was wrong, but if it did indeed work, I must be doing something wrong somewhere else! Thanks both for your replies!
MaxWeiss
 
Posts: 43
Joined: Sun Feb 10, 2008 10:40 pm

Re: cannot get AHK query to work

Postby MaxWeiss » Thu Mar 27, 2008 7:54 pm

OK I finally found out what that problem... In order to do the query, I am running a command line argument to psql.exe and in that I have

[code9jx]"C:\Program Files\PostgreSQL\8.2\bin\psql.exe" -A -t -h localhost -p 5432 -U postgres -d 'PT3 Beta DB1'[/code9jx]

And it does not like having the database in three words (PT3, Beta, and DB1), even with quotes or a single quote (apostrophe) used around it. I get the error message

[quote9jx]warning: extra command-line argument "Beta" ignored
warning: extra command-line argument "DB1'" ignored
FATAL: database "'PT3" does not exist[/quote9jx]

or I get the error message

[quote9jx]'C:\Program' is not recognized as an internal or external command,
operable program or batch file.[/quote9jx]

Is there an easy fix for that problem?? Apparently the command line thingy doesn't like spaces in names of things... I tried using "C:\Progra~1" but that didn't work either.
MaxWeiss
 
Posts: 43
Joined: Sun Feb 10, 2008 10:40 pm

Re: cannot get AHK query to work

Postby _dave_ » Thu Mar 27, 2008 8:00 pm

double quotes should work fine.

please rip the psql function out of AHK-HUD - I've probably fixed it in there but not updated postgresfunctions.AHK at some point.

Advisor: A_Now is an autohotkey system variable to retrieve the system clock time (like NOW() function in other languages)
_dave_
 
Posts: 1147
Joined: Sun Dec 09, 2007 6:19 pm

Re: cannot get AHK query to work

Postby MaxWeiss » Thu Mar 27, 2008 10:03 pm

Thanks for the idea Dave! I really appreciate your help.
MaxWeiss
 
Posts: 43
Joined: Sun Feb 10, 2008 10:40 pm


Return to Custom Stats, Reports, and SQL [Read Only]

Who is online

Users browsing this forum: No registered users and 8 guests