You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This should be a continuation of issue #90, but I cannot reopen that issue.
I'm facing the same problem, but reach a different conclusion: Shouldn't node-firebird-driver try to handle the case where the timestamp value (in my case, would be date value in the code posted in issue #90) is a string?
It's not difficult, in the function createDataWriter in fb-util.ts of node-firebird-driver, in the sqlTypes.SQL_TIMESTAMP case (and others), one could do this: const date = typeof(value) === 'string' ? new Date(value) : value as Date;
instead of blindly doing this: const date = value as Date;
and that solves de problem.
Rationale: Providing string values to timestamp parameters is very common and widely supported by other databases. In this case I'm building a backend app publishing different service endpoints using feathers.js with knex-firebird-dialect (that depends on node-firebird-drivers). This same use case that fails using node-firebird-drivers to handle database connections, is processed without issues when the database is (for example) postgresql, mssql or sqlite.
The transformation of the parameter values from string to Date cannot be made higher up in call chain because outside of the driver there is no knowledge of the actual data types of the database columns, so no way to know that the change should be made (other than in the application code, but would be very cumbersome and, as I said, not needed with other databases).
The text was updated successfully, but these errors were encountered:
This should be a continuation of issue #90, but I cannot reopen that issue.
I'm facing the same problem, but reach a different conclusion: Shouldn't node-firebird-driver try to handle the case where the timestamp value (in my case, would be date value in the code posted in issue #90) is a string?
It's not difficult, in the function createDataWriter in fb-util.ts of node-firebird-driver, in the sqlTypes.SQL_TIMESTAMP case (and others), one could do this:
const date = typeof(value) === 'string' ? new Date(value) : value as Date;
instead of blindly doing this:
const date = value as Date;
and that solves de problem.
Rationale: Providing string values to timestamp parameters is very common and widely supported by other databases. In this case I'm building a backend app publishing different service endpoints using feathers.js with knex-firebird-dialect (that depends on node-firebird-drivers). This same use case that fails using node-firebird-drivers to handle database connections, is processed without issues when the database is (for example) postgresql, mssql or sqlite.
The transformation of the parameter values from string to Date cannot be made higher up in call chain because outside of the driver there is no knowledge of the actual data types of the database columns, so no way to know that the change should be made (other than in the application code, but would be very cumbersome and, as I said, not needed with other databases).
The text was updated successfully, but these errors were encountered: