Alexander
Alexander

Reputation: 41

"Unresolved reference" error in SqlDelight

I have simple query in kotlin multiplatform project with SqlDelight database: getLast: SELECT * FROM history ORDER BY id DESC LIMIT ?; But when I try to build the app, I get such error ".....DatabaseImpl.kt: (207, 72): Unresolved reference: value_".

DatabaseImpl.kt is generated class and I can't modify it. This is the code from this class with compilation error:

 public override fun getLast(`value`: Long): Query<History> = getLast(value_) { id, time, spo2,
  pulse_rate, status ->
History(
  id,
  time,
  spo2,
  pulse_rate,
  status
) }

Why does it generate "value" as function parameter, but then use "value_" with underscore? It causes an error.

Upvotes: 4

Views: 640

Answers (1)

Alexey Sakovyh
Alexey Sakovyh

Reputation: 31

Try to use the named parameter:

getLast:
SELECT * FROM history 
ORDER BY id DESC LIMIT :rowNumbers;

Upvotes: 1

Related Questions