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)
DatabaseQuery() - Long SQL Statement [Resolved]
DatabaseQuery() - Long SQL Statement [Resolved]
Last edited by digital32 on Thu Feb 01, 2018 10:13 pm, edited 1 time in total.
Re: DatabaseQuery() - Long SQL Statement
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.
For some reason DatabaseQuery() calls with the the same "--" are not being ignored by PostgreSQL or the DatabaseQuery.