sqorn icon indicating copy to clipboard operation
sqorn copied to clipboard

Oracle Support

Open dmcghan opened this issue 7 years ago • 4 comments

Looks very cool! I'd love to see support for Oracle Database and bind variables.

dmcghan avatar Sep 06 '18 14:09 dmcghan

Is a free version of Oracle available?

The code is structure to support multiple database libraries. For now, I'm just working on getting Postgres production ready. If someone were to submit a PR supporting another databases, I would accept it.

eejdoowad avatar Sep 06 '18 15:09 eejdoowad

@eejdoowad

Is a free version of Oracle available?

There is, it's called Oracle XE. The current version is 11.2, but 18.? will hopefully be out in the near future.

For now, I'm just working on getting Postgres production ready.

Does Postgres use bind variables? If yes, do you support them - the examples didn't look like they did. Here's the last one:

// UPDATE
await Person({ id: 23 }).set({ name: 'Rob' })
// "update person where id = 23 set name = 'Rob'"

With bind variables, that might look like:

// UPDATE
await Person({ id: 23 }).set({ name: 'Rob' })
// "update person where id = :bind_1 set name =:bind_2"
// binds = [23,  'Rob']

If bind variables are supported, it should be easy to add support for other databases when that work is done.

dmcghan avatar Sep 06 '18 15:09 dmcghan

Yes, Sqorn parameterizes variables to prevent SQL injection, so it shouldn't be too difficult. For Postgres, this looks like:

await Person({ id: 23 }).set({ name: 'Rob' })
// { txt: 'update person set name = $1 where id = $2', arg: ['Rob', 23] }

eejdoowad avatar Sep 06 '18 15:09 eejdoowad

Nice! It would be great if you provide a short guideline on how to implement a new dialect after you finalize the structure.

cemremengu avatar Sep 06 '18 23:09 cemremengu