Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<null> values from server will be updated to string "null" into the websql db #21

Open
SuperMario77 opened this issue Sep 17, 2013 · 3 comments

Comments

@SuperMario77
Copy link

Hello,

I just noticed that all my values from the server are now a string "null" after I send updates from server to the client.

On INSERT it works fine, because you use placeholder '?' in the INSERT statement.

But in the UPDATE statement you write the following in line 473 (_buildUpdateSQL):

for (var i = 0; i < nb; i++) {
    sql += '"' + members[i] + '" = "' + values[i] + '"';
    if (i < nb - 1) {
        sql += ', ';
    }
}

Here the values are enclosed by quotes and now it is a string "null". :-(

Could you please use also placeholders in UPDATE?

Best regards,
Mario

@orbitaloop
Copy link
Owner

Could you propose a pull request? Unfortunately, I am very busy...

@abeauseigle
Copy link

Hi Samuel,
It's just to inform you that my 2 way sync is working perfectly with MySQL. I use 2 indexes (one for the client DB and one for the server DB). I modifyed webSqlSync.js to handle inserted records directly into MySQL that have a null client id value. When I insert a record in webSQL (with the client), I use -1 in the "server" ID to inform the server adapter that's a record newly created with the app. -1 mean to do an INSERT INTO MySQL.
You'll find my code on my GitHub webSqlApp. I think, it will answer a lot of questions from the community.
Ciao!
Alain from Montréal.

@orbitaloop
Copy link
Owner

Great work Alain !
I will add a link to your project in the doc. Very helpful indeed.

Thanks

@SuperMario77 Could you propose a pull request for this modifications? Or just send me here the code you have modified. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants