diff --git a/.liquibase/Data_alias/basic/2020.2.2/alter_CampaignParticipantResponsibleIndex.xml b/.liquibase/Data_alias/basic/2020.2.2/alter_CampaignParticipantResponsibleIndex.xml new file mode 100644 index 0000000000000000000000000000000000000000..6360542b2dff79630a5591fcbd5f4b8b2287ad87 --- /dev/null +++ b/.liquibase/Data_alias/basic/2020.2.2/alter_CampaignParticipantResponsibleIndex.xml @@ -0,0 +1,10 @@ +<?xml version="1.1" encoding="UTF-8" standalone="no"?> +<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> + <changeSet author="a.voegl" id="6d545d51-b838-4325-9573-5fe51eade79b"> + <createIndex indexName="IDX_CAMPAIGNPART_RES_CONTACT" tableName="CAMPAIGNPARTICIPANT"> + <column name="RESPONSIBLE_CONTACT_ID"/> + </createIndex> + </changeSet> +</databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2020.2.2/changelog.xml b/.liquibase/Data_alias/basic/2020.2.2/changelog.xml index 302d930f6b09cf8b2828ace28753b097d44bd668..2a4bea7a4e0949d9504cea14b44a0f11cf14b25d 100644 --- a/.liquibase/Data_alias/basic/2020.2.2/changelog.xml +++ b/.liquibase/Data_alias/basic/2020.2.2/changelog.xml @@ -6,6 +6,7 @@ <include relativeToChangelogFile="true" file="insert_employeeCountAttribute.xml"/> <include relativeToChangelogFile="true" file="alter_CampaignParticipantResponsible.xml"/> <include relativeToChangelogFile="true" file="alter_TableLeadStatus.xml"/> + <include relativeToChangelogFile="true" file="alter_CampaignParticipantResponsibleIndex.xml"/> <include relativeToChangelogFile="true" file="MSTeams/changelog.xml"/> <include relativeToChangelogFile="true" file="insert_newsletterAttribute.xml"/> <include relativeToChangelogFile="true" file="readd_ExporttemplateIndizes.xml"/> diff --git a/process/Sql_lib/process.js b/process/Sql_lib/process.js index d4d8afdaa40296cadc2c172ef2e077dc8575e066..08f4d90d0b5c4467a554ae6f1b4003ffbdb5f832 100644 --- a/process/Sql_lib/process.js +++ b/process/Sql_lib/process.js @@ -4253,10 +4253,11 @@ SqlUtils.getSqlInStatement = function(pFieldname, pData, pQuoteSymbol, pAsPrepar } /** -* resolves key-value pairs (of strings) into a case when expression +* resolves key-value pairs (of strings) into a case when expression; +* This function tries to get the columntype for better type comparison * * @param {String[][]} pKeyValueArray you've to pass a 2D-Array where each element has at pos0 the key and pos1 the value -* @param {String} pDbFieldName name fo the database field where the KEY-value is stored +* @param {String} pDbFieldName name fo the database field where the KEY-value is stored; prefers TABLENAME.COLUMNNAME * @param {String} [pLocale=current client language] specifies the locale for translating the title; can be false if nothing shalle be translated * * @return {String} a SQL-expression (case-when-statement) that resolves the KEYID into the title -> as preparedSatement-elements @@ -4278,7 +4279,13 @@ SqlUtils.getResolvingCaseWhen = function(pKeyValueArray, pDbFieldName, pLocale) }; //!SqlBuilder var resSql = "case ", preparedValues = []; - var colTypeKeyId = SQLTYPES.CHAR; + + var colTypeKeyId = SQLTYPES.CHAR; //the standard type is char + var fields = SqlUtils._parseFieldQualifier(pDbFieldName); //validate the DB-field for proper form (CONTACT.CONTACTID) + if (!(fields instanceof TypeError)) + colTypeKeyId = SqlUtils.getSingleColumnType(pDbFieldName, undefined, this.alias); + //some databases dont auto cast on their own so we need the proper type + var colTypeTitle = SQLTYPES.NVARCHAR; for (var i = 0, l = keyData.length; i < l; i++) {