Skip to content

[RFC|NeedsWork] Add validate statement bridge method #40

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pcottle
Copy link
Contributor

@pcottle pcottle commented Dec 28, 2015

Alright @almost this diff is super rough since I'm an Objective-C newb, but hoping to get some feedback and improve on it.

In my app that teaches people SQL, I'd like to be able to verify the query they have partially composed before going and executing the whole thing. The verification doesnt need to be 100%, just a best effort (obviously things might arise during actual execution).

So for this diff I added a validateStatement method that takes in a SQL statement + params, does the same verification we do in execute, steps it once, and returns if there is any error. Otherwise it closes out the statement and returns null.

Problems so far:

  • How should I consolidate the templating / validation logic between validateStatement and prepareStatement? I tried to do it with a private method body (called synchronously) but since I need to return a sqlite3_stmt, I couldn't quite figure out how to throw / catch errors and gave up.
  • For some reason I couldn't get Xcode 7.2 to "see" the react header files so I had to make them relative imports :(
  • What is the pending action stuff on the JS side? Can you actually queue up statements to a DB before its finished opening? If so thats cool :) I guess I wondered why getDatabase was sync...

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

Successfully merging this pull request may close these issues.

1 participant