Not printing in debug

Just starting out? Need help? Post your questions and find answers here.
JaxMusic
User
User
Posts: 20
Joined: Sun Feb 14, 2021 2:55 am
Location: Max Meadows, Virginia, USA
Contact:

Not printing in debug

Post by JaxMusic »

Code: Select all

  
  Sql.s  ;SQL string For commands
  DBName.s ;Database name

  
  ;Get row count
  Sql="Select count(PersonName) As RowCount from Test_names"
  DBName="Test.sqlite"
  Debug DBName
  Debug Sql 
Honestly I do not get this. I assign some values to variable, both strings, both declared.
At first, neither of these Debug statements appeared in the debug window. Restarted the IDE, the DBName would show up but the Sql variable would not. Restarted the IDE again, and now both show up. What is going on here? Thanks.
Axolotl
Addict
Addict
Posts: 802
Joined: Wed Dec 31, 2008 3:36 pm

Re: Not printing in debug

Post by Axolotl »

Hi JaxMusic,

I checked your code. It works.
Please look at Menu Debugger | Use Debugger -- maybe the Menuitem is not checked.

Hint:
I recomment the use of EnableExplicit and Define or Global.

Code: Select all

EnableExplicit 

Define Sql.s  ;SQL string For commands
Global DBName.s ;Database name
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
JaxMusic
User
User
Posts: 20
Joined: Sun Feb 14, 2021 2:55 am
Location: Max Meadows, Virginia, USA
Contact:

Re: Not printing in debug

Post by JaxMusic »

Axolotl wrote:Hi JaxMusic,

I checked your code. It works.
Please look at Menu Debugger | Use Debugger -- maybe the Menuitem is not checked.

Hint:
I recomment the use of EnableExplicit and Define or Global.

Code: Select all

EnableExplicit 

Define Sql.s  ;SQL string For commands
Global DBName.s ;Database name
I checked that before posting and it was enabled. Strange behavior.
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4789
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: Not printing in debug

Post by Fangbeast »

Tried your code 8 times, debug worked every time. On the rare occasion that I've had strange problems with debug on this machine, it was always with the 64 bit version of pb. Other people may not have any problems though.

Tried the way below, still debugs. I am always using the x86 version of pb as I never have any strange problems like this with it. That's my personal experience though.

Code: Select all

UseSQLiteDatabase()

EnableExplicit

Define.s  Sql.s     = "Select count(PersonName) As RowCount from Test_names"    ; SQL string For commands
Define.s  DBName.s  = "Test.sqlite"                                             ; Database name

Debug DBName
Debug Sql 
Also tried the below, still debugs on this machine

Code: Select all

UseSQLiteDatabase()

EnableExplicit

Global.s  Sql.s     = "Select count(PersonName) As RowCount from Test_names"    ; SQL string For commands
Global.s  DBName.s  = "Test.sqlite"                                             ; Database name

Debug DBName
Debug Sql 
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
JaxMusic
User
User
Posts: 20
Joined: Sun Feb 14, 2021 2:55 am
Location: Max Meadows, Virginia, USA
Contact:

Re: Not printing in debug

Post by JaxMusic »

Fangbeast wrote:Tried your code 8 times, debug worked every time. On the rare occasion that I've had strange problems with debug on this machine, it was always with the 64 bit version of pb. Other people may not have any problems though.

Tried the way below, still debugs. I am always using the x86 version of pb as I never have any strange problems like this with it. That's my personal experience though.

Code: Select all

UseSQLiteDatabase()

EnableExplicit

Define.s  Sql.s     = "Select count(PersonName) As RowCount from Test_names"    ; SQL string For commands
Define.s  DBName.s  = "Test.sqlite"                                             ; Database name

Debug DBName
Debug Sql 
Also tried the below, still debugs on this machine

Code: Select all

UseSQLiteDatabase()

EnableExplicit

Global.s  Sql.s     = "Select count(PersonName) As RowCount from Test_names"    ; SQL string For commands
Global.s  DBName.s  = "Test.sqlite"                                             ; Database name

Debug DBName
Debug Sql 

Yes, the code works. It worked after I restarted PB the second time. Hopefully these things are rare. I wasted a lot of time commenting out code and testing what looks like a bug in either the IDE or compiler.
Post Reply