Hey Peter, I'm finally coding away with DB/PB/SpiderBite. (I tried PMing you about this issue, but my messages got stuck in Outbox. ) Hopefully you see this post here - sorry if this ends up as a cross/duplicate-post with PM or another thread. I looked around, but couldn't find a better place to post/discuss. I appreciate any insights/help you can offer on this, and I would like to thank you in advance for anything you can do to get me on the right track ASAP:
Here is the text from the PM (copied/pasted directly)...
Peter,
You've been a big help in the past, and I thought I'd just write you directly about this one, as I couldn't find a good existing topic on the forums, or perhaps I just missed it. (If I learn something valuable here, once resolved, I will share the results with the forum.)
Anyhow, here is my question...
I am having an issue using the server-side PB database code in my SB/PB/Spiderbite web-client/PBcgi-server app. It simply won't compile/run. It reports the error: 'UsePostgreSQLDatabase() is not a function, array, list, map, or macro.' How do I make this work?
The code is below. Locally, my DB info was right, so it should work, but it's not even getting that far. I'm pretty sure that Spiderbite is setup correctly, as it does recognize EnablePbCgi and such, but maybe something else is messed-up? (SpiderBite.res is in the correct location, so not that.) Again, EnablePbCgi was NOT working before adding the SpiderBite.res file to the Residents folder/ Adding it DID seem to make EnablePbCgi work, but UsePostgreSQLDatabase() is still not be recognized as valid, and of course it's a valid PB function, and necessary for my server-side DB stuff.
What I'm doing below is incredibly basic right now... just trying to verify that I can connect to the DB!
What am I doing wrong here?
- Code: Select all
#SpiderBite_Profile = "default"
#SAMainWindowID = 0
#SAPostgreSQLConnection = 0
Declare Hello()
Declare.s GetAssessmentName()
Declare GetAssessmentNameCallback(Success, Result.s)
Procedure Hello()
OpenWindow(#SAMainWindowID, 0, 0, 0, 0, "Testing and Assessment Center", #PB_Window_Background)
EndProcedure
EnablePbCgi
Procedure.s GetAssessmentName()
UsePostgreSQLDatabase()
If OpenDatabase(0, "hostaddr=127.0.0.1 port=5432 dbname=skytests_assessments_db", "skytests_assessments_dbusr", "testingPW!0987")
Debug "Connected to PostgreSQL"
Else
Debug "Connection failed: " + DatabaseError()
EndIf
ProcedureReturn "Hello from GetAssessmentName"
EndProcedure
DisablePbCgi
Procedure GetAssessmentNameCallback(Success, Result.s)
Debug ""
Debug "GetAssessmentNameCallback"
Debug "Success: " + Success
Debug "Result: " + Result
EndProcedure
If 1=2
GetAssessmentNameCallback(0, "")
EndIf
Thanks in advance for your help, Peter!