Search code examples
node.jsmariadbmariasql

Limit to using mariasql throwing error


I am using mariasql module in nodejs to connect with mariadb. My query is:

select * from products where id=1 order by timestamp DESC LIMIT 0,10

This query works fine when I pass fixed values to limit.

Now I tried taking values from parameters.

select * from products where id=:pid order by timestamp DESC LIMIT :start,:end

This query is throwing following error.

{ Error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''0','10'' at line 1 code: 1064 }

where as it accepts value from parameter for where clause.


Solution

  • It seems there is issue in mariasql node module. The issue is already reported in 2016 but there is no resolution yet. Rather I found an alternative module which is for mysql but works fine with mariasql.