From 32cf5ec3165837782da642ee468b39e7e1d0b849 Mon Sep 17 00:00:00 2001 From: Johannes Hoermann <j.hoermann@adito.de> Date: Tue, 15 Oct 2019 16:12:49 +0200 Subject: [PATCH] remove deprecated SqlCondition lib --- process/Sql_lib/process.js | 687 ------------------------------------- 1 file changed, 687 deletions(-) diff --git a/process/Sql_lib/process.js b/process/Sql_lib/process.js index e164b43037..39843f71b1 100644 --- a/process/Sql_lib/process.js +++ b/process/Sql_lib/process.js @@ -9,686 +9,6 @@ import("system.SQLTYPES"); import("system.text"); import("Util_lib"); -/** - * object for easier handling of conditions; - * With this object you do not have to check if the string is empty or not; - * you don't need to append a "1=1" condition or similar; - * this objects gains most benefit if you have a lot of conditions that are added (or not) depending on tons of JDito-conditions - * - * You can also use SqlCondition.begin(alias) for simpler object creation without new and without the need for an extra variable to save the object. - * - * @class - * @param {String} [alias=the current alias] the database alias where the condition shall be executed later (important for column types of preparedStatements) - * @example - * see others/guide/HowToSqlConditionLib.adoc - * - * @deprecated Use SqlBuilder instead - */ -function SqlCondition(alias) { - // setting null is only needed to provide autocomplete for the ADITO-designer - this.preparedValues = null; - this._init(); // the properties are initalized in an extra function because init is nearly the same as resetting (clearing) the SqlConditions - this.alias = alias; - - // save, if the last condition was an OR. For better bracket-placement - this._lastWasOr = false; -} - -/** - * Alternative possibility to crate a new condition. - * With this you don't need new SqlCondition and you can use the object directly after it's creation - * --> cleaner code - * - * It is very usefull for the orSqlCondition() and andSqlCondition() because now you can create a new condition inline. - * You can also use it for simple selects without the need to save the conditionObject in an extra variable. - * See Examples! - * - * @param {String} [alias=the current alias] the database alias where the condition shall be executed later (important for column types of preparedStatements) - * @return {SqlCondition} the new SqlCondition-object - * - * @example - * vars mySelect = SqlCondition.begin(alias) - * .and("MYID = '123'") - * .and(SqlCondition.begin() - * .or("NAME = 'Max'") - * .or("NAME = 'Bob'") - * ) - * .buildSql("select * from MYTABLE"); - * - * // Or use it for simple selects: - * var sum = db.cell(SqlCondition.begin() - * .andPrepared("STOCK.PRODUCT_ID", pid) - * .buildSql("select sum(QUANTITY * IN_OUT) from STOCK")); - * - * @deprecated Use SqlBuilder instead - */ -SqlCondition.begin = function(alias) { - return new SqlCondition(alias); -} - -/** - * checks if conditions have been added to the object - * @return {Boolean} true if conditions have been added, false when not - * - * @deprecated Use SqlBuilder instead - */ -SqlCondition.prototype.isSet = function() { - if (this._sqlStorage) - return true; - return false; -} - - -/** - * append with SQL-and; no paranthesize of existing conditions is done - * @param {String} cond the condition string which shall be appended - * @return {SqlCondition} current SqlCondition-object - * - * @deprecated Use SqlBuilder instead - */ -SqlCondition.prototype.and = function(cond) { - if (!cond) - return this; - if (this.isSet()) - this._sqlStorage += " and "; - this._sqlStorage += cond; - return this; -} - -/** - * append with SQL-or; Also paranthesize the existing conditions - * @param {String} cond the condition string which shall be appended - * @return {SqlCondition} current SqlCondition-object - * - * @deprecated Use SqlBuilder instead - */ -SqlCondition.prototype.or = function(cond) { - if (!cond) - return this; - - if (this.isSet() && !this._lastWasOr) { - this._sqlStorage = "(" + this._sqlStorage + ") or (" + cond + ")"; - this._lastWasOr = true; - - } else if (this.isSet() && this._lastWasOr) { - this._sqlStorage = this._sqlStorage + " or (" + cond + ")"; - this._lastWasOr = true; - - } else { - this._sqlStorage = cond; - } - return this; -} - -/** - * append a prepared-array to this sql condition with SQL-and - * @param {Array} preparedObj a prepared condition-array - * @return {SqlCondition} current SqlCondition-object - * - * @deprecated Use SqlBuilder instead - */ -SqlCondition.prototype.andAttachPrepared = function(preparedObj) { - if (preparedObj) - { - this.preparedValues = this.preparedValues.concat(preparedObj[1]); - return this.and(preparedObj[0]); - } - - return this; -} - -/** - * append a prepared-array to this sql condition with SQL-or - * @param {Array} preparedObj a prepared condition-array - * @return {SqlCondition} current SqlCondition-object - * - * @deprecated Use SqlBuilder instead - */ -SqlCondition.prototype.orAttachPrepared = function(preparedObj) { - if (preparedObj) - { - this.preparedValues = this.preparedValues.concat(preparedObj[1]); - return this.or(preparedObj[0]); - } - - return this; -} - -/** - * append another condition with SQL-and - * - * @param {SqlCondition} cond the condition which shall be appended - * @param {String} [alternativeCond=""] condition if the given SqlCondition has none - * @return {SqlCondition} current SqlCondition-object - * - * @deprecated Use SqlBuilder instead - */ -SqlCondition.prototype.andSqlCondition = function(cond, alternativeCond) { - if (!cond) - return this - - var otherCondition = cond.toString(alternativeCond); - if (otherCondition.trim() != "") - { - this.and(" ( " + cond.toString(alternativeCond) + " ) "); - if (cond.preparedValues) { - this.preparedValues = this.preparedValues.concat(cond.preparedValues); - } - } - return this; -} - -/** - * append another condition with SQL-or; Also paranthesize the existing conditions - * - * @param {SqlCondition} cond the condition which shall be appended - * @param {String} [alternativeCond=""] condition if the given SqlCondition has none - * @return {SqlCondition} current SqlCondition-object - * - * @deprecated Use SqlBuilder instead - */ -SqlCondition.prototype.orSqlCondition = function(cond, alternativeCond) { - var otherCondition = cond.toString(alternativeCond); - if (otherCondition.trim() != "") - { - this.or(" ( " + cond.toString(alternativeCond) + " ) "); - if (cond.preparedValues) { - this.preparedValues = this.preparedValues.concat(cond.preparedValues); - } - } - return this; -} - -/** - * append an condition that uses a subQuery with SQL-and - * - * @param {SqlBuilder} subQuery the SqlBuilder object that will be used as a subquery - * @param {String} [cond="exists"] condition that is used (e. g. exists, not exists, COLUMN = any, COLUMN in, ...) - * @return {SqlCondition} current SqlCondition-object - * - * @deprecated Use SqlBuilder instead - */ -SqlCondition.prototype.andSqlBuilder = function(subQuery, cond) { - if (!cond) - cond = "exists"; - - var preparedObj = subQuery.build(); - preparedObj[0] = cond + " ( " + preparedObj[0] + " ) "; - this.andAttachPrepared(preparedObj); - - return this; -} - -/** - * append an condition that uses a subQuery with SQL-or - * - * @param {SqlBuilder} subQuery the SqlBuilder object that will be used as a subquery - * @param {String} [cond="exists"] condition that is used (e. g. exists, not exists, COLUMN = any, COLUMN in, ...) - * @return {SqlCondition} current SqlCondition-object - * - * @deprecated Use SqlBuilder instead - */ -SqlCondition.prototype.orSqlBuilder = function(subQuery, cond) { - if (!cond) - cond = "exists"; - - var preparedObj = subQuery.build(); - preparedObj[0] = cond + " ( " + preparedObj[0] + " ) "; - this.orAttachPrepared(preparedObj); - - return this; -} - -/** - * same as the "and"-function but with preparedStatement functionality - * @param {String | String[]} field the database field as "tablename.columnname"; e.g. "ORGANISATION.NAME" or as array with column-alias: ["ORGANISATION", "NAME", "myorgAlias"] - * @param {String} value the value that shall be set into the prepared statement - * @param {String} [cond="# = ?"] the strucutre of the SQL condition as preparedString, you can use a number sign "#" as placeholder for you fieldname; - * e.g. "# > ?"; escaping the number sign is possible with a backslash "\" - * @param {Numeric | Boolean} [fieldType] SQL-column-type; if the fieldType is not given it's loaded automatically; - * The loaded type is cached if no type is given. So it is also safe to use this in a loop. - * e.g. - * for (...) { - * cond.andPrepare("SALESPROJECT_CLASSIFICATION.TYPE", entry, "# <> ?") - * } - * @return {SqlCondition} current SqlCondition-object - * - * @deprecated Use SqlBuilder instead - */ -SqlCondition.prototype.andPrepare = function(field, value, cond, fieldType) { - cond = this._prepare(field, value, cond, fieldType); - return this.and(cond); -} - -/** - * same as the "or"-function but with preparedStatement functionality - * @param {String | String[]} field the database field as "tablename.columnname"; e.g. "ORGANISATION.NAME" or as array with column-alias: ["ORGANISATION", "NAME", "myorgAlias"] - * @param {String} value the value that shall be set into the prepared statement - * @param {String} [cond="# = ?"] the strucutre of the SQL condition as preparedString, you can use a number sign "#" as placeholder for you fieldname; - * e.g. "# > ?"; escaping the number sign is possible with a backslash "\" - * @param {Numeric | Boolean} [fieldType] SQL-column-type; if the fieldType is not given it's loaded automatically; - * The loaded type is cached if no type is given. So it is also safe to use this in a loop. - * e.g. - * for (...) { - * cond.andPrepare("SALESPROJECT_CLASSIFICATION.TYPE", entry, "# <> ?") - * } - * @return {SqlCondition} current SqlCondition-object - * - * @deprecated Use SqlBuilder instead - */ -SqlCondition.prototype.orPrepare = function(field, value, cond, fieldType) { - cond = this._prepare(field, value, cond, fieldType); - return this.or(cond); -} - -/** - * same as the "andPrepare"-function but only applied if the passed "value" is truely - * @param {String | String[]} field the database field as "tablename.columnname"; e.g. "ORGANISATION.NAME" or as array with column-alias: ["ORGANISATION", "NAME", "myorgAlias"] - * @param {String} value the value that shall be set into the prepared statement - * @param {String} [cond="# = ?"] the strucutre of the SQL condition as preparedString, you can use a number sign "#" as placeholder for you fieldname; - * e.g. "# > ?"; escaping the number sign is possible with a backslash "\" - * @param {Numeric | Boolean} [fieldType] SQL-column-type; if the fieldType is not given it's loaded automatically; - * The loaded type is cached if no type is given. So it is also safe to use this in a loop. - * e.g. - * for (...) { - * cond.andPrepare("SALESPROJECT_CLASSIFICATION.TYPE", entry, "# <> ?") - * } - * @return {SqlCondition} current SqlCondition-object - * - * @deprecated Use SqlBuilder instead - */ -SqlCondition.prototype.andPrepareIfSet = function(field, value, cond, fieldType) { - if (value) - return this.andPrepare(field, value, cond, fieldType); - return this; -} - -/** - * same as the "orPrepare"-function but only applied if the passed "value" is truely - * @param {String | String[]} field the database field as "tablename.columnname"; e.g. "ORGANISATION.NAME" or as array with column-alias: ["ORGANISATION", "NAME", "myorgAlias"] - * @param {String} value the value that shall be set into the prepared statement - * @param {String} [cond="# = ?"] the strucutre of the SQL condition as preparedString, you can use a number sign "#" as placeholder for you fieldname; - * e.g. "# > ?"; escaping the number sign is possible with a backslash "\" - * @param {Numeric | Boolean} [fieldType] SQL-column-type; if the fieldType is not given it's loaded automatically; - * The loaded type is cached if no type is given. So it is also safe to use this in a loop. - * e.g. - * for (...) { - * cond.andPrepare("SALESPROJECT_CLASSIFICATION.TYPE", entry, "# <> ?") - * } - * @return {SqlCondition} current SqlCondition-object - * - * @deprecated Use SqlBuilder instead - */ -SqlCondition.prototype.orPrepareIfSet = function(field, value, cond, fieldType) { - if (value) - return this.orPrepare(field, value, cond, fieldType); - return this; -} - -/** - * same as the "andPrepare"-function but with validation of adito-variables functionality - * @param {String | String[]} field the database field as "tablename.columnname"; e.g. "ORGANISATION.NAME" or as array with column-alias: ["ORGANISATION", "NAME", "myorgAlias"] - * @param {String} variable the adito-variable that shall be set into the prepared statement - * @param {String} [cond = "# = ?" ] the strucutre of the SQL condition as preparedString, you can use a number sign "#" as placeholder for you fieldname; - * e.g. "# > ?"; escaping the number sign is possible with a backslash "\" - * @param {Numeric | Boolean} [fieldType] SQL-column-type; if the fieldType is not given it's loaded automatically; - * The loaded type is cached if no type is given. So it is also safe to use this in a loop. - * e.g. - * for (...) { - * cond.andPrepare("SALESPROJECT_CLASSIFICATION.TYPE", entry, "# <> ?") - * } - * @return {SqlCondition} current SqlCondition-object - * - * @deprecated Use SqlBuilder instead - */ -SqlCondition.prototype.andPrepareVars = function(field, variable, cond, fieldType) { - variable = this._checkVars(variable) - if (variable) { - return this.andPrepare(field, variable, cond, fieldType); - } - return this; -} - -/** - * same as the "orPrepare"-function but with validation of adito-variables functionality - * @param {String | String[]} field the database field as "tablename.columnname"; e.g. "ORGANISATION.NAME" or as array with column-alias: ["ORGANISATION", "NAME", "myorgAlias"] - * @param {String} variable the adito-variable that shall be set into the prepared statement - * @param {String} [cond="# = ?"] the strucutre of the SQL condition as preparedString, you can use a number sign "#" as placeholder for you fieldname; - * e.g. "# > ?"; escaping the number sign is possible with a backslash "\" - * @param {Numeric | Boolean} [fieldType] SQL-column-type; if the fieldType is not given it's loaded automatically; - * The loaded type is cached if no type is given. So it is also safe to use this in a loop. - * e.g. - * for (...) { - * cond.andPrepare("SALESPROJECT_CLASSIFICATION.TYPE", entry, "# <> ?") - * } - * @return {SqlCondition} current SqlCondition-object - * - * @deprecated Use SqlBuilder instead - */ -SqlCondition.prototype.orPrepareVars = function(field, variable, cond, fieldType) { - variable = this._checkVars(variable) - if (variable) { - return this.orPrepare(field, variable, cond, fieldType); - } - return this; -} - -/** - * creates a IN-statement out of a field and an array of values. - * Be carefull with a big number of values. This may have a bad performance. - * - * @param {String | String[]} field the database field as "tablename.columnname"; e.g. "ORGANISATION.NAME" or as array with column-alias: ["ORGANISATION", "NAME", "myorgAlias"] - * @param {String[]} values the value that shall be set into the prepared statement - * @param {Numeric | Boolean} [fieldType] SQL-column-type; if the fieldType is not given it's loaded automatically; - * The loaded type is cached if no type is given. So it is also safe to use this in a loop. - * e.g. - * for (...) { - * cond.andPrepare("SALESPROJECT_CLASSIFICATION.TYPE", entry, "# <> ?") - * } - * @param {Boolean} [not = undefined] if true, add not before in - * @return {SqlCondition} current SqlCondition-object - * - * @deprecated Use SqlBuilder instead - */ -SqlCondition.prototype.andIn = function(field, values, fieldType, not) { - return this.andAttachPrepared(this._in(field, values, fieldType, not)); -} - -/** - * creates a IN-statement out of a field and an array of values. - * Be carefull with a big number of values. This may have a bad performance. - * - * @param {String | String[]} field the database field as "tablename.columnname"; e.g. "ORGANISATION.NAME" or as array with column-alias: ["ORGANISATION", "NAME", "myorgAlias"] - * @param {String[]} values the value that shall be set into the prepared statement - * @param {Numeric | Boolean} [fieldType] SQL-column-type; if the fieldType is not given it's loaded automatically; - * The loaded type is cached if no type is given. So it is also safe to use this in a loop. - * e.g. - * for (...) { - * cond.andPrepare("SALESPROJECT_CLASSIFICATION.TYPE", entry, "# <> ?") - * } - * @param {Boolean} [not = undefined] if true, add not before in - * @return {SqlCondition} current SqlCondition-object - * - * @deprecated Use SqlBuilder instead - */ -SqlCondition.prototype.orIn = function(field, values, fieldType, not) { - return this.orAttachPrepared(this._in(field, values, fieldType, not)); -} - -/** - * creates a IN-statement out of a field and an array of values. - * Be carefull with a big number of values. This may have a bad performance. - * - * @param {String | String[]} field the database field as "tablename.columnname"; e.g. "ORGANISATION.NAME" or as array with column-alias: ["ORGANISATION", "NAME", "myorgAlias"] - * @param {String[]} values the value that shall be set into the prepared statement - * @param {Numeric | Boolean} [fieldType] SQL-column-type; if the fieldType is not given it's loaded automatically; - * The loaded type is cached if no type is given. So it is also safe to use this in a loop. - * e.g. - * for (...) { - * cond.andPrepare("SALESPROJECT_CLASSIFICATION.TYPE", entry, "# <> ?") - * } - * @param {Boolean} [not = undefined] if true, add not before in - * @return {SqlCondition} current SqlCondition-object - * - * @deprecated Use SqlBuilder instead - */ -SqlCondition.prototype._in = function(field, values, fieldType, not) { - if (values && values.length > 0) - { - if (fieldType == undefined) - fieldType = SqlUtils.getSingleColumnType(field, undefined, this.alias); - - preparedStatement = SqlUtils.getSqlInStatement(field, values, undefined, true, fieldType); - if (not) - preparedStatement[0] = " not " + preparedStatement[0]; - return preparedStatement; - } - - return null; -} - -/** - * ready to use string; does not contain a where keyword at the beginning - * @param {String} [alternativeCond=""] condition that is returned when nothing has been appended. - * @return {String} concatenated SQL-condition; empty string if nothing has been appended or - if passed - the alternativeCond - * - * @deprecated Use SqlBuilder instead - */ -SqlCondition.prototype.toString = function(alternativeCond) { - if (!this.isSet() && alternativeCond) - return alternativeCond - else - return this._sqlStorage; -} - -/** - * ready to use string; does contain a where keyword at the beginning - * @param {String} [alternativeCond=""] condition that is returned when nothing has been appended. - * @return {SqlCondition} concatenated SQL-condition; empty string if nothing has been appended or - if passed - the alternativeCond - * - * @deprecated Use SqlBuilder instead - */ -SqlCondition.prototype.toWhereString = function(alternativeCond) { - var cond = this.toString(alternativeCond); - if (cond) - return " where " + cond; - else - return cond; -} - -/** - * ready to use prepared condition; does not contain a where keyword at the beginning - * @param {String} [alternativeCond=""] Condition that is returned when nothing has been appended. - * @return {Array[][][]} Prepared condition with [condition, [[field1, type1], [field2, type2]]] - * - * @deprecated Use SqlBuilder instead - */ -SqlCondition.prototype.build = function(alternativeCond) { - return [this.toString(alternativeCond), this.preparedValues]; -} - -/** - * ready to use prepared select - * @param {String} pBeforeCondition Part of the sql before the condition without where (e.g. "select FIRSTNAME from PERSON") - * @param {String} [pAlternativeCond=""] Condition that is returned when nothing has been appended. - * @param {String} [pAfterCondition=""] Part of the sql after the condition (e.g. "order by FIRSTNAME"). - * @param {Boolean} [pWithWere=true] true if where should be added to the bginning - * @return {Array[][][]} Prepared condition with [condition, [[field1, type1], [field2, type2]]] - * - * @deprecated Use SqlBuilder instead - */ -SqlCondition.prototype.buildSql = function(pBeforeCondition, pAlternativeCond, pAfterCondition, pWithWere) { - if (pAfterCondition == undefined) - pAfterCondition = ""; - - if (pWithWere == undefined) - pWithWere = true; - - return [pBeforeCondition + " " + - (pWithWere ? this.toWhereString(pAlternativeCond) : this.toString(pAlternativeCond)) + - " " + pAfterCondition, this.preparedValues]; -} - -/** - * translates SqlCondition to plain SQL. Use this if prepared statements are not supported. - * It resolves all prepared values. - * @param {String} pAlternativeCond used if the SqlCondition does not contain any condition. - * @return {String} plain SQL condition - * - * @deprecated Use SqlBuilder instead - */ -SqlCondition.prototype.translate = function(pAlternativeCond) -{ - return SqlUtils.translateConditionWithQuotes(this.build(pAlternativeCond, this.alias)); -} - -/** - * Check if (adito-)variable exists and vars.getString is not empty - * @param {String} variable the variable name (e.g. "$field.CONTACT_ID") - * @return {String | Boolean} The value of the field as string OR false if it doesn't exist. - * - * @ignore - */ -SqlCondition.prototype._checkVars = function(variable) { - if (vars.exists(variable)) { - var value = vars.getString(variable); - if (value) { - return value; - } - } - return false; -} - -/** - * hidden function for composing preparedStatements - * @param {String | String[]} field the database field as "tablename.columnname"; e.g. "ORGANISATION.NAME" or as array with column-alias: ["ORGANISATION", "NAME", "myorgAlias"] - * @param {String} value the value that shall be set into the prepared statement - * @param {String} cond the strucutre of the SQL condition as preparedString, you can use a number sign "#" as placeholder for you fieldname; - * e.g. "# > ?"; escaping the number sign is possible with a backslash "\" - * Default is "# = ?" - * @param {Numeric | Boolean} [fieldType] SQL-column-type; if the fieldType is not given it's loaded automatically; - * The loaded type is cached if no type is given. So it is also safe to use this in a loop. - * e.g. - * for (...) { - * cond.andPrepare("SALESPROJECT_CLASSIFICATION.TYPE", entry, "# <> ?") - * } - * @return {String} the replaced SQL-condition string (replace # by the fieldname) - * @ignore - */ -SqlCondition.prototype._prepare = function(field, value, cond, fieldType) { - if (value == undefined) - { - throw new Error(translate.withArguments("${SQL_LIB_UNDEFINED_VALUE} field: %0", [field])); - } - - if (cond == undefined) { - cond = "# = ?" - } - - var alias; - - if (typeof field === 'string') - { - var pointPos = field.indexOf("."); - - if (pointPos > 0 && pointPos < field.length-1) - { - alias = field; - } - else - { - throw new Error(translate.withArguments("${SQL_LIB_FIELD_WRONG_FORMAT} field: %0", [field])); - } - } - else - { - if (field.length == 3) - { - alias = field[2] + "." + field[1]; - field = field[0] + "." + field[1]; - } - else - { - throw new Error(translate.withArguments("${SQL_LIB_FIELD_WRONG_FORMAT} field: %0", [field.toSource()])); - } - } - - var type; - - if (fieldType == undefined) - fieldType = SqlUtils.getSingleColumnType(field, undefined, this.alias); - - //this function looks more complex (and slower) than it actually is - /* the following regex looks like this after javascript-escaping of the backslash: (?<!\\)((?:\\\\)*)# - the regexp searches for the unescaped character and these characters are replaced by the field name - - examples: - --------------------- - | # --match | - | \# --no-match | - | \\# --match | - | \\\# --no-match | - | \\\\# --match | - --------------------- - */ - //use replaceAll because it's faster and supports negative lookbehinds - cond = text.replaceAll(cond, { - //manually readd the replaced backslashes by using a group reference, because they a part of the match and therefore replaced by "replaceAll" - //since the field COULD contain already a group reference (I think this is extremely uncommon; - //probably that never happens but better stay save): escape that references within the fieldname - "(?<!\\\\)((?:\\\\\\\\)*)#": "$1" + text.replaceAll(alias, { - "$1": "\\$1" - }), - //now that we've replaced the correct field placeholder let's replace the escaped number sign "\#" to a normal number sign "#" - "\\\\#": "#" - }); - - - - type = fieldType - this.preparedValues.push([value.toString(), type]); - return cond; -} - - -/** - * function that resets the current SqlCondition as if no conditions would have been added - * this is usefull if you want to reuse the same object over and over - * @return {null} - * - * @deprecated Use SqlBuilder instead - */ -SqlCondition.prototype.clear = function() { - this._sqlStorage = ""; - this.preparedValues = []; - return this; -} - -/** - * hidden function for initializing all properties for the sql conditions - * @return {null} - * - * @ignore - */ -SqlCondition.prototype._init = function() { - //init only wraps the clear function to avoid confusion in the constructor (and provide better extensibility) - return this.clear(); -} - -// some static functions for often used tasks. They are only provided for very simple tasks. - -/** - * pField = pValue - * @param {String} pField the database field as "tablename.columnname"; e.g. "ORGANISATION.NAME" - * @param {String} pValue the value that shall be set into the prepared statement - * @param {String} [pAlternativeCond=""] Condition that is returned when nothing has been appended. - * @param {String} [pAlias=the current alias] the database alias where the condition shall be executed later (important for column types of preparedStatements) - * - * @return {Array[][][]} Prepared condition with [condition, [[field, type]]] - * - * @deprecated Use SqlBuilder instead - */ -SqlCondition.equals = function(pField, pValue, pAlternativeCond, pAlias) -{ - return SqlCondition.begin(pAlias).andPrepare(pField, pValue).build(pAlternativeCond); -} - -/** - * pField <> pValue - * @param {String} pField the database field as "tablename.columnname"; e.g. "ORGANISATION.NAME" - * @param {String} pValue the value that shall be set into the prepared statement - * @param {String} [pAlternativeCond=""] Condition that is returned when nothing has been appended. - * @param {String} [pAlias=the current alias] the database alias where the condition shall be executed later (important for column types of preparedStatements) - * - * @return {Array[][][]} Prepared condition with [condition, [[field, type]]] - * - * @deprecated Use SqlBuilder instead - */ -SqlCondition.equalsNot = function(pField, pValue, pAlternativeCond, pAlias) -{ - return SqlCondition.begin(pAlias).andPrepare(pField, pValue, "# <> ?").build(pAlternativeCond); -} - function newSelect(pFields, pAlias) { return new SqlBuilder(pAlias).select(pFields); @@ -980,13 +300,6 @@ SqlBuilder.prototype.rightJoin = function(pTable, pCondition, pTableAlias) */ SqlBuilder.prototype.where = function(pFieldOrCond, pValue, pCond, pFieldType) { - // for deprecated use (setting to a SqlCondition) - if (pFieldOrCond instanceof SqlCondition && pValue === undefined && pCond === undefined && pFieldType === undefined) - { - this._where.preparedValues = pFieldOrCond.preparedValues; - this._where._sqlStorage = pFieldOrCond._sqlStorage - return this; - } return this._setWhere(pFieldOrCond, pValue, pCond, pFieldType, this.or); } -- GitLab