db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From david myers <david.myers.scibearsp...@gmail.com>
Subject Re: Derby Key Words
Date Thu, 06 Sep 2012 03:50:05 GMT
On 05/09/12 23:29, Rick Hillegas wrote:
> On 9/5/12 7:02 AM, David Myers wrote:
>> Hello all,
>>
>> Bryan, thanks for the info (although I was using 'locate' on my ubuntu
>> box, and it still didn't find it ?) I'll have a look tonight.
>>
>> Kathey, I don't intend to modify the file, just grab the contents, if
>> possible an without using a file Input Stream
> Hi David,
>
> Note that the keywords appear in an array of String constants that are 
> generated by javacc into 
> trunk/generated/java/org/apache/derby/impl/sql/compile/SQLParserConstants.java. 
> That may be a more straightforward way to get your hands on the 
> keywords but it may require understanding more about how the generated 
> grammar behaves and it may involve building a compile time tool which 
> scrapes the keywords out of SQLParserConstants. I am waving my hands, 
> of course.
>
> Hope this helps,
> -Rick
>> I also noted that the DatabaseMetaData.getSQLkeywords() actually has a
>> hard coded list of words! I have no problem with that in the first
>> instance, but I'm sure that the engine doesn' check every word with a
>> call to this method before throwing an error!
>>
>> I need to keep looking...I'll keep you all posted.
>>
>> D
>>
>> On Wed, Sep 5, 2012 at 6:25 AM, Katherine Marsden
>> <kmarsdenderby@sbcglobal.net>  wrote:
>>> On 9/4/2012 7:44 PM, Bryan Pendleton wrote:
>>>>> I've had success in pointing Eclipse to the source code that I have
>>>>> built. I have had a nice look around for the file that I am
>>>>> interested in, which from the previously mentioned JIRA issues etc
>>>>> suggest a file called sqlgrammar.jj
>>>>> only problem is I can't find it!
>>>>
>>>> It's possible that Eclipse doesn't grok '.jj' files in its normal
>>>> configuration.
>>>>
>>>> The file should be in your source tree as:
>>>>
>>>> ./java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
>>>>
>>>> There is a compiler-generation tool that processes this file during
>>>> the Ant build of Derby and generates Java source from the grammar.
>>>>
>>>   The tool that generates the java code for the parser from 
>>> sqlgrammar.jj is
>>> Javacc.  The generated code is in
>>> generated/java/org/apache/derby/impl/sql/compile which is fun to 
>>> look at but
>>> shouldn't be changed.
>>> I think there may be an exclipse plugin for javacc but I have never 
>>> used
>>> one.
>>>
>>> Kathey
>>>
>>>
>
Rick,

re your comment of String constants in an array. I found the same thing 
in the interface.

It has just occured to me that, as we use a database, maybe a resultSet 
may be the thing to return , I've come full circle to understanding your 
original idea of a 'Table Function'. But I would still think that a 
function in DatabaseMetaData would be good.

Along these lines... it should take a String argument that is the word 
being tested, and return true [word is in list] or false [word is not in 
the list]. I propose to call the method prototype to be something like 
getAllDerbyKeyWords(String wordToTest) . Hopefully as it has the word 
'Derby' in it the SQL people are unlikely to ever use is in the 
standard! Although maybe there would be an argument to propose a new 
method of getAllKeywords() to the standard, that each driver vendor 
could implement and would have the same / similar functionality - 
delusions of grandeur ;)

But how to turn that String Array into a Table is fairly simple (I'd 
declare a temp table), and then make a select on it to get a resultSet. 
However is there a way to skip the table step and jump straight to a 
result set (its a bit of a leading question, and I haven't searched for 
an answer anywhere yet, so unless you know off the top of your head no 
need to answer straight away).

David

Mime
View raw message