📄 mserver00.mal
字号:
# Attempt to establish a client connection to yourself.z:= inspect.getEnvironment();ps:= algebra.find(z,"mapi_port");port:= calc.int(ps);hs:= algebra.find(z,"host");# hardcoded, as access control currently works, and client.getInfo # doesn't#u:= clients.getInfo();#usr:= algebra.find(u,"user");#pwd:= algebra.find(u,"password");#lang:= algebra.find(u,"scenario");usr := "monetdb";pwd := "monetdb";lang := "mal";# setup the sessionmid:= mserver.connect(hs,port,usr,pwd,lang);io.print(mid);# retrieve data from the 'remote' site# testing t:=1+3;mserver.query(mid, "t:= 1+3; io.print(t,\"hello\");");i:= mserver.get_row_count(mid);io.printf("rowcount %d\n",i);mserver.fetch_row(mid);i:= mserver.get_field_count(mid);io.printf("fieldcount %d\n",i);i:= mserver.fetch_field(mid,0);io.printf("field 0 %d\n",i);s:str:= mserver.fetch_field(mid,1);io.printf("field 1 %s\n",s);mserver.query(mid,"r:= bat.new(:oid,:int);");mserver.query(mid,"bat.insert(r, 1@0,311);");mserver.query(mid,"bat.insert(r,2@0,433);");b:bat[:oid,:int]:= mserver.rpc(mid,"io.print(r);");io.print(b);# use the BAT fetch operation#b:bat[:oid,:int]:= mserver.receive(mid,"remotename");msg:str := mserver.rpc(mid,"io.print(\"hello world\");");io.print(msg);o:oid := mserver.rpc(mid,"io.print(34@0);");io.print(o);o:oid := mserver.rpc(mid,"io.print(nil:oid);");io.print(o);#needs type checks#(k:int,s:str):= mserver.rpc(mid,"io.print(nil:int,\"done\");");#io.print(k,s);# what is the relationship between local/remote namespace# mserver.send(key,"a",a);# c:= mserver.join(key,a,b);# mserver.rpc(key,"z:=algebra.join(a,b);");# c:= mserver.receive(key,"c")#patterns#pat:= "a:= algebra.select(b,?,?);");#qry:= str.replace(pat,"?",i,j);#mserver.query(key,pat,i,j);#how to ship a routine#fcn:= manual.definition(manual,help);# how to remote MAL execution# remotedb:= mserver.connect(...)# algebra.join@remotedb(a,b) using remote objects# c:= mserver.rpc(remotedb,algebra,join,a,b)# the remainder should be tested catch MapiException:str; io.printf("foutje:%s\n",MapiException);exit MapiException;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -