go to post Vitaliy Serdtsev · Apr 7, 2022 One of the options: s rs=##class(%ScrollableResultSetdoc).%New() d rs.Prepare(sql) d rs.Execute() w rs.Count()
go to post Vitaliy Serdtsev · Apr 7, 2022 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 F As %Integer; ClassMethod Fill(N = 10) { k ^dc.testD,^dc.testI s ^dc.testD=4 s ^dc.testD(1)=$lb("",22) s ^dc.testD(2)=$lb("",11) s ^dc.testD(3)=$lb("",44) s ^dc.testD(4)=$lb("",33) d $system.SQL.TuneTable($classname(),$$$YES) d $system.OBJ.Compile($classname(),"cu-d") k ^dc.testI d ##class(%SQL.Statement).%ExecDirect(,"select * from dc.test").%Display() s ^dc.testI("iF",1,22)="" w !! d ##class(%SQL.Statement).%ExecDirect(,"select * from dc.test").%Display() s ^dc.testI("iF",4,33)="" w !! d ##class(%SQL.Statement).%ExecDirect(,"select * from dc.test").%Display() } }
go to post Vitaliy Serdtsev · Apr 7, 2022 The %BuildIndices() supports partial rebuilding - see parameters pStartID, pEndID In addition, you can activate/deactivate the index: Building Indices on a READ and WRITE Active System
go to post Vitaliy Serdtsev · Apr 7, 2022 If we open the source code of the class for the Status field, we will see the following: Class Ens.DataType.MessageStatus Extends %Integer { Parameter DISPLAYLIST = ",Created,Queued,Delivered,Discarded,Suspended,Deferred,Aborted,Error,Completed"; Parameter VALUELIST = ",1,2,3,4,5,6,7,8,9"; }Therefore , the following conclusions can be drawn: For Embedded SQL the RuntimeMode is Logical For SQL Explorer (Portal) the RuntimeMode is Display Hence the leapfrog in the results.
go to post Vitaliy Serdtsev · Apr 7, 2022 Try this: ClassMethod OnStartRequest() As %Status { #dim %response As %CSP.Response ;s %response.ContentType="text/html",%response.Expires=-1 s %response.Status=##class(%CSP.REST).#HTTP403FORBIDDEN q $$$OK }Or this: /// 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 OnPreHTTP() As %Boolean [ ServerOnly = 1 ] { s %response.Status="403 Forbidden" q 0 }
go to post Vitaliy Serdtsev · Apr 7, 2022 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) { s sql = 5 s sql(1)="SELECT 0 ID,'Sit' Sit,'Label' Label,'userno' userno,current_date LogedDate,current_date LogedTime,null TimeSpent" s sql(2)="union" s sql(3)="SELECT 1,'Sit','Label','userno',current_date,current_date,null" s sql(4)="union" s sql(5)="SELECT 2,'Sit','Label','userno',current_date,current_date,null" s st=##class(%SQL.Statement).%New() s st.%SelectMode=2 q ##class(%SQL.Statement).%ExecDirect(st,.sql) } }
go to post Vitaliy Serdtsev · Apr 7, 2022 I confirm (used the following code): #include %systemInclude n try{ s sql="select * from (select 0 field union select 1) where 0=1" #dim rs As %SQL.StatementResult=##class(%SQL.Statement).%ExecDirect(,sql) w rs.%SQLCODE s st = ##class(%SQL.Statement).%New() $$$ThrowOnError(st.%Prepare(sql)) s rs = st.%Execute() w !,"---",!,rs.%SQLCODE &sql(select * from (select 0 field union select 1) where 0=1) w !,"---",!,SQLCODE }catch(ex){ w "Error ", ex.DisplayString(),! } 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
go to post Vitaliy Serdtsev · Apr 5, 2022 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.
go to post Vitaliy Serdtsev · Apr 5, 2022 Can we find out what you need it for? See Collation Example: s sub1=##class(%Collation).SqlString(111), sub2=$system.Util.Collation(444,8) k t s t(sub1,sub2)="" s t(sub2,sub1)="" zw tOutput: t(" 111"," 444")="" t(" 444"," 111")=""
go to post Vitaliy Serdtsev · Apr 5, 2022 This Compare only works when working with the studio, correct? Yes, Studio does the following: uploads the first source code to a temporary directory (for example c:\windows\temp) uploads the second source code to a temporary directory 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.
go to post Vitaliy Serdtsev · Apr 5, 2022 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.
go to post Vitaliy Serdtsev · Apr 1, 2022 A good question, to which I do not know a beautiful answer. The option with Extended References, unfortunately did not work. In general, through uploading to a file. If the elements have different names in the databases, then you can use the Mapping a Routine/Package.
go to post Vitaliy Serdtsev · Mar 31, 2022 Note: The preferred way to convert UTC time to local time is to use the $ZDATETIMEH(utc,-3) function. This function adjusts for local time variants.proof Also see ##class(%UTC).NowLocal()
go to post Vitaliy Serdtsev · Mar 31, 2022 See Studio Compare With an external program WinMerge also works fine. You can compare any elements (mac, cls, css, js, css, etc.) located both inside the database and in external files.
go to post Vitaliy Serdtsev · Mar 17, 2022 You can use Caché SQL Gateway (Link Table via JDBC or ODBC) This, your data migration query will be of the form: insert into mssql.table(field1,..,fieldN) select field1,..,fieldN from cache.tableOr use third-party utilities to migrate data from/to any DBMS via JDBC/ODBC, for example SQL Data Lens (aka Caché Monitor): Local query cloud (there is a video) Also there the Bulk Export @Andreas Schneider - the author of this tools
go to post Vitaliy Serdtsev · Mar 7, 2022 size = 31 ClassMethod Validate(s As %String) As %Boolean { q $MATCH(s,"[1-3].*[A-CRS]") }
go to post Vitaliy Serdtsev · Mar 7, 2022 size = 30 ClassMethod Validate(s As %String) As %Boolean { q "ABCRS"[$e(s,*)*123[$e(s) }