MySQL Update Syntax

Hi everyone, I am having an issue implementing the update function of the Addressbook example using a MySQL database and I am hoping somebody might point me to
what I am hoping is an obvious error on my part :smiley: (Forgive me if this is a silly question, I am very new to vaadin).

I have successfully managed to integrate MySQL into the example, the SQLcontainers are reading into the table without an issue. My problem comes when I try to do an update. It looks to me like the SQL that is generated by the SQLGenerator is putting double quotes are around each of the column names. Unfortunately MySQL doesnt seem to like that notation on an update for some reason so it throws a wobbly. The select seems fine with double quotes though (I am not sure if this si a something I can fix in MySQL actually but hopefully somebody will know).

as an example, this will work

UPDATE personaddress SET firstname= ‘Bob’ Where id = 1

however, this is what appears to be generated and it wont work.

UPDATE “personaddress” SET “firstname”= ‘Bob’ Where “id” = 1

I would be very gratefull for any advice. Hopefully the solution is simple enough.

thanks
Paul

Hi,

If you have admin writes on the MySQL Instance, you then you can
configure MySQL to use ANSI Quotes
which should work.

If not - I’ve not used SQLContainer myself, however, I’ve just looked at the source, and it looks like you can customize the SQLGenerator to use the backtick via QueryBuilder#setStringDecorator

e.g.[code]
QueryBuilder.setStringDecorator(new StringDecorator(“", "”));

[/code]
I’d prefer the first approparch, myself.

Cheers,

Charles

Thanks! I gave option 1 a try and it worked a treat!.

thanks again.
Paul