sqorn/sqorn

Oracle Support

dmcghan opened this issue ยท 4 comments

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

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

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.

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] }

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