Skip to content

gte for date fields throws error #18

@lindenle

Description

@lindenle

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions