radweb-server
Advanced tools
Comparing version 1.0.3 to 1.0.4
{ | ||
"name": "radweb-server", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"main":"index.js", | ||
@@ -5,0 +5,0 @@ "Dependencies": { |
@@ -1,27 +0,2 @@ | ||
import { FilterConsumer, DataProvider, FindOptions, FilterBase, Column, Entity, StringColumn } from "radweb"; | ||
export interface SQLCommand { | ||
addParameterToCommandAndReturnParameterName(col: Column<any>, val: any): string; | ||
query(sql: string): Promise<SQLQueryResult>; | ||
} | ||
export interface SQLQueryResult { | ||
rows: any[]; | ||
getColumnIndex(name: string): number; | ||
} | ||
export interface SQLConnectionProvider { | ||
createCommand(): SQLCommand; | ||
} | ||
export declare class FilterConsumerBridgeToSqlRequest implements FilterConsumer { | ||
private r; | ||
where: string; | ||
constructor(r: SQLCommand); | ||
IsEqualTo(col: Column<any>, val: any): void; | ||
IsDifferentFrom(col: Column<any>, val: any): void; | ||
IsGreaterOrEqualTo(col: Column<any>, val: any): void; | ||
IsGreaterThan(col: Column<any>, val: any): void; | ||
IsLessOrEqualTo(col: Column<any>, val: any): void; | ||
IsLessThan(col: Column<any>, val: any): void; | ||
isContains(col: StringColumn, val: any): void; | ||
isStartsWith(col: StringColumn, val: any): void; | ||
private add; | ||
} | ||
import { DataProvider, FindOptions, FilterBase, Entity, SQLConnectionProvider, SQLCommand } from "radweb"; | ||
export declare class ActualSQLServerDataProvider<T extends Entity<any>> implements DataProvider { | ||
@@ -28,0 +3,0 @@ private entityFactory; |
@@ -39,42 +39,2 @@ "use strict"; | ||
var radweb_1 = require("radweb"); | ||
var FilterConsumerBridgeToSqlRequest = /** @class */ (function () { | ||
function FilterConsumerBridgeToSqlRequest(r) { | ||
this.r = r; | ||
this.where = ""; | ||
} | ||
FilterConsumerBridgeToSqlRequest.prototype.IsEqualTo = function (col, val) { | ||
this.add(col, val, "="); | ||
}; | ||
FilterConsumerBridgeToSqlRequest.prototype.IsDifferentFrom = function (col, val) { | ||
this.add(col, val, "<>"); | ||
}; | ||
FilterConsumerBridgeToSqlRequest.prototype.IsGreaterOrEqualTo = function (col, val) { | ||
this.add(col, val, ">="); | ||
}; | ||
FilterConsumerBridgeToSqlRequest.prototype.IsGreaterThan = function (col, val) { | ||
this.add(col, val, ">"); | ||
}; | ||
FilterConsumerBridgeToSqlRequest.prototype.IsLessOrEqualTo = function (col, val) { | ||
this.add(col, val, "<="); | ||
}; | ||
FilterConsumerBridgeToSqlRequest.prototype.IsLessThan = function (col, val) { | ||
this.add(col, val, "<"); | ||
}; | ||
FilterConsumerBridgeToSqlRequest.prototype.isContains = function (col, val) { | ||
this.add(col, '%' + val + '%', 'like'); | ||
}; | ||
FilterConsumerBridgeToSqlRequest.prototype.isStartsWith = function (col, val) { | ||
this.add(col, val + '%', 'like'); | ||
}; | ||
FilterConsumerBridgeToSqlRequest.prototype.add = function (col, val, operator) { | ||
if (this.where.length == 0) { | ||
this.where += ' where '; | ||
} | ||
else | ||
this.where += ' and '; | ||
this.where += col.__getDbName() + ' ' + operator + ' ' + this.r.addParameterToCommandAndReturnParameterName(col, val); | ||
}; | ||
return FilterConsumerBridgeToSqlRequest; | ||
}()); | ||
exports.FilterConsumerBridgeToSqlRequest = FilterConsumerBridgeToSqlRequest; | ||
var LogSQLConnectionProvider = /** @class */ (function () { | ||
@@ -140,3 +100,3 @@ function LogSQLConnectionProvider(origin) { | ||
if (where) { | ||
var wc = new FilterConsumerBridgeToSqlRequest(r); | ||
var wc = new radweb_1.FilterConsumerBridgeToSqlRequest(r); | ||
where.__applyToConsumer(wc); | ||
@@ -168,3 +128,3 @@ select += wc.where; | ||
if (options.where) { | ||
var where = new FilterConsumerBridgeToSqlRequest(r); | ||
var where = new radweb_1.FilterConsumerBridgeToSqlRequest(r); | ||
options.where.__applyToConsumer(where); | ||
@@ -214,3 +174,3 @@ select += where.where; | ||
var r = this.sql.createCommand(); | ||
var f = new FilterConsumerBridgeToSqlRequest(r); | ||
var f = new radweb_1.FilterConsumerBridgeToSqlRequest(r); | ||
this.entity.__idColumn.isEqualTo(id).__applyToConsumer(f); | ||
@@ -248,3 +208,3 @@ var statement = 'update ' + this.entity.__getDbName() + ' set '; | ||
var r = this.sql.createCommand(); | ||
var f = new FilterConsumerBridgeToSqlRequest(r); | ||
var f = new radweb_1.FilterConsumerBridgeToSqlRequest(r); | ||
this.entity.__idColumn.isEqualTo(id).__applyToConsumer(f); | ||
@@ -263,3 +223,3 @@ var statement = 'delete from ' + this.entity.__getDbName(); | ||
var r = this.sql.createCommand(); | ||
var f = new FilterConsumerBridgeToSqlRequest(r); | ||
var f = new radweb_1.FilterConsumerBridgeToSqlRequest(r); | ||
var cols = ''; | ||
@@ -266,0 +226,0 @@ var vals = ''; |
Sorry, the diff of this file is not supported yet
41474
564