I finally got around to creating the patch with all the other steps. I 
attached the patch.

For the record: :-)

I wrote the code, it's mine, and I'm contributing it to H2 for distribution 
multiple-licensed under the H2 License, version 1.0, and under the Eclipse 
Public License, version 1.0 (http://h2database.com/html/license.html).



On Monday, July 9, 2012 11:14:38 AM UTC+2, awebdeveloper wrote:
>
> Thanks! I'll get on it :)
>
>
> On Monday, July 9, 2012 8:30:00 AM UTC+2, Noel Grandin wrote:
>>
>>  We need a patch, and a license statement:
>>
>> http://www.h2database.com/html/build.html#providing_patches
>>
>>
>> On 2012-07-08 19:18, awebdeveloper wrote:
>>  
>> Awesome! I managed to fix it :-) 
>>
>>  It was really simple, I added the following code snippet to the 
>> parseSet() method of the org.h2.command.Parser class.
>>
>>           else if(readIf("NAMES")) {
>>             // Quercus PHP MySQL driver compatibility
>>             readIfEqualOrTo();
>>             read();
>>             return new NoOperation(session);
>>         }
>>  
>>  after line 4604 (after the "else if(readIf("RECOVER")) {}" block). 
>> After that I tested it with the Quercus PHP MySQL driver and it worked like 
>> a charm!
>>
>>  How do I proceed to have the fix included in the H2 distribution?
>>
>>  
>>  
>>  
>> On Friday, July 6, 2012 6:13:02 PM UTC+2, awebdeveloper wrote: 
>>>
>>> Hi Noel, 
>>>
>>>  Thank you for giving me a place to start! :-) 
>>>
>>>
>>> On Friday, July 6, 2012 9:09:57 AM UTC+2, Noel Grandin wrote: 
>>>>
>>>> Start with the org.h2.command.Parser class. It's a standard recursive 
>>>> descent parser, very easy to work with. 
>>>>
>>>> On 2012-07-05 23:56, awebdeveloper wrote: 
>>>> > Hi, 
>>>> > 
>>>> > I am connecting to H2 in MySQL compatibility mode using a MySQL 
>>>> driver 
>>>> > (Caucho Quercus' MySQL driver to be exact). I am getting an error 
>>>> > during connection, saying there is a syntax error in the SQL query: 
>>>> > SET NAMES 'latin1'; (Basically SET NAMES is not supported by H2 yet.) 
>>>> > This is valid for MySQL, but as I am aware, H2's MySQL compatibility 
>>>> > is not 100%. I've seen that solving this is already on the todo list 
>>>> > for H2, but it's kind of tucked away somewhere in the lower half of 
>>>> > priorities :-) I am trying to raise awareness for this issue, maybe 
>>>> it 
>>>> > can be given a higher priority. Also, I would be interested in 
>>>> > working/coding on this issue myself. But I probably need some help in 
>>>> > that area, since I have never worked with the H2 code base before. 
>>>> > 
>>>> > If anyone could give me some feedback/tips/help with this, it would 
>>>> be 
>>>> > greatly appreciated :-) 
>>>> > -- 
>>>> > You received this message because you are subscribed to the Google 
>>>> > Groups "H2 Database" group. 
>>>> > To view this discussion on the web visit 
>>>> > https://groups.google.com/d/msg/h2-database/-/VtdpwtcF7UkJ. 
>>>> > To post to this group, send email to [email protected]. 
>>>> > To unsubscribe from this group, send email to 
>>>> > [email protected]. 
>>>> > For more options, visit this group at 
>>>> > http://groups.google.com/group/h2-database?hl=en. 
>>>>
>>>>
>>>>   -- 
>> You received this message because you are subscribed to the Google Groups 
>> "H2 Database" group.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msg/h2-database/-/nisT4YPA2hYJ.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to 
>> [email protected].
>> For more options, visit this group at 
>> http://groups.google.com/group/h2-database?hl=en.
>>
>>
>>
>>  

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/h2-database/-/bYtw-483-zIJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Index: h2/src/main/org/h2/command/Parser.java
===================================================================
--- h2/src/main/org/h2/command/Parser.java	(revision 4326)
+++ h2/src/main/org/h2/command/Parser.java	(working copy)
@@ -4596,6 +4596,11 @@
             readIfEqualOrTo();
             read();
             return new NoOperation(session);
+        } else if(readIf("NAMES")) {
+            // Quercus PHP MySQL driver compatibility
+            readIfEqualOrTo();
+            read();
+            return new NoOperation(session);
         } else if (readIf("SCHEMA")) {
             readIfEqualOrTo();
             Set command = new Set(session, SetTypes.SCHEMA);
Index: h2/src/docsrc/html/changelog.html
===================================================================
--- h2/src/docsrc/html/changelog.html	(revision 4326)
+++ h2/src/docsrc/html/changelog.html	(working copy)
@@ -20,7 +20,8 @@
 <h2>Next Version (unreleased)</h2>
 <ul><li>The ResultSetMetaData methods getSchemaName and getTableName 
     could return null instead of "" (an empty string) as specified in the JDBC API.
-</li></ul>
+</li><li>Added compatibility for "SET NAMES" query in MySQL compatibility mode.</li>
+</ul>
 
 <h2>Version 1.3.168 (2012-07-13)</h2>
 <ul><li>The message "Transaction log could not be truncated" was sometimes written

Reply via email to