Closed UNIcodeX closed 4 years ago
Someone has created a driver using ODPI-C for Nim here. Does this do what you would like?
Perhaps. I was not aware of that project. It's not cx_Oracle, but may be the best option at the moment.
If that doesn't work well, perhaps you can enlighten me a bit on what you would like to see? I'm not that familiar with Nim, so some help here would be much appreciated!
I attempted to use the nimodpi project, but ran into an issue. I've opened said issue on that repo: https://github.com/mikra01/nimodpi/issues/2
Ideally, one would be able to make a connection to and use the result set from a query execution in the same or similar manner to cx_Oracle.
import nimOracle
let conn = nimOracle.connect("{connectionString}")
let cur = conn.cursor()
let resultSet = cur.execute("""
SELECT
column1,
column2
FROM
table
WHERE
condition
""")
if resultSet.len > 0:
for row in resultSet:
# do something
Even without the use of classes like in python, since Nim uses UFCS, something like the following could be done to emulate fully qualified dot notation.
proc myEcho(s: string) =
echo s
proc execute(p: proc, s: string) =
p(s)
myEcho.execute("string")
# or this would also work
execute(myEcho, "string")
The first parameter could be any type, I just used echo as a simple example. This, of course, also enables procedure chaining.
Although it's interesting, it's off topic for cx_Oracle, so I'll close the issue. The nimodpi driver is the best way forward. Make sure you have a compatible ODPI-C code base and header file: dpiAuthMode
is in dpi.h.
Review existing enhancement requests done. doesn't exist yet.
Describe your new request in detail Porting this to Nim would be very nice and useful. It would work in the same manner, requiring the Oracle Client dynamic libraries, etc...
Give supporting information about tools and operating systems. Give relevant product version numbers Nim compiles down to machine code by way of selectable back-ends (C, C++, JS, ObjC) which greatly increases portability. The
nimpy
library allows one to also create libraries for Python. The language properties andnimpy
library would allow for a single code-base.Nim can generate single file executables without dependency on a Python interpreter, and has an excellent package management and unit testing mechanism.
There's also
Nimterop
which helps in wrapping libraries for use in Nim. I'm not sure where one would start with this library, and am therefore attempting to interest you in the undertaking. I am also happy to do what I can to assist.