DatabaseQuery() - Long SQL Statement [Resolved]

Everything else that doesn't fall into one of the other PB categories.
User avatar
digital32
User
User
Posts: 23
Joined: Fri Dec 28, 2012 1:28 am

DatabaseQuery() - Long SQL Statement [Resolved]

Post by digital32 »

I'm running PB 5.46LTS and trying to do a query to a PostgreSQL DB. Simple queries with just a select and few where statements come back fine but I have a long SQL statement with a lot of joins and other functions that is not returning the right results. Using PGAdmin 4 the query runs fine. But it looks like the DatabaseQuery() function may be truncating my SQL statement.

My code seems to work fine for short SQL statements. But not for long statements. Am I over running the string or the DatabaseQuery() SQL request?

Protected QueryString.s
QueryString = "Select "
QueryString = QueryString + ".... "
QueryString = QueryString + ".... " (30 Lines of This)

OpenDatabase(0,...)
DatabaseQuery(0, QueryString)
While NextDatabaseRow(0) ; Loop for each records
Debug GetDatabaseString(0, 0) ; Display the content of the first field
Wend
FinishDatabaseQuery(0)
CloseDatabase(0)
Last edited by digital32 on Thu Feb 01, 2018 10:13 pm, edited 1 time in total.
User avatar
digital32
User
User
Posts: 23
Joined: Fri Dec 28, 2012 1:28 am

Re: DatabaseQuery() - Long SQL Statement

Post by digital32 »

Found the issue. PGAdmin 4 and other query tools ignore "--" that are comments in normal PostgreSQL SQL code.
For some reason DatabaseQuery() calls with the the same "--" are not being ignored by PostgreSQL or the DatabaseQuery.
Post Reply