Robert Cemper · Oct 11, 2018 go to post

In SQL you do SELECT '"'||field||'"' ....

String delimiter in SQL are  single quotes '   String concatenator is ||   Double pipe

Robert Cemper · Oct 11, 2018 go to post

Brendan,

I share your concerns. The initial request didn't mention Fileman at all.
This is just a hint how a construct like this could be opened to SQL access. 
I've seen so many old MUMPS code that would have never taken its way to objects without.
It#s clear that this requires wise use and careful handling.
 

Robert Cemper · Oct 10, 2018 go to post

for pure object access, you have a getter and a setter method.  no magic

if also want to use it for SQL
- you need SqlComputed code. This will also replace your (object)Getter.

- to set your local variable also by INSERT or UPDATE you need to add  UPDATE and INSERT Trigger code.

example;

Class DC.Setter Extends %Persistent [ Not ProcedureBlock ]
{
Property DUZ As %String [ Calculated, SqlComputed, SqlColumnNumber = 2
,
       SqlComputeCode = {set {*} = DUZ(2)}  ];
// for settig object property
Method DUZSet(Arg As %String) As %Status [ ServerOnly = 1 ]
 set DUZ(2)=Arg  Quit $$$OK   }
Trigger UpdTrigger [ Event = UPDATE ]
{ set DUZ(2)
= %d(2) ,%ok=1 }
Trigger InsTrigger [ Event = INSERT ]
set DUZ(2)=
  %d(2) ,%ok=1 }

--

To anticipate critics:
Some people may say it's dirty coding.  YES !! But it works.

Robert Cemper · Oct 9, 2018 go to post

Last parameter  .args came only with 2017.1
for earlier versions you need to compose it into first argument.

Robert Cemper · Oct 8, 2018 go to post

as a first suggestion, I would create a setter and getter method for this property that handles DUZ(2) in both directions.
If you add any property by the wizard it shows you the exact naming of the methods.
this property then goes in the first position of the IDkey
be aware of ProcedureBlock to have always access to your   DUZ(2)  or name it %DUZ(2) as hack

Robert Cemper · Oct 8, 2018 go to post

Yes you can! but not directly!
All you need is a an Abstract Class with 

Classmethods to read, set, kill Globals as you need either static with fixed names or Global references passed by params. As you like.
And if you add SqlProc to the method you can even use it over ODBC/JDBC.

Robert Cemper · Oct 5, 2018 go to post

as you write it " + id+ " is a constant string. 
so what would you expect to change?
eventually, you rephrase the question and add also the programming language you try to use.
this seems to be an invalid syntax anyhow

Robert Cemper · Oct 5, 2018 go to post

Searching for Caché is not so effective but looking for Intersystems or ObjectScript may get better hit rates.
Amazon has some related books. Watch also for Mike Kadow

Robert Cemper · Oct 4, 2018 go to post

You hit the point %Boolean s an excellent example  it can be TRUE, FALSe or NULL
in Caché terms: 1, 0, ""

Your example ^CODE("TNO","BIO",291,"AKI"))  is partially misleading in that sense that a global subscript can NEVER be ""
while the content of $LB() can be $LB(1,2,"",4)  or $lb(1,2,,4)  here you find your  "undefined" again,
similar to NULL in SQL (which is a different story)

Robert Cemper · Oct 4, 2018 go to post

there is a major difference between 1) and 2)

1) is also true if you have SET ^CODE("TNO","BIO",291,"AKI"))=""

Robert Cemper · Oct 3, 2018 go to post

You could also use a Command Pipe (docs) and read directly from your OS using "../bin ccontrol  list"  or similar

You just do the usual OPEN + USE and READ whatever comes back.

Robert Cemper · Oct 3, 2018 go to post

Check performance log and activity on your ESX or whatever your VM is running on. 
It looks like a performance problem of the virtual disk.

Robert Cemper · Oct 3, 2018 go to post

this information is stored in ^|"%SYS"|SYS("Security","ApplicationsD")

you could extract it by MERGE ^mySAVE=^|"%SYS"|SYS("Security","ApplicationsD")
and then do any export of the global

Robert Cemper · Oct 1, 2018 go to post

Thanks!
One headache less in the discussion about the "right" way to write code.
+a tiny piece for "creative freedom".  wink 

yes

Robert Cemper · Sep 28, 2018 go to post

Procedureblock =1 

means ALL local variables except call parameters and %variables move to stack
and return when you return from your method (=procedure)

see Summary on Local Variable Scoping  for more 

this memory operation is not free but nothing to get a headache upon

Robert Cemper · Sep 28, 2018 go to post

Of course, if your utility classes are all ABSTRACT it is pure code.  As any .MAC, just easier to read.
OREF is just a special data type (object pointer) and not better or worse than any other variable.

I 'd guess variable scoping and procedure block has much more (microscopic) influence on performance.

My personal preference is to have only code tightly related to stored date in "object"-classes.
Anything else outside that is not only related to this class.

Robert Cemper · Sep 23, 2018 go to post

As IClassID seems to be numeric, did you try to force a pure numeric comparison ?

eg.  if +lClassID '= +rs.GetData(5) {

or if (lClassID - rs.GetData(5)) {

Robert Cemper · Sep 21, 2018 go to post

I use * X for linuX aiX uniX solaris and similar real OS.

on Win* you just have to click on start caché in the cube

Robert Cemper · Sep 21, 2018 go to post

In namespace %SYS there is the utility JRNDUMP that you may take as template

from terminal run DO ^JRNDUMP and see the content

It is 800 lines hardcore COS.
I wouldn't recommend it as you might not get what you are looking for if you aren't a very experienced COS system developer. 
 

Robert Cemper · Sep 21, 2018 go to post

Sorry Kevin,
I concentrated on CPIPE.

my code was Written for a FOR p=1:1:254 loop to find unused IP addresses in a specific subnet.

in your case, ping might be something like  set ping= "ipconfig"

Robert Cemper · Sep 21, 2018 go to post

if it's grey your local instance on Windows is not started.
There is no cube on *X as far as I know

Robert Cemper · Sep 20, 2018 go to post

Journal is definitely a valuable source.
BUT: It documents Global changes. It doesn't know about objects nor rows in tables.

Robert Cemper · Sep 20, 2018 go to post

Kevin

You can also use a Command Pipe (docs) and read directly from your OS using IPconfig  (on Windows) or ifconfig (in Linux/ Unix)

You just do the usual OPEN + USE and READ whatever comes back.

As an example a handcrafted ping routine

zping ;
 k empty
 s pipe="|CPIPE|"
 close pipe
 s ping="ping 10.10.12."_p
 open pipe:(ping):10 w $t," ",p,!
 for  {
 use pipe read line
 use 0
 set empty=$s($l(line):0,1:$i(empty)) q:empty>3
 write:empty<2 line,!
 }
Robert Cemper · Sep 20, 2018 go to post

you see the local installation.

You have to set your preferred instance to your mac installation.
(have no mac and no idea how your virtual box talks outside)