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

On Ipad, when creating database, im getting sql errors #89

Closed
mlflabs opened this issue Oct 13, 2018 · 7 comments

Comments

Projects
None yet
3 participants
@mlflabs
Copy link

commented Oct 13, 2018

Not sure if any other users where able to make nsql work on ipad, or ios mobile device, but it seems that even with a simple database decleration still getting issue.

It works fine on pc browser, just not on mobile.

I just tested it out with a simple decleration:

    nSQL('test').model([
          { key: 'id', type: 'string', props: ['pk'] },
          { key: '*', type: '*'}
        ]).config({
          mode: 'PERM' 
     });

Error im getting:

SQLError
code: 5
message: "could not prepare statement (1 near "-": syntax error)"

@mlflabs

This comment has been minimized.

Copy link
Author

commented Oct 13, 2018

If I remove mode: 'PERM', it all works

@ClickSimply

This comment has been minimized.

Copy link
Owner

commented Oct 17, 2018

Are you using the cordova plugin?

@ClickSimply

This comment has been minimized.

Copy link
Owner

commented Oct 17, 2018

The current version of NanoSQL runs just fine with websql on my iPhone and iPad. A few questions to help figure out what's going on:

  1. What version of iOS are you running?
  2. Are you using the cordova plugin or no?
  3. If you're not using the cordova plugin, could you post a codepen that causes the bug to happen on your device?
@mlflabs

This comment has been minimized.

Copy link
Author

commented Oct 18, 2018

Hi, thanks for the reply, im not using cordova, im on iOS 12.

Right now im traveling, once im back, ill try to specify websql, and remove perm, ill let you know what happens, also, ill try to make a codepen.

Thanks for the help

Mike

@ditiem

This comment has been minimized.

Copy link

commented Nov 1, 2018

I was going to report exactly this problem. I do not think it is ipad problem but SQL syntax problem. In my case:

CREATE TABLE IF NOT EXISTS _price_hotel_meal_idx_hotel-hotel_room-from_date-to_date-from_age-to_age-meal_type (id BLOB PRIMARY KEY UNIQUE, data TEXT)

I believe that it should be:
CREATE TABLE IF NOT EXISTS "_price_hotel_meal_idx_hotel-hotel_room-from_date-to_date-from_age-to_age-meal_type" (id BLOB PRIMARY KEY UNIQUE, data TEXT)

as " as used to protect any caracted that is not AZaz_

I might be completely wrong as I dont know if the syntax used in the browser follows the same rules as for instance postgres.

Let me know if I can be of any help.

David

@ditiem

This comment has been minimized.

Copy link

commented Nov 1, 2018

I can confirm what I mentioned in the previous comment is the issue. I managed to edit the compiled version of nano-sql I have in node_modules and added double quotes around the table in the SQL commands of all the "._sql(" calls in adapter-websql.js and it worked.

@ClickSimply

This comment has been minimized.

Copy link
Owner

commented Nov 10, 2018

Version 1.7.9 was just released to NPM with the fix mentioned here. Thanks for figuring out the fix ditiem!

I'm closing this issue, if this problem comes up again leave a comment and I'll reopen the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.