za (Tai–Kadai Zhuang, Chuang) - a very rare language, it's probably better to do the translation yourself. See Translating JSON files: a complete guide to l10n and i18n
- Log in to post comments
za (Tai–Kadai Zhuang, Chuang) - a very rare language, it's probably better to do the translation yourself. See Translating JSON files: a complete guide to l10n and i18n
Are you using Active Directory?
See: The clocks on the client and server machines are skewed.
So, the author is not lucky and in its version this feature is not available. It seems you have the wrong addressee, I have 2021.2 :)
I won't be able to check for version 2020.1 since I have 2021.2.
Try to make a DROP COLUMN and then ADD COLUMN (of course according to the documentation for your version)
After calling
alter table fixxer.decars alter column color rename color2it became<FONT COLOR="#000080">Property </FONT><FONT COLOR="#000000">color </FONT><FONT COLOR="#000080">As %Library.String</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#000080">MAXLEN </FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#000080">500</FONT><FONT COLOR="#000000">) [ </FONT><FONT COLOR="#000080">SqlColumnNumber </FONT><FONT COLOR="#000000">= 5, </FONT><FONT COLOR="#000080">SqlFieldName </FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#008000">COLOR2 </FONT><FONT COLOR="#000000">];</FONT>It looks like something was fixed in 2021.2.
Good trick!
size = 47
ClassMethod Solve2(o As %String) As %Integer
{
a s c=$p(o,",",$i(i)) g:$lf($lfs(o),-c) a q c
}I have 190 on 1 line.
UPD: Program can be reduced to 189, but at the same time efficiency will decrease. Therefore, I will stop on the value 190. Let us know when the contest ends and it will be possible to open the sources.
It is a pity that the author left the previous task (Code Golf - Encoder) without attention, and the community ignored her (or did not notice;)
size = 49
ClassMethod Solve(o As %String) As %Integer
{
f i=1:1 s c=$p(o,",",i) ret:'$lf($lfs(o),-c) c
}Given (IRIS 2021.2):
<FONT COLOR="#000080">Class fixxer.decars Extends %Persistent </FONT><FONT COLOR="#000000">[ </FONT><FONT COLOR="#000080">DdlAllowed</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#000080">SqlRowIdName </FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#008000">UniqueIdentifier </FONT><FONT COLOR="#000000">]
{
</FONT><FONT COLOR="#000080">Index </FONT><FONT COLOR="#000000">iUnq On (brand, MaxSpeed, color) [ </FONT><FONT COLOR="#000080">IdKey</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#000080">PrimaryKey</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#000080">Unique </FONT><FONT COLOR="#000000">];
</FONT><FONT COLOR="#000080">Property </FONT><FONT COLOR="#000000">brand [ </FONT><FONT COLOR="#000080">SqlColumnNumber </FONT><FONT COLOR="#000000">= 2 ];
</FONT><FONT COLOR="#000080">Property </FONT><FONT COLOR="#000000">MaxSpeed;
</FONT><FONT COLOR="#000080">Property </FONT><FONT COLOR="#000000">color;
}</FONT>
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:
<FONT COLOR="#000080">Class fixxer.decars Extends %Persistent </FONT><FONT COLOR="#000000">[ </FONT><FONT COLOR="#000080">DdlAllowed</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#000080">SqlRowIdName </FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#008000">UniqueIdentifier </FONT><FONT COLOR="#000000">]
{
</FONT><FONT COLOR="#000080">Index </FONT><FONT COLOR="#000000">iUnq On (brand, MaxSpeed, color) [ </FONT><FONT COLOR="#000080">IdKey</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#000080">PrimaryKey</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#000080">Unique </FONT><FONT COLOR="#000000">];
</FONT><FONT COLOR="#000080">Property </FONT><FONT COLOR="#000000">brand [ </FONT><FONT COLOR="#000080">SqlColumnNumber </FONT><FONT COLOR="#000000">= 2 ];
</FONT><FONT COLOR="#000080">Property </FONT><FONT COLOR="#000000">MaxSpeed;
</FONT><FONT COLOR="#000080">Property </FONT><FONT COLOR="#000000">color [ </FONT><FONT COLOR="#000080">SqlFieldName </FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#008000">COLOR2 </FONT><FONT COLOR="#000000">];
}</FONT>
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.
Perhaps the method will be useful to you: $SYSTEM.Util.CleanDeadJobs()
See
<FONT COLOR="#0000ff">$$</FONT><FONT COLOR="#ff0000">TableName</FONT><FONT COLOR="#000000">^%occLGUtil(</FONT><FONT COLOR="#800000">pClass</FONT><FONT COLOR="#000000">)</FONT> (taken from sources %DeepSee.Report.Model.Report) <FONT COLOR="#000080">##class</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008080">%DeepSee.Utils</FONT><FONT COLOR="#000000">).</FONT><FONT COLOR="#0000ff">%GetSQLTableName</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">pClass</FONT><FONT COLOR="#000000">)</FONT> <FONT COLOR="#000080">##class</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008080">%ZEN.DataModelUtils</FONT><FONT COLOR="#000000">).</FONT><FONT COLOR="#0000ff">GetSQLTableName</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">pClass</FONT><FONT COLOR="#000000">)</FONT> <FONT COLOR="#000080">##class</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008080">%DeepSee.Generator</FONT><FONT COLOR="#000000">).</FONT><FONT COLOR="#0000ff">%GetSQLTableName</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">pClass</FONT><FONT COLOR="#000000">)</FONT> (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é:
<FONT COLOR="#000080">Class count.sum.select Extends %Persistent </FONT><FONT COLOR="#000000">[ </FONT><FONT COLOR="#000080">SqlTableName </FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#008000">"current_date.max" </FONT><FONT COLOR="#000000">]
{
</FONT><FONT COLOR="#000080">ClassMethod </FONT><FONT COLOR="#000000">TableName(</FONT><FONT COLOR="#ff00ff">which </FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#000080">0</FONT><FONT COLOR="#000000">) [ </FONT><FONT COLOR="#000080">CodeMode </FONT><FONT COLOR="#000000">= objectgenerator ]
{
</FONT><FONT COLOR="#0000ff">set </FONT><FONT COLOR="#800000">sch</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#800000">%compiledclass</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">SqlSchemaName</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">tab</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#800000">%compiledclass</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">SqlTableName
do </FONT><FONT COLOR="#800000">%code</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">WriteLine</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#0000ff">$c</FONT><FONT COLOR="#000000">(9)</FONT><FONT COLOR="#008000">"quit $p("""</FONT><FONT COLOR="#000000"></FONT><FONT COLOR="#800000">sch</FONT><FONT COLOR="#000000"></FONT><FONT COLOR="#008000">"."</FONT><FONT COLOR="#000000"></FONT><FONT COLOR="#800000">tab</FONT><FONT COLOR="#000000"></FONT><FONT COLOR="#008000">","</FONT><FONT COLOR="#000000"></FONT><FONT COLOR="#800000">sch</FONT><FONT COLOR="#000000"></FONT><FONT COLOR="#008000">","</FONT><FONT COLOR="#000000"></FONT><FONT COLOR="#800000">tab</FONT><FONT COLOR="#000000">_</FONT><FONT COLOR="#008000">""","","",which+1)"</FONT><FONT COLOR="#000000">)
</FONT><FONT COLOR="#0000ff">quit $$$OK
</FONT><FONT COLOR="#000000">}
</FONT><FONT COLOR="#000080">/// d ##class(count.sum.select).Test()
ClassMethod </FONT><FONT COLOR="#000000">Test()
{
</FONT><FONT COLOR="#0000ff">f </FONT><FONT COLOR="#800000">i</FONT><FONT COLOR="#000000">=0:1:2 </FONT><FONT COLOR="#0000ff">w </FONT><FONT COLOR="#000000">..</FONT><FONT COLOR="#0000ff">TableName</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">i</FONT><FONT COLOR="#000000">),!
</FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">pClass</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#0000ff">$classname</FONT><FONT COLOR="#000000">()
</FONT><FONT COLOR="#0000ff">w </FONT><FONT COLOR="#000000">!,</FONT><FONT COLOR="#000080">##class</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008080">%DeepSee.Generator</FONT><FONT COLOR="#000000">).</FONT><FONT COLOR="#0000ff">%GetSQLTableName</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">pClass</FONT><FONT COLOR="#000000">),!
</FONT><FONT COLOR="#0000ff">w $$</FONT><FONT COLOR="#ff0000">TableName</FONT><FONT COLOR="#000000">^%occLGUtil(</FONT><FONT COLOR="#800000">pClass</FONT><FONT COLOR="#000000">),!
</FONT><FONT COLOR="#0000ff">w </FONT><FONT COLOR="#000080">##class</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008080">%DeepSee.Utils</FONT><FONT COLOR="#000000">).</FONT><FONT COLOR="#0000ff">%GetSQLTableName</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">pClass</FONT><FONT COLOR="#000000">),!
</FONT><FONT COLOR="#0000ff">w </FONT><FONT COLOR="#000080">##class</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008080">%ZEN.DataModelUtils</FONT><FONT COLOR="#000000">).</FONT><FONT COLOR="#0000ff">GetSQLTableName</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">pClass</FONT><FONT COLOR="#000000">),!
}
}</FONT>
USER><FONT COLOR="#0000ff">d </FONT><FONT COLOR="#000080">##class</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008080">count.sum.select</FONT><FONT COLOR="#000000">).</FONT><FONT COLOR="#0000ff">Test</FONT><FONT COLOR="#000000">()</FONT>
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.max
In IRIS 2021.2, an error occurs yet at the compilation stage of the class.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.
I would like to avoid string manipulationDelimiters 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"),"^","")
LOAD DATA (SQL)2021.2
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()]:
<FONT COLOR="#0000ff">select </FONT><FONT COLOR="#000080">* from </FONT><FONT COLOR="#008000">%SYS</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#008000">GlobalQuery_Size</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008080">'C:\InterSystems\Cache\mgr\samples'</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008080">''</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008080">'*D,*S'</FONT><FONT COLOR="#000000">,0,0,1) </FONT><FONT COLOR="#000080">order by </FONT><FONT COLOR="#008000">"Allocated MB" </FONT><FONT COLOR="#000080">desc</FONT>
See the sources of method %SYSTEM.SQL:Export() for a description of the parameters.
Only instead of 0, use 1, for example:
SAMPLES><FONT COLOR="#0000ff">w $$</FONT><FONT COLOR="#ff0000">Export</FONT><FONT COLOR="#000000">^%qarDDLExport(</FONT><FONT COLOR="#008000">"Sample"</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008000">"*"</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008000">"C:\Temp\Sample.sql"</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008000">"WNS"</FONT><FONT COLOR="#000000">,1,0,0,0,0)</FONT>
Will an undocumented command suit you?
Try the following:
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.
I meant the length of the code.
I can write like this:
<..> <FONT COLOR="#0000ff">select </FONT><FONT COLOR="#008000">a</FONT><FONT COLOR="#000000">-></FONT><FONT COLOR="#008000">b</FONT><FONT COLOR="#000000">-></FONT><FONT COLOR="#008000">c</FONT><FONT COLOR="#000000">-></FONT><FONT COLOR="#008000">d </FONT><FONT COLOR="#000080">into </FONT><FONT COLOR="#800000">:r </FONT><FONT COLOR="#000080">from </FONT><FONT COLOR="#008000">table </FONT><FONT COLOR="#000080">where </FONT><FONT COLOR="#008000">%ID</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#800000">:id</FONT> <..>
Can you give a complete code example for a->b->c->d using GetStored?
And if you need to get a->b->c->d and they at the same time can be null?
Another option
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:
There is a ready-made method for this: getFileslink
Usage example:
<FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">path</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"C:\Temp"</FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">pExtension</FONT><FONT COLOR="#000000">=1 </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">pExtension</FONT><FONT COLOR="#000000">(1)=</FONT><FONT COLOR="#008000">"*"
</FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">pTempNode</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#0000ff">$i</FONT><FONT COLOR="#000000">(^CacheTemp) </FONT><FONT COLOR="#0000ff">k </FONT><FONT COLOR="#000000">^CacheTemp(</FONT><FONT COLOR="#800000">pTempNode</FONT><FONT COLOR="#000000">) </FONT><FONT COLOR="#0000ff">d </FONT><FONT COLOR="#000080">##class</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008080">%SQL.Util.Import</FONT><FONT COLOR="#000000">).</FONT><FONT COLOR="#0000ff">getFiles</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">path</FONT><FONT COLOR="#000000">,.</FONT><FONT COLOR="#800000">pExtension</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">pTempNode</FONT><FONT COLOR="#000000">,1) </FONT><FONT COLOR="#0000ff">m </FONT><FONT COLOR="#800000">dirlist</FONT><FONT COLOR="#000000">=^CacheTemp(</FONT><FONT COLOR="#800000">pTempNode</FONT><FONT COLOR="#000000">) </FONT><FONT COLOR="#0000ff">k </FONT><FONT COLOR="#000000">^CacheTemp(</FONT><FONT COLOR="#800000">pTempNode</FONT><FONT COLOR="#000000">)
</FONT><FONT COLOR="#0000ff">zw </FONT><FONT COLOR="#800000">dirlist</FONT>