Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test [sql/103-find4.sql] #9

Open
JerrySievert opened this issue Feb 4, 2014 · 0 comments
Open

test [sql/103-find4.sql] #9

JerrySievert opened this issue Feb 4, 2014 · 0 comments

Comments

@JerrySievert
Copy link
Owner

filename : sql/103-find4.sql
line # : 1
tag : todo
md5 : 81d4d9a7c4e910db09b480a268d7eb18

--- [todo] - test
CREATE OR REPLACE FUNCTION find (collection varchar, terms json, lim int, skip int) RETURNS
SETOF json AS $$
  var table = 'col_' + collection;
  var sql = "SELECT data FROM " + table;

  var where_clause = plv8.find_function("where_clause");
  var where = where_clause(terms);
  where = JSON.parse(where);

  sql += " " + where.sql;
  if (lim > -1 ) {
    sql += "LIMIT " + lim;
  }

  if (skip > 0) {
    sql += "OFFSET " + skip;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant