go to post Vitaliy Serdtsev · Feb 3, 2022 size = 49 ClassMethod Solve(o As %String) As %Integer { f i=1:1 s c=$p(o,",",i) ret:'$lf($lfs(o),-c) c }
go to post Vitaliy Serdtsev · Feb 3, 2022 Given (IRIS 2021.2): Class fixxer.decars Extends %Persistent [ DdlAllowed, SqlRowIdName = UniqueIdentifier ] { Index iUnq On (brand, MaxSpeed, color) [ IdKey, PrimaryKey, Unique ]; Property brand [ SqlColumnNumber = 2 ]; Property MaxSpeed; Property color; }USER>d $system.SQL.Shell() SQL Command Line Shell ---------------------------------------------------- The command prefix is currently set to: <>. Enter , 'q' to quit, '?' for help. [SQL]USER>>select * from fixxer.decars 1. select * from fixxer.decars UniqueIdentifier brand MaxSpeed color 0 Rows(s) Affected statement prepare time(s)/globals/cmds/disk: 0.0020s/5/140/0ms execute time(s)/globals/cmds/disk: 0.0004s/1/719/0ms cached query class: %sqlcq.TEST.cls4 --------------------------------------------------------------------------- [SQL]USER>>alter table fixxer.decars alter column color rename color2 2. alter table fixxer.decars alter column color rename color2 0 Rows Affected statement prepare time(s)/globals/cmds/disk: 0.0153s/2 113/13 157/0ms execute time(s)/globals/cmds/disk: 0.1492s/52 206/467 790/0ms cached query class: %sqlcq.TEST.cls5 --------------------------------------------------------------------------- [SQL]USER>>select * from fixxer.decars 3. select * from fixxer.decars UniqueIdentifier brand MaxSpeed COLOR2 0 Rows(s) Affected statement prepare time(s)/globals/cmds/disk: 0.0741s/38 529/179 560/0ms execute time(s)/globals/cmds/disk: 0.0003s/1/719/0ms cached query class: %sqlcq.TEST.cls4 --------------------------------------------------------------------------- [SQL]USER>>Now: Class fixxer.decars Extends %Persistent [ DdlAllowed, SqlRowIdName = UniqueIdentifier ] { Index iUnq On (brand, MaxSpeed, color) [ IdKey, PrimaryKey, Unique ]; Property brand [ SqlColumnNumber = 2 ]; Property MaxSpeed; Property color [ SqlFieldName = COLOR2 ]; }PS: by the way Studio highlights the error in the following code &sql(alter table fixxer.decars alter column color rename color2)But the compilation goes without errors.
go to post Vitaliy Serdtsev · Feb 3, 2022 Perhaps the method will be useful to you: $SYSTEM.Util.CleanDeadJobs()
go to post Vitaliy Serdtsev · Feb 1, 2022 See $$TableName^%occLGUtil(pClass) (taken from sources %DeepSee.Report.Model.Report) ##class(%DeepSee.Utils).%GetSQLTableName(pClass) ##class(%ZEN.DataModelUtils).GetSQLTableName(pClass) ##class(%DeepSee.Generator).%GetSQLTableName(pClass) (my choice)It is worth remembering that the table name can be a reserved word, so you need to put it in quotation marks. For example, the method %DeepSee.Generator:%GetSQLTableName does not always work correctly for Caché: Class count.sum.select Extends %Persistent [ SqlTableName = "current_date.max" ] { ClassMethod TableName(which = 0) [ CodeMode = objectgenerator ] { set sch=%compiledclass.SqlSchemaName, tab=%compiledclass.SqlTableName do %code.WriteLine($c(9)_"quit $p("""_sch_"."_tab_","_sch_","_tab_""","","",which+1)") quit $$$OK } /// d ##class(count.sum.select).Test() ClassMethod Test() { f i=0:1:2 w ..TableName(i),! s pClass=$classname() w !,##class(%DeepSee.Generator).%GetSQLTableName(pClass),! w $$TableName^%occLGUtil(pClass),! w ##class(%DeepSee.Utils).%GetSQLTableName(pClass),! w ##class(%ZEN.DataModelUtils).GetSQLTableName(pClass),! } } USER>d ##class(count.sum.select).Test() count_sum.current_date.max count_sum current_date.max count_sum."current_date" ERROR! count_sum.current_date.max count_sum.current_date.max count_sum.current_date.maxIn IRIS 2021.2, an error occurs yet at the compilation stage of the class.
go to post Vitaliy Serdtsev · Jan 27, 2022 In Caché 2018.1, which the author indicated, there is no such function. In addition, instead of HH need to specify HH24, otherwise instead of 20220126155704 will get 20220126035704.
go to post Vitaliy Serdtsev · Jan 27, 2022 I would like to avoid string manipulation Delimiters in the format are required, so you will have to manipulate the strings anyway. $tr($system.SQL.TOCHAR($h,"YYYYMMDD HH24 MI SS")," ","") or $tr($system.SQL.TOCHAR($h,"YYYY^MM^DD^HH24^MI^SS"),"^","")
go to post Vitaliy Serdtsev · Dec 8, 2021 Ok, the index can be omitted. The table data is stored in different globals: *D - for data, *I - for indexes, *S - for streams. You can get the size of the data parts you want. Example [Size()]: select * from %SYS.GlobalQuery_Size('C:\InterSystems\Cache\mgr\samples','','*D,*S',0,0,1) order by "Allocated MB" desc
go to post Vitaliy Serdtsev · Dec 8, 2021 Will the size of the global (with data,index,stream) suit you? If yes, then see this.
go to post Vitaliy Serdtsev · Dec 8, 2021 See the sources of method %SYSTEM.SQL:Export() for a description of the parameters. Only instead of 0, use 1, for example: SAMPLES>w $$Export^%qarDDLExport("Sample","*","C:\Temp\Sample.sql","WNS",1,0,0,0,0)
go to post Vitaliy Serdtsev · Dec 7, 2021 Try the following: enable "Retain cached query source" as described above compile your class/project with addition flags "k /compileembedded=1" (see Validating Embedded SQL Code) open the code of the generated program from the Studio or System Portal like %sqlcq.[YOURNAMESPACE].xETs3uMe2Ehn2LY5inuZiK4xgwnS.1.int Note: at the same time, do not forget to specify checkbox for system items Profit!
go to post Vitaliy Serdtsev · Dec 6, 2021 That's what I expected to see. But need remember that This method is only available for stored properties. In other words, if the storage changes tomorrow, will have to rewrite a bunch of code.
go to post Vitaliy Serdtsev · Dec 6, 2021 I meant the length of the code. I can write like this: <..> select a->b->c->d into :r from table where %ID=:id <..>Can you give a complete code example for a->b->c->d using GetStored?
go to post Vitaliy Serdtsev · Dec 3, 2021 And if you need to get a->b->c->d and they at the same time can be null?
go to post Vitaliy Serdtsev · Dec 3, 2021 See this. Note: For Caché, there will be a "\Intersystems\Cache\" instead of "\Intersystems\IRIS\". Also note that for the 32-bit version, the paths in the registry will be slightly different from those specified in the example.
go to post Vitaliy Serdtsev · Dec 3, 2021 stop IRIS close IRIS Launcher (aka Cube) open regedit (run as Administrator) rename instance name (let's say "ABC") [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Intersystems\IRIS\Configurations\ABC] [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Intersystems\IRIS\Configurations\ABC\Manager\PreferredServer] @="ABC" run IRIS Launcher (aka Cube) and rename server names. If you want, you can also do this through the registry: [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Intersystems\CACHE\Servers\ABC] [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Intersystems\CACHE\Servers] "DefaultServer"="ABC" start IRIS Profit! Now the instance name is ABC.
go to post Vitaliy Serdtsev · Dec 3, 2021 Another option /// This sample persistent class represents an employee.<br> Class Sample.Employee Extends Person { ... /// The company this employee works for. Relationship Company As Company [ Cardinality = one, Inverse = Employees ]; Property Cname As %String [ Calculated, SqlComputeCode = {n id,r s id={%%ID} &sql(select Company->Name into :r from Sample.Employee where %ID=:id) s {*}=r}, SqlComputed ]; ... }
go to post Vitaliy Serdtsev · Nov 24, 2021 In this case, you should wait for IRIS 2021.2 with built-in Python and use Jinja directly. In the meantime, there is the following: Developing Custom Tags Making Your Own Studio Templates
go to post Vitaliy Serdtsev · Nov 23, 2021 There is a ready-made method for this: getFileslink Usage example: s path="C:\Temp" s pExtension=1 s pExtension(1)="*" s pTempNode=$i(^CacheTemp) k ^CacheTemp(pTempNode) d ##class(%SQL.Util.Import).getFiles(path,.pExtension,pTempNode,1) m dirlist=^CacheTemp(pTempNode) k ^CacheTemp(pTempNode) zw dirlist