Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Microsoft SQL Server: Issue with NTEXT in Criteria Using TextMatchStyle

    similar case: https://forums.smartclient.com/forum...-with-criteria

    smartgwt.version=13.0-p20241123

    It seems to me that similar issue still occurs in connection with the parameter request.setTextMatchStyle("exactCase"). Depending on whether this parameter is set, an N is added before the string in MSSQL or not in WHERE.


    without: setTextMatchStyle("exactCase")
    The following generated SQL query works correctly:
    Code:
     UPDATE PROSTYN SET kod='20', opis=N'Zażółć gęślą jaźń:2' WHERE (PROSTYN.id=1 AND LOWER(PROSTYN.opis)=N'zażółć gęślą jaźń')

    with: setTextMatchStyle("exactCase")
    there is no 'N' before the text literal, and the condition does not work correctly:

    Code:
     UPDATE PROSTYN SET kod='20', opis=N'Zażółć gęślą jaźń:2' WHERE (PROSTYN.id=1 AND PROSTYN.opis='Zażółć gęślą jaźń')

    sample code:

    Code:
    Map<String, Object> newValues = new HashMap<String, Object>();
    newValues.put("opis", "Zażółć gęślą jaźń:2");
    newValues.put("kod", "20");
    newValues.put("id", 1);
    Map<String, Object> oldValues = new HashMap<String, Object>();
    oldValues.put("opis", "Zażółć gęślą jaźń:1");
    oldValues.put("kod", "10");
    oldValues.put("id", "1");
    DSTransaction dst = new DSTransaction();
    DSRequest reqx = new DSRequest("prosty", "update");
    reqx.setOperationType("update");
    reqx.addToCriteria("id", 1);
    reqx.addToCriteria("opis","Zażółć gęślą jaźń");
    reqx.setAllowMultiUpdate(true);
    reqx.setValues(newValues);
    reqx.setOldValues(oldValues);
    reqx.setDsTransaction(dst);
    
    reqx.setTextMatchStyle("exactCase"); //            <------------ !!!!!
    
    dst.registerRequest(reqx);
    dst.processQueue();
    dst.complete();
    prosty.ds.xml :
    Code:
    <DataSource ID="prosty" serverType="sql" dbName="MSSQLX" tableName="PROSTYN">
    <fields>
    <field name="id" type="integer" primaryKey="true"></field>
    <field name="opis" type="ntext" length="40"></field>
    <field name="kod" type="text" length="10"></field>
    </fields>
    </DataSource>
    Last edited by Sanmargar; 16 Jan 2025, 01:53.

    #2
    This issue has been resolved and will be available for download in the nightly builds since January 20. Please let us know how it works for you.

    Comment

    Working...
    X