Hi
I'm having a problem with a library I forked (https://github.com/coffeepots/odbc/tree/master) and fixed to run with nim version 2.0 (2.0.8 to be precise).
Now switching to version 2.2.0 and using the library for an utility, I get an error:
proc trovaIdUtente(conn: ODBCConnection, command, nome: string): string =
var qry = newQuery(conn)
qry.statement = command
qry.params["nome"]= nome
var risultato = qry.executeFetch
if risultato.len > 0:
var campoId = risultato.fields("Id")
result = risultato.data(campoId, 0).toString
else:
result = ""
The row is:
qry.params["nome"]= nome
and the error is:
template/generic instantiation of `[]=` from here
Expression: initSQLData[typeof(data)](data)
[1] data: system.int
Expected one of (first mismatch at [position]):
[1] proc initSQLData(inputData: DateTime): SQLData
extra generic param given
[1] proc initSQLData(inputData: GuidData): SQLData
extra generic param given
[1] proc initSQLData(inputData: SQLBinaryData): SQLData
extra generic param given
[1] proc initSQLData(inputData: TimeInterval): SQLData
extra generic param given
[1] proc initSQLData(inputData: bool): SQLData
extra generic param given
[1] proc initSQLData(inputData: float): SQLData
extra generic param given
[1] proc initSQLData(inputData: int): SQLData
extra generic param given
[1] proc initSQLData(inputData: int64): SQLData
extra generic param given
[1] proc initSQLData(inputData: string): SQLData
extra generic param given
[1] proc initSQLData(kind: SQLDataType = dtNull): SQLData
extra generic param given
My fork is https://github.com/MauGal/odbc_2_0
And initSqlData is in odbcparams.nim
I'm not very expert in nim and any contribution to understand what the problem is would be very welcome.
Thanks
initSQLData procs doesn't have generic parameters, so you can remove them:
initSQLData[typeof(data)](data)
should be
initSQLData(data)
Maybe I'm missing something, but I don't see why it was valid before 2.2.0 or why original author added them.