Vitaliy Serdtsev · Apr 13, 2022 go to post

What locale are you using? I use "rusw".

Try to do the following in SMP:

update MSDS_Serenity.KitlabelAssoc set PackingTimeSpent=35000 where label='00007IT4'

then

select

  PackingTimeSpent,
  %internal(PackingTimeSpentptsLOGICAL,
  %external(PackingTimeSpentptsDISPLAY,
  %odbcout(PackingTimeSpent)  ptsODBC

from MSDS_Serenity.KitlabelAssoc where label='00007IT4'

What are your results?

I have the following displayed (for DISPLAY mode):

PackingTimeSpent = 09:43:20
ptsLOGICAL = 35000
ptsDISPLAY = 09:43:20
ptsODBC = 09:43:20

Vitaliy Serdtsev · Apr 13, 2022 go to post

Notes on Indices Defined in Classes

When working with indices in class definitions, here are some points to keep in mind:

• Index definitions are only inherited from the primary (first) superclass.
• ...
 

Simple sample

Class dc.Aclass Abstract ]
{

Index idxF On f;

Property As %Integer;

}

Class dc.test Extends (dc.Aclass%Persistent) [ ClassType = persistent ]
{

ClassMethod Test()
{
  ^dc.testD,^dc.testI
  
  &sql(insert into dc.test(fvalues(30))
  &sql(insert into dc.test(fvalues(303))
  
  zw ^dc.testD,^dc.testI
}

}

Output:

USER>##class(dc.test).Test()
^dc.testD=2
^dc.testD(1)=$lb("",30)
^dc.testD(2)=$lb("",303)
^dc.testI("idxF",30,1)=""
^dc.testI("idxF",303,2)=""
Vitaliy Serdtsev · Apr 13, 2022 go to post

having the field defined as integer would allow selecting avg but running a query in my Zen page wouldn’t show me a time format

If you the field is defined as %Integer or %String, then this is incorrect. The field type must be %Time. In this case, a time will be stored in the database as number, and the query will display the time as a string.

Here is a small example:

select 166 seconds,%external(cast(+166.5 as TIME)) "avg"

Output:

seconds = 166
avg = 00:02:46
 

Simple sample

Class dc.test Extends %Persistent
{

Property As %Time;

ClassMethod Test()
{
  
  ..%KillExtent()
  
  &sql(insert into dc.test(tvalues(30))
  &sql(insert into dc.test(tvalues(303))
  
  zw ^dc.testD

  !
  
  st=##class(%SQL.Statement).%New()
  st.%SelectMode=2
  st.%ExecDirect(.st,"select t, %internal(t) tINT, %external(t) tSTR, avg(t) average,CAST(+avg(t) as TIME) avgSTR from dc.test").%Display()

  ; or
  !!
  
  ##class(%SQL.Statement).%ExecDirect(,"select t, %internal(t) tINT, %external(t) tSTR, avg(t) average,%external(CAST(+avg(t) as TIME)) avgSTR from dc.test").%Display()
}

}

Output:

USER>##class(dc.test).Test()
^dc.testD=2
^dc.testD(1)=$lb("",30)
^dc.testD(2)=$lb("",303)
t tINT tSTR average avgSTR
00:00:30 30 00:00:30 166.5 00:02:46
00:05:03 303 00:05:03 166.5 00:02:46

  2 Rows(s) Affected

t tINT tSTR average avgSTR
30 30 00:00:30 166.5 00:02:46
303 303 00:05:03 166.5 00:02:46

  2 Rows(s) Affected

Vitaliy Serdtsev · Apr 12, 2022 go to post

By default, data in the global is stored as

glbD(ID)=$LB(%%CLASSNAME,prop1,prop2,..,propN)

The total size of the string cannot exceed 3641144. Therefore, if you have a field length >3.6E6, and there are several such fields, the limit is exceeded. To work around this, you need to change storage for your class.

For example so:

glbD(ID)=$LB(%%CLASSNAME)
glbD(ID,"prop1")=prop1
glbD(ID,"prop2")=prop2
...
glbD(ID,"propN")=propN
 

Simple example

Class dc.test Extends %Persistent
{

Index mySimilarityIndex On SettingsJSON(KEYS) [ Data = SettingsJSON(ELEMENTS) ];

Index mySimilaritybackupIndex On SettingsJSONbackup(KEYS) [ Data = SettingsJSONbackup(ELEMENTS) ];

Property SettingsJSON As %Text(LANGUAGECLASS "%Text.English"MAXLEN 3600000SIMILARITYINDEX "mySimilarityIndex");

Property SettingsJSONbackup As %Text(LANGUAGECLASS "%Text.English"MAXLEN 3600000SIMILARITYINDEX "mySimilaritybackupIndex");

ClassMethod Test()
{
  
  ..%KillExtent()
  
  json=$tr($j("",3600000)," ","0")
  &sql(insert into dc.test(SettingsJSON,SettingsJSONbackupvalues(:json,:json))
  
  w $l(json),":",SQLCODE
}

Storage Default
{
<Data name="backup">
  <Attribute>SettingsJSONbackup</Attribute>
  <Structure>node</Structure>
  <Subscript>"SettingsJSONbackup"</Subscript>
</Data>
<Data name="json">
  <Attribute>SettingsJSON</Attribute>
  <Structure>node</Structure>
  <Subscript>"SettingsJSON"</Subscript>
</Data>
<Data name="testDefaultData">
  <Value name="1">
    <Value>%%CLASSNAME</Value>
  </Value>
</Data>
<DataLocation>^dc.testD</DataLocation>
<DefaultData>testDefaultData</DefaultData>
<IdLocation>^dc.testD</IdLocation>
<IndexLocation>^dc.testI</IndexLocation>
<StreamLocation>^dc.testS</StreamLocation>
<Type>%Library.CacheStorage</Type>
}

}
Vitaliy Serdtsev · Apr 12, 2022 go to post

Choose according to your taste:

<FONT COLOR="#0000ff">#include </FONT><FONT COLOR="#000000">%systemInclude

</FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">s</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#0000ff">$c</FONT><FONT COLOR="#000000">(34,34)</FONT><FONT COLOR="#008000">"te""""st"</FONT><FONT COLOR="#000000"></FONT><FONT COLOR="#0000ff">$c</FONT><FONT COLOR="#000000">(34,34)    </FONT><FONT COLOR="#0000ff">w </FONT><FONT COLOR="#800000">s</FONT><FONT COLOR="#000000">,!,   </FONT><FONT COLOR="#000080">##class</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008080">%Global</FONT><FONT COLOR="#000000">).</FONT><FONT COLOR="#0000ff">UndoubleInnerQuotes</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">s</FONT><FONT COLOR="#000000">),!,   </FONT><FONT COLOR="#0000ff">$$$StripQuotes</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">s</FONT><FONT COLOR="#000000">),!,   </FONT><FONT COLOR="#0000ff">$tr</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">s</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#0000ff">$c</FONT><FONT COLOR="#000000">(34),</FONT><FONT COLOR="#008000">""</FONT><FONT COLOR="#000000">)</FONT>

Output: USER>d ^test ""te""st"" "te"st" "te"st" test

Vitaliy Serdtsev · Apr 11, 2022 go to post

I'm not sure if it's %Text at all.

Made a small example:

<FONT COLOR="#000080">Class dc.test Extends %Persistent
</FONT><FONT COLOR="#000000">{

</FONT><FONT COLOR="#000080">Index </FONT><FONT COLOR="#000000">mySimilarityIndex On SettingsJSON(KEYS) [ </FONT><FONT COLOR="#000080">Data </FONT><FONT COLOR="#000000">= SettingsJSON(ELEMENTS) ];

</FONT><FONT COLOR="#000080">Property </FONT><FONT COLOR="#000000">SettingsJSON </FONT><FONT COLOR="#000080">As %Text</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#000080">LANGUAGECLASS </FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#800080">"%Text.English"</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#000080">MAXLEN </FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#000080">3600000</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#000080">SIMILARITYINDEX </FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#800080">"mySimilarityIndex"</FONT><FONT COLOR="#000000">);

</FONT><FONT COLOR="#000080">ClassMethod </FONT><FONT COLOR="#000000">Test() {   </FONT><FONT COLOR="#0000ff">d </FONT><FONT COLOR="#000000">..</FONT><FONT COLOR="#0000ff">%KillExtent</FONT><FONT COLOR="#000000">()      </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">json</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#0000ff">$tr</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#0000ff">$j</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">""</FONT><FONT COLOR="#000000">,3600000),</FONT><FONT COLOR="#008000">" "</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008000">"0"</FONT><FONT COLOR="#000000">)   </FONT><FONT COLOR="#800080">&sql(</FONT><FONT COLOR="#0000ff">insert </FONT><FONT COLOR="#000080">into </FONT><FONT COLOR="#008000">del</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#008000">t</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">SettingsJSON</FONT><FONT COLOR="#000000">) </FONT><FONT COLOR="#000080">values</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">:json</FONT><FONT COLOR="#000000">)</FONT><FONT COLOR="#800080">)      </FONT><FONT COLOR="#0000ff">w $l</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">json</FONT><FONT COLOR="#000000">),</FONT><FONT COLOR="#008000">":"</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">SQLCODE </FONT><FONT COLOR="#000000">}

}</FONT>

Output: 3600000:0

Vitaliy Serdtsev · Apr 11, 2022 go to post

Here's what I found: IndexClass (%Dictionary.ClassDefinition) IndexClass (%Dictionary.CompiledClass)

That is, you can write something like this:

Class dc.test Extends %Persistent IndexClass dc.anothertest ]
{
}

The same applies to MemberSuper.

Unfortunately, I haven't found any examples of how to use it or if it works at all.

Vitaliy Serdtsev · Apr 11, 2022 go to post
Class dc.test Extends %Persistent
{

Property As %Integer;

ClassMethod Test()
{

  ..%KillExtent()

  &sql(insert into dc.test(Fvalues(22))
  &sql(insert into dc.test(Fvalues(11))

  label "00007I0Q"
  &sql(select ID into :cnt from dc.test where ID :label)
  
  SQLCODE,":",cnt
}

}

Output for Caché 2018.1:

100:00007I0Q

Output for IRIS 2021.2:

100:

PS: it is a pity that my answer was ignored.

Vitaliy Serdtsev · Apr 11, 2022 go to post

Any event that occurs outside of the modal group (such as a mouse click) automatically hides the modal groupproof.

Use Popup windows with modal=yes or Dialogs.

PS: if you really need to use "Model Groups", then you need to do two things for this:

  1. override the method onCanEndModalHandler
  2. override the method hideGroup(). This is necessary to prohibit the close button in the upper right corner
 

Here is a small variant:

Class dс.test Extends %ZEN.Component.page
{

XData Contents [ XMLNamespace "http://www.intersystems.com/zen" ]
{
<page xmlns="http://www.intersystems.com/zen">
  <button caption="Show modal group" onclick="zenPage.show();"/>
  <modalGroup id="mgStatic" groupTitle="Popup">
    <text id="mgText" label="Value:" />
    <button caption="OK" onclick="zenPage.mgBtnClick();"/>
  </modalGroup>
</page>
}

ClientMethod show() [ Language = javascript ]
{
  zenPage.__canClose false;
  var mg zen('mgStatic');
  
  mg.onCanEndModalHandler this.onCanEndModalHandler();
  mg.hideGroup=this.hideGroup;

  mg.show();
}

ClientMethod mgBtnClick() [ Language = javascript ]
{
  zenPage.__canClose=true;
  zen('mgStatic').onCanEndModalHandler=null;

  zenAlert('User entered: ' +  zen('mgText').getValue());
  
  // hide the modal group
  zenPage.endModal();
}

ClientMethod onCanEndModalHandler() [ Language = javascript ]
{
  return true;
}

/// Hide the group.
ClientMethod hideGroup() [ Language = javascript ]
{
  if (!zenPage.__canClose) return;
  
  if (this.groupType == 'dialog'this._canClose true;
  var div this.getFloatingDiv();
  if (div) {
    div.style.opacity = 0;
  }
  if ((!zenIsHTML5) || (!window.TransitionEnd)) {
    if (!this._closing) {
      zenPage.endModal();
      this._closing true;
    }
  }
}

}
Vitaliy Serdtsev · Apr 11, 2022 go to post

Hi Ben.

For some reason, only IRIS 2021.1CE is available for Windows, although IRIS 2021.2CE is available for many other operating systems, such as MacOSX.

Is it possible for Windows to update the version to 2021.2 too?

Vitaliy Serdtsev · Apr 11, 2022 go to post

You should always check the SQLCODE after the embedded query.
If you do this, you will see that the SQLCODE returns the value 100 for your case. In this case, you should ignore host variables.

Host Variables

Vitaliy Serdtsev · Apr 7, 2022 go to post

One of the options:

<FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">rs</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#000080">##class</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008080">%ScrollableResultSetdoc</FONT><FONT COLOR="#000000">).</FONT><FONT COLOR="#0000ff">%New</FONT><FONT COLOR="#000000">()
</FONT><FONT COLOR="#0000ff">d </FONT><FONT COLOR="#800000">rs</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">Prepare</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">sql</FONT><FONT COLOR="#000000">)
</FONT><FONT COLOR="#0000ff">d </FONT><FONT COLOR="#800000">rs</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">Execute</FONT><FONT COLOR="#000000">()
</FONT><FONT COLOR="#0000ff">w </FONT><FONT COLOR="#800000">rs</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">Count</FONT><FONT COLOR="#000000">()</FONT>

Vitaliy Serdtsev · Apr 7, 2022 go to post

Is it OK to use this partially rebuilt index if I don't care about data that isn't indexed? Did you do this before?

I didn't build indexes manually, except for tests. If the index is not built for all data, then the query will see only the data for which the index exists.

 

Try simple example:

Class dc.test Extends %Persistent
{

Index iF On F;

Property As %Integer;

ClassMethod Fill(10)
{
  ^dc.testD,^dc.testI

  ^dc.testD=4
  ^dc.testD(1)=$lb("",22)
  ^dc.testD(2)=$lb("",11)
  ^dc.testD(3)=$lb("",44)
  ^dc.testD(4)=$lb("",33)
  

  d $system.SQL.TuneTable($classname(),$$$YES)
  d $system.OBJ.Compile($classname(),"cu-d")
  
  ^dc.testI
  
  ##class(%SQL.Statement).%ExecDirect(,"select * from dc.test").%Display()

  ^dc.testI("iF",1,22)="" !!

  ##class(%SQL.Statement).%ExecDirect(,"select * from dc.test").%Display()

  ^dc.testI("iF",4,33)=""  !!

  ##class(%SQL.Statement).%ExecDirect(,"select * from dc.test").%Display()
}

}
Vitaliy Serdtsev · Apr 7, 2022 go to post

If we open the source code of the class for the Status field, we will see the following:

<FONT COLOR="#000080">Class Ens.DataType.MessageStatus Extends %Integer
</FONT><FONT COLOR="#000000">{

</FONT><FONT COLOR="#000080">Parameter </FONT><FONT COLOR="#000000">DISPLAYLIST = </FONT><FONT COLOR="#800080">",Created,Queued,Delivered,Discarded,Suspended,Deferred,Aborted,Error,Completed"</FONT><FONT COLOR="#000000">;

</FONT><FONT COLOR="#000080">Parameter </FONT><FONT COLOR="#000000">VALUELIST = </FONT><FONT COLOR="#800080">",1,2,3,4,5,6,7,8,9"</FONT><FONT COLOR="#000000">;

}</FONT>

Therefore , the following conclusions can be drawn:

  1. For Embedded SQL the RuntimeMode is Logical
  2. For SQL Explorer (Portal) the RuntimeMode is Display

Hence the leapfrog in the results.

Vitaliy Serdtsev · Apr 7, 2022 go to post

Try this:

<FONT COLOR="#000080">ClassMethod </FONT><FONT COLOR="#000000">OnStartRequest() </FONT><FONT COLOR="#000080">As %Status
</FONT><FONT COLOR="#000000">{
  </FONT><FONT COLOR="#0000ff">#dim </FONT><FONT COLOR="#800000">%response </FONT><FONT COLOR="#0000ff">As </FONT><FONT COLOR="#008080">%CSP.Response
  
  </FONT><FONT COLOR="#008000">;s %response.ContentType="text/html",%response.Expires=-1
  </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">%response</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">Status</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#000080">##class</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008080">%CSP.REST</FONT><FONT COLOR="#000000">).</FONT><FONT COLOR="#0000ff">#HTTP403FORBIDDEN
  q $$$OK
</FONT><FONT COLOR="#000000">}</FONT>
Or this:
<FONT COLOR="#000080">/// Event handler for <b>PreHTTP</b> event: this is invoked before
/// the HTTP headers for a CSP page have been sent.  All changes to the
/// <class>%CSP.Response</class> class, such as adding cookies, HTTP headers,
/// setting the content type etc. must be made from within the OnPreHTTP() method.
/// Also changes to the state of the CSP application such as changing
/// %session.EndSession or %session.AppTimeout must be made within the OnPreHTTP() method.
/// It is prefered that changes to %session.Preserve are also made in the OnPreHTTP() method
/// as this is more efficient, although it is supported in any section of the page.
/// Return <b>0</b> to prevent <method>OnPage</method> from being called.
ClassMethod </FONT><FONT COLOR="#000000">OnPreHTTP() </FONT><FONT COLOR="#000080">As %Boolean </FONT><FONT COLOR="#000000">[ </FONT><FONT COLOR="#000080">ServerOnly </FONT><FONT COLOR="#000000">= 1 ]
{
  </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">%response</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">Status</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"403 Forbidden"
  </FONT><FONT COLOR="#0000ff">q </FONT><FONT COLOR="#000000">0
}</FONT>

Vitaliy Serdtsev · Apr 7, 2022 go to post

We need to look at your full code, since there is nothing suspicious in the specified piece of code. I made a small example and there is no highlighting of the last line:

 

Source code

Class dс.test Extends %ZEN.Component.page
{

XData Contents [ XMLNamespace "http://www.intersystems.com/zen" ]
{
<page xmlns="http://www.intersystems.com/zen">
  <tablePane
      width="1200px"
      id="ItemsTable" 
      OnCreateResultSet="GetLog"
      maxRows="20000" 
      pageSize="20" 
      showRowNumbers="false"
      showRowSelector="false"
      showZebra="false"
      valueColumn="ID" 
      nowrap="false"
      showValueInTooltip="true"
      showFilters="true"
      autoExecute="true"
      initialExecute="false"
      useSnapshot="true" 
      onselectrow="">
  <parameter />
  <parameter />
  <parameter />
  <parameter />
  <parameter />
  <parameter />
  <parameter />
      <column colName="Sit" header="Sit name" width="50%" style="text-align:left;" filterType="text" filterOp="[" />
      <column colName="Label"  header="Label" width="10%" filterType="text" filterOp="["/>
      <column colName="userno" header="Packed By" width="10%" filterType="text" filterOp="["/>
      <column colName="LogedDate" header="Packed Date" width="10%" />
      <column colName="LogedTime" header="Packed Time" width="10%" />
      <column colName="TimeSpent" header="Spent Time" width="10%" style="text-align:left;"/>
    
  </tablePane>
  <tableNavigatorBar tablePaneId="ItemsTable"/>
</page>
}

Method GetLog(
  ByRef pSC,
  ByRef tParams)
{
  sql = 5
  sql(1)="SELECT 0 ID,'Sit' Sit,'Label' Label,'userno' userno,current_date LogedDate,current_date LogedTime,null TimeSpent"
  sql(2)="union"
  sql(3)="SELECT 1,'Sit','Label','userno',current_date,current_date,null"
  sql(4)="union"
  sql(5)="SELECT 2,'Sit','Label','userno',current_date,current_date,null"

  st=##class(%SQL.Statement).%New()
  st.%SelectMode=2
  ##class(%SQL.Statement).%ExecDirect(st,.sql)
}

}
Vitaliy Serdtsev · Apr 7, 2022 go to post

I confirm (used the following code):

<FONT COLOR="#0000ff">#include </FONT><FONT COLOR="#000000">%systemInclude
</FONT><FONT COLOR="#0000ff">n
try</FONT><FONT COLOR="#800080">{

  </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">sql</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"select  from (select 0 field union select 1) where 0=1"      </FONT><FONT COLOR="#0000ff">#dim </FONT><FONT COLOR="#800000">rs </FONT><FONT COLOR="#0000ff">As </FONT><FONT COLOR="#008080">%SQL.StatementResult</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#000080">##class</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008080">%SQL.Statement</FONT><FONT COLOR="#000000">).</FONT><FONT COLOR="#0000ff">%ExecDirect</FONT><FONT COLOR="#000000">(,</FONT><FONT COLOR="#800000">sql</FONT><FONT COLOR="#000000">)   </FONT><FONT COLOR="#0000ff">w </FONT><FONT COLOR="#800000">rs</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">%SQLCODE      s </FONT><FONT COLOR="#800000">st </FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#000080">##class</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008080">%SQL.Statement</FONT><FONT COLOR="#000000">).</FONT><FONT COLOR="#0000ff">%New</FONT><FONT COLOR="#000000">()   </FONT><FONT COLOR="#0000ff">$$$ThrowOnError</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">st</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">%Prepare</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">sql</FONT><FONT COLOR="#000000">))   </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">rs </FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#800000">st</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">%Execute</FONT><FONT COLOR="#000000">()   </FONT><FONT COLOR="#0000ff">w </FONT><FONT COLOR="#000000">!,</FONT><FONT COLOR="#008000">"---"</FONT><FONT COLOR="#000000">,!,</FONT><FONT COLOR="#800000">rs</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">%SQLCODE      </FONT><FONT COLOR="#800080">&sql(</FONT><FONT COLOR="#0000ff">select </FONT><FONT COLOR="#000080"> from </FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#0000ff">select </FONT><FONT COLOR="#000000">0 </FONT><FONT COLOR="#008000">field </FONT><FONT COLOR="#000080">union </FONT><FONT COLOR="#0000ff">select </FONT><FONT COLOR="#000000">1) </FONT><FONT COLOR="#000080">where </FONT><FONT COLOR="#000000">0=1</FONT><FONT COLOR="#800080">)   </FONT><FONT COLOR="#0000ff">w </FONT><FONT COLOR="#000000">!,</FONT><FONT COLOR="#008000">"---"</FONT><FONT COLOR="#000000">,!,</FONT><FONT COLOR="#800000">SQLCODE

</FONT><FONT COLOR="#800080">}</FONT><FONT COLOR="#0000ff">catch</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">ex</FONT><FONT COLOR="#000000">)</FONT><FONT COLOR="#800080">{   </FONT><FONT COLOR="#0000ff">w </FONT><FONT COLOR="#008000">"Error "</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">ex</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">DisplayString</FONT><FONT COLOR="#000000">(),! </FONT><FONT COLOR="#800080">}</FONT>

Output: 0

0

100

Quote from the documentation:
When retrieving results, first check for successful execution by examining %SQLCODE. For many statement types, success/failure is all that is needed. The %SQLCODE property contains the SQL error code value. Successful completion values are 0 (successful completion) and 100 (the operation has either found no data or reached the end of the data).proof

Vitaliy Serdtsev · Apr 5, 2022 go to post

My choice of a comparison tool was determined by the OS on which Studio is running. But you are free to choose something more platform-independent, such as Java or Qt.

By the way, SQL Data Lens (written in Java) already has the ability to view and upload sources to a file. It would be nice to add integration with a third-party tool for comparing items (by analogy with Studio).

I hope @Andreas Schneider will read this wish.

Vitaliy Serdtsev · Apr 5, 2022 go to post

Can we find out what you need it for?

See Collation

Example:

<FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">sub1</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#000080">##class</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008080">%Collation</FONT><FONT COLOR="#000000">).</FONT><FONT COLOR="#0000ff">SqlString</FONT><FONT COLOR="#000000">(111),
 </FONT><FONT COLOR="#800000">sub2</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#0000ff">$system</FONT><FONT COLOR="#008080">.Util</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">Collation</FONT><FONT COLOR="#000000">(444,8)
     
</FONT><FONT COLOR="#0000ff">k </FONT><FONT COLOR="#800000">t
</FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">t</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">sub1</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">sub2</FONT><FONT COLOR="#000000">)=</FONT><FONT COLOR="#008000">""
</FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">t</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">sub2</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">sub1</FONT><FONT COLOR="#000000">)=</FONT><FONT COLOR="#008000">""
</FONT><FONT COLOR="#0000ff">zw </FONT><FONT COLOR="#800000">t</FONT>

Output:

t(" 111"," 444")=""
t(" 444"," 111")=""

Vitaliy Serdtsev · Apr 5, 2022 go to post
This Compare only works when working with the studio, correct?
Yes, Studio does the following:
  1. uploads the first source code to a temporary directory (for example c:\windows\temp)
  2. uploads the second source code to a temporary directory
  3. starts WinMerge by passing in the command line links to previously uploaded files: WinMerge Command line

You can do all this yourself from a batch file. In this case, you can compare items not only in different databases, but also on different servers.

Vitaliy Serdtsev · Apr 5, 2022 go to post

Most of the above is true for WinMerge, with one exception - WinMerge is free. WinMerge has plugins for comparing images, PDF, Word, Visio, Excel, PowerPoint, etc.