Re: Bug in AbstracJdbc2Statement.replaceProcessing when using dollar quoting?

Поиск
Список
Период
Сортировка
От GEISINGER Marc - Contractor
Тема Re: Bug in AbstracJdbc2Statement.replaceProcessing when using dollar quoting?
Дата
Msg-id 32597_1348670307_50631363_32597_9347_1_E4DFA2E3210FA443B032684B39D16BB4092FB673AE@THSNCOA06MXS02P.ONE-06.GRP
обсуждение исходный текст
Ответ на Re: Bug in AbstracJdbc2Statement.replaceProcessing when using dollar quoting?  ("David Johnston" <polobo@yahoo.com>)
Список pgsql-jdbc

-----Ursprüngliche Nachricht-----
Von: David Johnston [mailto:polobo@yahoo.com]
Gesendet: Montag, 24. September 2012 17:49
An: GEISINGER Marc - Contractor; 'Dave Cramer'
Cc: pgsql-jdbc@postgresql.org
Betreff: RE: [JDBC] Bug in AbstracJdbc2Statement.replaceProcessing when using dollar quoting?


> At worse even if you cannot code it yourself you can propose pseudo-code/algorithm that people could review and then
someonecould just code > and deploy. 

Looking at
http://www.postgresql.org/docs/9.1/static/sql-syntax-lexical.html

4.1.1. Identifiers and Key Words
...
SQL identifiers and key words must begin with a letter (a-z, but also letters with diacritical marks and non-Latin
letters)or an underscore (_). Subsequent characters in an identifier or key word can be letters, underscores, digits
(0-9),or dollar signs ($). Note that dollar signs are not allowed in identifiers according to the letter of the SQL
standard,so their use might render applications less portable. 

it seems to me, that $ are not allowed as identifiers by the SQL standard. But they are allowed in postgresql. But also
inpostgresql they are not allowed at the beginning of an identifier. 
As far as I understand the parseSql method (line 864) in AbstractJdbc2Statement class, the looking for a dollar quoted
stringcould be done similar to the looking for escape codes (line 894).  
If we are IN_SQLCODE and we find a '$' as character, look through the following chars until the next '$' is found.
Anythingbetween the two '$' is the tag. Then we would have a state IN_DOLLARQOUTE, until we find this '$tag$' again. 
The only problem I see with this idea might come from nested dollar quotes.

Marc




В списке pgsql-jdbc по дате отправления:

Предыдущее
От: "David Johnston"
Дата:
Сообщение: Re: Bug in AbstracJdbc2Statement.replaceProcessing when using dollar quoting?
Следующее
От: GEISINGER Marc - Contractor
Дата:
Сообщение: Re: Bug in AbstracJdbc2Statement.replaceProcessing when using dollar quoting?