<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent changes to 1511: Comments are not considered in placing the cursor at the correct position after an error occured</title><link href="https://sourceforge.net/p/squirrel-sql/bugs/1511/" rel="alternate"/><link href="https://sourceforge.net/p/squirrel-sql/bugs/1511/feed.atom" rel="self"/><id>https://sourceforge.net/p/squirrel-sql/bugs/1511/</id><updated>2022-10-13T10:52:26.332000Z</updated><subtitle>Recent changes to 1511: Comments are not considered in placing the cursor at the correct position after an error occured</subtitle><entry><title>Comments are not considered in placing the cursor at the correct position after an error occured</title><link href="https://sourceforge.net/p/squirrel-sql/bugs/1511/" rel="alternate"/><published>2022-10-13T10:52:26.332000Z</published><updated>2022-10-13T10:52:26.332000Z</updated><author><name>Dirk Steinkamp</name><uri>https://sourceforge.net/u/dirk-steinkamp/</uri></author><id>https://sourceforge.net0aa706635ea44b3fe2dfb3d40d9fc43cd1fff085</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;strong&gt;When:&lt;/strong&gt;&lt;br/&gt;
issuing an sql statement with an error that has one or several comments before the error position, e.g. (field datumx does not exist):&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;SELECT id, -- this is a comment that prevents proper positioning
datumx 
FROM dispoeinsaetze
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Actual:&lt;/strong&gt;&lt;br/&gt;
the cursor is placed in the wrong position (indicated by |):&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;SELECT id, -- this |is a comment that prevents proper positioning
datumx 
FROM dispoeinsaetze
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Should:&lt;/strong&gt;&lt;br/&gt;
Instead the cursor should be positioned in the right position next to the error, like in the same statement without the comment:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;SELECT id,
datumx 
|FROM dispoeinsaetze
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Why is this important:&lt;/strong&gt;&lt;br/&gt;
Especially when copying and pasting bigger SQL-statements with comments into SQuirreL it's hard to find the exact error position.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Probable cause:&lt;/strong&gt;&lt;br/&gt;
It looks like the SQL-statement gets cleaned from all comments before issuing to the JDBC-driver. Thus if the driver reports back an error position it can't know about comments. Looks like the position needs to be projected back to the original statement, skipping the comments.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sidenote:&lt;/strong&gt;&lt;br/&gt;
I have the parameter plugin installed. Don't know if this is related, but some other bug report mentioned it as a cause for a problem with dashes '--' in string literals.&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>