Search found 769 matches

by swhite
Wed Sep 03, 2025 8:40 pm
Forum: General Discussion
Topic: CheckDatabaseNull() Question
Replies: 2
Views: 400

Re: CheckDatabaseNull() Question


Procedure.i dBRecord(Map tmRec.dBValue(),tnDb.i=#dCDatabaseNo)
Define ln.i
ClearMap(tmRec())

For ln=0 To DatabaseColumns(tnDb)-1
Select DatabaseColumnType(tnDb,ln)
Case #PB_Database_String
If CheckDatabaseNull(tnDb,ln)
tmRec(DatabaseColumnName(tnDb,ln))\ValueS = ""
Else
tmRec ...
by swhite
Tue Sep 02, 2025 4:21 pm
Forum: General Discussion
Topic: CheckDatabaseNull() Question
Replies: 2
Views: 400

CheckDatabaseNull() Question

Hi

When I use the CheckDatabaseNull() function I always see the following message in the console window:

row number -1 is out of range 0..-1

I am using Postgres as the database. Is this an error message of some kind or can it be safely ignored? The function is working correctly so I am ...
by swhite
Fri Aug 29, 2025 2:56 pm
Forum: General Discussion
Topic: Is PureBasic dead?
Replies: 21
Views: 2123

Re: Is PureBasic dead?

Hi

It is definitely not dead and very useful. If you want web based applications you can choose SpiderBasic or you can use PB with https://webui.me which is what I have done with some projects.

Simon
by swhite
Fri Aug 29, 2025 2:52 pm
Forum: Coding Questions
Topic: Serial Communication locking up.
Replies: 11
Views: 1165

Re: Serial Communication locking up.


I have been testing out the serial port feature in PB today, and i'm not having the greatest success.

This program: Port$ = "COM4"
If OpenSerialPort(1, Port$, 9600, #PB_SerialPort_NoParity, 8, 1, #PB_SerialPort_RtsCtsHandshake, 128, 128)
For x=1 To 10
WriteSerialPortString(1,"IS THIS WORKING ...
by swhite
Fri Aug 15, 2025 2:59 pm
Forum: General Discussion
Topic: How to Check Database Connection is still valid?
Replies: 9
Views: 719

Re: How to Check Database Connection is still valid?

Hi

I generally check the DatabaseQuery and report any errors. So I will check my code because I may have missed a spot and that may explain why my code is not handling the disconnect properly.

Thanks JHPJHP for all your input.

Simon
by swhite
Thu Aug 14, 2025 8:14 pm
Forum: General Discussion
Topic: How to Check Database Connection is still valid?
Replies: 9
Views: 719

Re: How to Check Database Connection is still valid?

Hi

I tried the code but it does not do what I need. I stepped through the code and just before executing the IF PQStatus() I restarted the Postgres server and it still reported the connection was successful.

Simon


Hi swhite,

I completely misread your first post, thanks spikey for the clarity ...
by swhite
Thu Aug 14, 2025 2:10 pm
Forum: General Discussion
Topic: How to Check Database Connection is still valid?
Replies: 9
Views: 719

Re: How to Check Database Connection is still valid?

Hi

I will look into PQStatus as I know that anything using a select statement will fail because that is the problem I am experiencing when the server is reset.

Thanks,
Simon
by swhite
Wed Aug 13, 2025 7:17 pm
Forum: General Discussion
Topic: How to Check Database Connection is still valid?
Replies: 9
Views: 719

How to Check Database Connection is still valid?

Hi

I had a situation where a Postgres Server was restarted and my application crashed even though I used the IsDatabase() function to check that #Database was valid. IsDatabase() continue to return a value despite the fact that the connection had been reset. Is there a way to detect when the ...
by swhite
Tue Aug 05, 2025 3:20 pm
Forum: Coding Questions
Topic: How to Receive File via REST that Requires a Header?
Replies: 5
Views: 394

Re: How to Receive File via REST that Requires a Header?


Hi swhite,

EDIT: Moved FreeMemory(*Buffer)

Try the following:
#AuthKey = "19044852-777D-4104-98C0-4BC48530A3F5"

URL$ = "https://beta.gvmunifi.com/api/sentinel/KARDTECHLAB1/updates/zip"
Host$ = GetURLPart(URL$, #PB_URL_Site)

NewMap Header$()
Header$("Host") = Host$
Header$("Authorization ...
by swhite
Fri Aug 01, 2025 8:33 pm
Forum: Coding Questions
Topic: How to Receive File via REST that Requires a Header?
Replies: 5
Views: 394

How to Receive File via REST that Requires a Header?

Hi

I want to access a REST API to download a file that requires a token in the "Authorization:" key. I cannot use ReceiveHTTPFile() because there is no option to include the token in the header. I tried using OpenNetworkConnection(), SendNetworkString and then ReceiveNetworkData. All I receive is ...
by swhite
Fri Aug 01, 2025 6:40 pm
Forum: Feature Requests and Wishlists
Topic: Header Support in ReceiveHTTPFile
Replies: 1
Views: 336

Header Support in ReceiveHTTPFile

Hi

I would like the ability to add headers to the ReceiveHTTPFile because sometimes an authorization key is needed before the file can be down loaded.

Thanks,
Simon
by swhite
Fri Aug 01, 2025 2:57 pm
Forum: The PureBasic Editor
Topic: Tab Key Issue.
Replies: 5
Views: 506

Re: Tab Key Issue.

PBJim wrote: Mon Jul 14, 2025 3:29 pm
swhite wrote: Mon Jul 14, 2025 2:49 pm Hi
I forgot to mention I am using Linux PB 6.20. This behavior does not happen in the Windows version. Simon
Ahh, sorry I can't help you there. I did wonder if you were a Linux man, but couldn't recall :?
I use both Windows and Linux equally that's what makes it so noticeable.
by swhite
Fri Aug 01, 2025 2:55 pm
Forum: Coding Questions
Topic: Is this a ReplaceString Bug?
Replies: 9
Views: 507

Re: Is this a ReplaceString Bug?

Hi

Thanks for all the responses.

I did realize that the solution was to use "while". It is not a problem if this is the expected behavior. However, it just caught me off guard in that I expected the search to continue from the last character replaced. I also cannot use BarryG's solution because ...
by swhite
Thu Jul 31, 2025 9:27 pm
Forum: The PureBasic Editor
Topic: IDE Suggestion for Debugging
Replies: 7
Views: 676

IDE Suggestion for Debugging

Hi

I would like to suggest that the "Kill Program" icon be used to start the "Compile With Debugger" and then used to kill the program being debugged.

The button should be a green X which you click to "Compile With Debugger" and then once the debugger is running it turns red and clicking the red X ...
by swhite
Thu Jul 31, 2025 2:39 pm
Forum: Coding Questions
Topic: Is this a ReplaceString Bug?
Replies: 9
Views: 507

Is this a ReplaceString Bug?

Hi

Is this a bug or not.

Code: Select all

lcTxt.s=",,,,,,,,"
lcTxt=ReplaceString(lcTxt,",,",",0,")
Debug lcTxt ; result ",0,,0,,0,,0," but expected ",0,0,0,0,0,0,0"