Found an issue in SpiderBasic ? Please report it here !
DanLJr
 
Posts: 41
Joined: Wed Jul 04, 2018 4:24 am

Re: ArraySize() doesn't properly reflect the Array's size (B

by DanLJr Tue Nov 13, 2018 3:48 pm

Continuing along this line, when I update the same code to use ProcedureDLL, the Example file then compiles, but throws runtime errors instead of returning the expected results:

Here is my debug output when I run the "corrected" (changing the routines within the cgi block to ProcedureDLL from just Procedure):

error: error/
error: error/
undefined
undefined

myPbCgiProcedure3Callback
Success: false
Result: error/

myPbCgiProcedure4Callback
Success: false
Result: error/

Here is the exact copy/paste of the code that reports the above:

Code: Select all
; either include "SpiderBite.sbi":
; XIncludeFile "[YourPathTo]/SpiderBite.sbi"
;
; ... or copy "SpiderBite.res" to SpiderBasics Residents-Folder

#SpiderBite_Profile = "default"

Procedure myPbCgiProcedure3Callback(Success, Result.s)
 
  Debug ""
  Debug "myPbCgiProcedure3Callback"
  Debug "Success: " + Success
  Debug "Result: " + Result
 
EndProcedure

Procedure myPbCgiProcedure4Callback(Success, Result.s)
 
  Debug ""
  Debug "myPbCgiProcedure4Callback"
  Debug "Success: " + Success
  Debug "Result: " + Result
 
EndProcedure

EnablePbCgi
 
  ProcedureDLL.s myPbCgiProcedure1()
    ProcedureReturn "Hello from myPbCgiProcedure1"
  EndProcedure
 
  ProcedureDLL.s myPbCgiProcedure2(Message.s)
    ProcedureReturn "Hello from " + Message
  EndProcedure
 
  ProcedureDLL.s myPbCgiProcedure3()
    ProcedureReturn "Hello from myPbCgiProcedure3"
  EndProcedure
 
  ProcedureDLL.s myPbCgiProcedure4(Message.s)
    ProcedureReturn "Hello from " + Message
  EndProcedure
 
DisablePbCgi

Debug myPbCgiProcedure1()                    ; without callback, without parameter
Debug myPbCgiProcedure2("myPbCgiProcedure2") ; without callback, with parameter

Debug myPbCgiProcedure3()                    ; with callback, without parameter
Debug myPbCgiProcedure4("myPbCgiProcedure4") ; with callback, with parameter

If 1=2
  myPbCgiProcedure3Callback(0, "")
  myPbCgiProcedure4Callback(0, "")
EndIf


Please help! I just don't understand the results. (Plus, with bad code in the sample to begin with, I'm just not sure what else might be wrong here.)

Appreciated, and thanks in advance for your continued assistance.
-Dan
DanLJr
 
Posts: 41
Joined: Wed Jul 04, 2018 4:24 am

Re: ArraySize() doesn't properly reflect the Array's size (B

by DanLJr Tue Nov 13, 2018 4:17 pm

A little insight...

If I run this code in PureBasic:

Code: Select all
Procedure.s GetAssessmentName()

  UsePostgreSQLDatabase()

  If OpenDatabase(0, "host=localhost 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

Debug GetAssessmentName()


I get the following result from the Debug window:

Connected to PostgreSQL
Hello from GetAssessmentName

Therefore, I know my code is right connecting to the DB. Please help me understand why my code isn't providing similar results running in SB with SpiderBite. (Though, the example file's callbacks all seem to report weird errors in debug, too, so I'm not sure what's up overall here...)

Thanks for your help!
-Dan
DanLJr
 
Posts: 41
Joined: Wed Jul 04, 2018 4:24 am

Re: ArraySize() doesn't properly reflect the Array's size (B

by DanLJr Tue Nov 13, 2018 4:29 pm

Ok, Peter, so... I seem to be fixing/discovering solutions as fast as I can ask the questions! LOL...

After adjusting my code (and the Example code) to use ProcedureDLL (instead of just Procedure) within the cgi block, I was able to get it all working. The last set of errors I was receiving was because my local webserver had crashed on my dev machine, so it wasn't running! (Once I restarted it, I started getting EXPECTED results - yay!)

One thing I recommend that would be a HUGE help to new SpiderBite users would be to a) update the Example Files so the code is correctly using the ProcedureDLL where required. That was VERY confusing to a newbie. (Incorrect examples are a sure-fire way to turn people off to the product, and it's such a good product overall!) And b) Maybe mention that a local webserver running and properly configured for SpiderBite is ESSENTIAL for running anything using the cgi backend. (Honestly, I was assuming that everything ran containined in development using SB, but clearly that is not the case. It took me HOURS until I finally looked into the webserver issue and noticed it was down. Restart and "boom!" - it all worked as expected.)

I'll keep you informed, but I THINK I worked it out at this point. Again, my #1 suggest is to correct those Examples though! Bad Examples created a ton of confusion for me. (If I'm wrong about anything I'm saying here, please set me right... I'm just sharing my experiences and my deductions from this situation.)

Once again, Peter, thanks so much for everything, and I'm now looking forward to getting deeper into my app dev project at hand using SB/PB and SpiderBite. This is so cool!

I get the following result from the Debug window:

Connected to PostgreSQL
Hello from GetAssessmentName

Therefore, I know my code is right connecting to the DB. Please help me understand why my code isn't providing similar results running in SB with SpiderBite. (Though, the example file's callbacks all seem to report weird errors in debug, too, so I'm not sure what's up overall here...)

Thanks for your help!
-Dan
User avatar
Peter
 
Posts: 552
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1

Re: ArraySize() doesn't properly reflect the Array's size (B

by Peter Tue Nov 13, 2018 4:57 pm

DanLJr wrote:Ok, Peter, so... I seem to be fixing/discovering solutions as fast as I can ask the questions! LOL...

Sometimes it's worth waiting a little before answering. ;)

I'm glad you found the solution on your own.

Greetings ... Peter
DanLJr
 
Posts: 41
Joined: Wed Jul 04, 2018 4:24 am

Re: ArraySize() doesn't properly reflect the Array's size (B

by DanLJr Tue Nov 13, 2018 6:35 pm

Thanks, Peter!

Now, I have a different question I think you might actually be able to answer. (Not sure if this would be considered a spiderbite question per se, but hopefully you have an easy answer for me - all related to my current projects using spiderbite…)

It looks like I have the PostgreSQL stuff working now. However, as a small piece of what I am doing I will also need to connect to a MySQL database. According to the documentation, it looks like all of the other databases use ODBC to connect. How do I set up a connection without ODBC, since I am developing in windows, but the PB/CGI back and will be running on a Linux server? (Any examples? Anything to point me in the right direction?)

I greatly appreciate your input, yet once again, Peter!

-Dan

P.S. I must say that once this is all working and I understand how to utilize everything, this is a very powerful web-front-end/client–server solution.

If you guys worked with Fred to package spiderbasic, purebasic, and spiderbite into a single, preconfigured installation, I think you would have a complete solution that rivals stuff like visual studio – and 100% in a purely BASIC core with extensibility, of course! I mean, things are awesome as they are, but if you be in this process easier for people to get up and running, you really could take over the development market for BASIC programmers looking for full stack, cross-platform development.

I am very excited, and I would love to see this complete solution taken to the next level and grow in popularity.

P.P.S. If you could get PureVision in the loop, too, you could have a fully integrated, high-quality form designer included as well, and VB.NET really wouldn't have much of anything over this solution.

Anyhow, keep up the good work, I am very excited about the future!

( I await your reply on the above MySQL question.)
User avatar
Peter
 
Posts: 552
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1

Re: ArraySize() doesn't properly reflect the Array's size (B

by Peter Tue Nov 13, 2018 10:17 pm

Hello DanLJr,

since Version 5.70 LTS beta 2 PureBasic supports MySQL and MariaDB natively. There's no need for ODBC for this DB-Systems anymore.

See: https://www.purebasic.fr/english/viewtopic.php?p=522762#p522762

I also think that PureBasic and SpiderBasic make a good combination to cover the server part as well as the client part sufficiently and comfortably. But in the end it's Fred's decision if and how he combines both programming languages.

Greetings ... Peter
DanLJr
 
Posts: 41
Joined: Wed Jul 04, 2018 4:24 am

Re: ArraySize() doesn't properly reflect the Array's size (B

by DanLJr Wed Nov 14, 2018 12:51 am

Peter wrote:since Version 5.70 LTS beta 2 PureBasic supports MySQL and MariaDB natively. There's no need for ODBC for this DB-Systems anymore.

See: https://www.purebasic.fr/english/viewtopic.php?p=522762#p522762


Ah! I'm on PB v5.62. That explains it. (I was going to mention that I was not seeing it in the F1 Help, but yeah...)

Awesome to hear. Thanks!
DanLJr
 
Posts: 41
Joined: Wed Jul 04, 2018 4:24 am

Re: ArraySize() doesn't properly reflect the Array's size (B

by DanLJr Thu Nov 22, 2018 3:00 am

Peter,

Now that I've been coding/building apps for a little bit with SB/PB/SB, I have a question... Is there a pre-designed way to persist values on the server between calls from the client? (Something like session variables that you might see in other languages? I was hoping to load some global working arrays into memory server-side to access as needed without having to query the database for everything - I'm going to experiment, but I noticed that Static and Global variables don't keep their values between client-side/SB calls, so I'm assuming everything is pretty much fall-through...client-side/SB code calls server-side/PB code like a brand new session every time, so we need to init DB connections, etc. each time. Thoughts? Guidance?)

Also, how about a way to use/emulate cookies to uniquely ID a client session in-case of temporary connection loss/refresh/bumped-back-button, etc?

Lastly, and related to the above, is there a way to use a URL with passed arguments, for example, to return to a pre-designated location within the code? (Like firing an event and passing a parameter with what was read from a URL-passed-variable, so we can pick up where we left off via some sort of URL/link-check?)

All-in-all though it's going well, and it's pretty powerful just as it is now!

Appreciatively,

-Dan L.

Peter wrote:I also think that PureBasic and SpiderBasic make a good combination to cover the server part as well as the client part sufficiently and comfortably ... Peter
Return to Bugs Reports

Who is online

Users browsing this forum: No registered users and 1 guest