Skip to content

Commit

Permalink
fixed sap issue with dates
Browse files Browse the repository at this point in the history
  • Loading branch information
pleerock committed May 19, 2020
1 parent d7256c7 commit 9c4207e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/driver/sap/SapDriver.ts
Expand Up @@ -228,7 +228,7 @@ export class SapDriver implements Driver {
// pool options
const options: any = {
min: this.options.pool && this.options.pool.min ? this.options.pool.min : 1,
max: this.options.pool && this.options.pool.max ? this.options.pool.max : 1,
max: this.options.pool && this.options.pool.max ? this.options.pool.max : 10,
};

if (this.options.pool && this.options.pool.checkInterval) options.checkInterval = this.options.pool.checkInterval;
Expand Down Expand Up @@ -283,6 +283,10 @@ export class SapDriver implements Driver {
*/
escapeQueryWithParameters(sql: string, parameters: ObjectLiteral, nativeParameters: ObjectLiteral): [string, any[]] {
const builtParameters: any[] = Object.keys(nativeParameters).map(key => {

if (nativeParameters[key] instanceof Date)
return DateUtils.mixedDateToDatetimeString(nativeParameters[key], true);

return nativeParameters[key];
});

Expand Down Expand Up @@ -310,6 +314,9 @@ export class SapDriver implements Driver {
} else if (value instanceof Function) {
return value();

} else if (value instanceof Date) {
return DateUtils.mixedDateToDatetimeString(value, true);

} else {
builtParameters.push(value);
return "?";
Expand Down

0 comments on commit 9c4207e

Please sign in to comment.