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

gte for date fields throws error #18

Open
lindenle opened this issue Sep 27, 2013 · 0 comments
Open

gte for date fields throws error #18

lindenle opened this issue Sep 27, 2013 · 0 comments

Comments

@lindenle
Copy link
Contributor

This call throws an error about the sql syntax:

Measurement.all( { where: { startDate: { gte: start }  , endDate :  end  } } , function ( err, measurements){
    console.log(err);
});

Error:

{ [Error: SQLITE_ERROR: near "Mar": syntax error] errno: 1, code: 'SQLITE_ERROR' }

This call works:

 Measurement.all( { where: { startDate: start  , endDate :  end  } } , function ( err, measurements){
    console.log(err);
});

SQL statement:

SELECT * FROM `Measurement` WHERE `startDate` = 1362121200000.0 AND `endDate` = 1364709600000.0'

Where the model is defined as:

var Measurement = schema.define('Measurement', {
  title       : { type: String, index: true },
  endDate     : { type: Date, index: true },
  startDate   : Date,
});

I believe this means there is a problem building the SQL statement when gte is used in the query. I am looking at the code here:

https://github.com/jugglingdb/sqlite3-adapter/blob/master/lib/sqlite3.js#L346

To see if that is the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant