SQL script pre-processing

<< Click to Display Table of Contents >>

Navigation:  SQL > SQL scripts >

SQL script pre-processing

Previous pageReturn to chapter overviewNext page

Clean Up Complex Comment Markings

As the BDE database engine basically does not process SQL scripts (SQL batch commands), the cleaning of SQL scripts is a mandatory pre-processing of the scripts before being parsed into individual statements, which are successively passed to the BDE database engine.

The parsing into individual statements is based on each statement being terminated by a semicolon.

Thus commenting (inactivating part of the code) spanning more than within single sub statements will prevent proper parsing unless all comments have been cleared before parsing.
As an example

INSERT INTO TableA VALUES (1,25,'abc');
INSERT INTO TableA VALUES (2,26,'def');
/* INSERT INTO TableA VALUES (3,27,'ghi');
INSERT INTO TableA VALUES (4,28,'jkl'); */
INSERT INTO TableA VALUES (5,29,'mno');

this script without pre-processing clearing comments, will yield e.g.:

/* INSERT INTO TableA VALUES (3,27,'ghi');

and

INSERT INTO TableA VALUES (4,28,'jkl'); */

which as individual statements will each raise an execution error due to the non-paired start (/*) and end (*/) comment markers respectively.

However clearing the following en bloc solves this issue:

/* INSERT INTO TableA VALUES (3,27,'ghi');
INSERT INTO TableA VALUES (4,28,'jkl'); */

Pre-processing syntax

The PdxEditor interpretation (and hence comments removal) follows the comments handling syntax of MySQL and SQLite,
whereas nested comments (/*.../*...*/...*/) as accepted by MS SQL Server and PostgreSQL are disapproved (as also disapproved by the original Paradox single statement processing).
Please check the PdxEditor pre-process preview on the SQL Editor form.

Asymmetric comment delimiters (/* ... /* ... */)

The PdxEditor pre-processing of asymmetrically delimited comments as

/* some /* redundant comment */

are processed according the the syntax used by BDE/Paradox, MySQL, SQLite and others, but on this aspect differs from that of MS SQL Server as well as of PostgreSQL.
This means, that comments like this
SELECT
 FieldA
/*, FieldB
-- /*
, FieldC
-- */
, FieldD */
, FieldE  
FROM MyTable;

with PdxEditor/BDE/MySQL/SQLite and others are processed (green) like this
SELECT
 FieldA
/*, FieldB
-- /*
, FieldC
-- */
, FieldD */     --< This "*/" considered redundant and raising execution error
, FieldE  
FROM MyTable;

and NOT like this
SELECT
 FieldA
/*, FieldB
-- /*
, FieldC
-- */
, FieldD */
, FieldE  
FROM MyTable;

Avoiding this simple illustrated comment is easy, but when inactivating (commenting) code lines in a large script, with MS SQL Server you easily may end up unintentionally nesting and thus inactivating code lines below as a major pitfall of MS SQL Server nested comments.

__________________________
PdxEditor Application Help, 18 May 2026; © 2010-2026 Niels Knabe