|
|
| version 1.35, 2004/03/25 11:51:19 | version 1.50, 2004/06/22 14:15:57 |
|---|---|
| Line 1 | Line 1 |
| @auto[] | |
| $request:charset[windows-1251] | |
| $response:charset[windows-1251] | |
| @main[] | |
| $table[^table::create{pet | |
| cat milk}] | |
| $hash[^table.hash[pet]] | |
| ^display[$hash] | |
| @main[] | |
| ^connect[mysql://root@localhost/paf]{ | |
| $hash[^hash::sql{select 'cat' as pet | |
| #, 'milk' as food | |
| }] | |
| ^display_hash[$hash] | |
| } | |
| @main[] | @main[] |
| ^connect[mysql://root@localhost/paf]{ | ^connect[oracle://mts_imprimatur2:imp2@mts]{ |
| $participants[^hash::sql{select 'feodor' as participant }] | # ^in[] |
| # ^out[] | |
| ^inout[] | |
| OK | |
| } | } |
| #:даст хеш такой структуры: | @inp[] |
| $participantsZ[ | create table pif(a integer); |
| $.alex(1) | create or replace procedure paf(a in integer) as begin |
| $.boris(1) | insert into pif (a) values (:a); |
| ] | end; |
| / | |
| #:из которого можно эффективно извлекать информацию, например, так: | |
| $person[feodor] | @in[] |
| $person ^if($participants.$person){участвует}{не участвует} в мероприятии | # ^void:sql{create table paf(a clob)} |
| } | # ^void:sql{insert into paf (a) values (/**a**/'a')} |
| # ^void:sql{insert into paf (a) values (:unk)} | |
| ^void:sql{delete from pif} | |
| @display_hash[hash] | ^void:sql{call paf(:a)}[ |
| #$hash.a.a | $.bind[ |
| ^hash.foreach[k;v]{hash $k=( | $.a[2] |
| ^if($v is hash){^display_hash[$v]}{ | ] |
| ^if($v is bool){bool ^if($v){true;false}}{string $v} | ] |
| } | ^int:sql{select count(*) from pif} |
| }[,] | "^string:sql{select a from pif}" |
| )^#0A}] | # ^string:sql{select a from paf} |
| @outp[] | |
| create or replace procedure pafm(ai in integer,ao out integer) as begin | |
| ao:=ai; | |
| end; | |
| / | |
| @out[] | |
| $vars[ | |
| $.ai(2222) | |
| $.ao[sad] | |
| ] | |
| ^void:sql{call pafm(:ai,:ao)}[ | |
| $.bind[$vars] | |
| ] | |
| "$vars.ai" | |
| "$vars.ao" | |
| # ^string:sql{select a from paf} | |
| @inoutp[] | |
| create or replace procedure pafio(aio in out integer) as begin | |
| aio:=aio*2; | |
| end; | |
| / | |
| @inout[] | |
| $vars[ | |
| $.aio(2222) | |
| ] | |
| before "$vars.aio"<br> | |
| ^void:sql{call pafio(:aio)}[ | |
| $.bind[$vars] | |
| ] | |
| after "$vars.aio" | |
| # ^string:sql{select a from paf} | |
| @main[] | |
| $name[ Вася ] | |
| "$name" | |
| "^name.trim[]" | |
| $path[/section/subsection/] | |
| ^path.trim[end;/] | |
| @main[] | |
| $xdoc[^xdoc::create{<?xml version="1.0"?> | |
| <document xmlns:s="urn:special"> | |
| <s:code>string</s:code> | |
| </document> | |
| }] | |
| $xdoc.search-namespaces.s[urn:special] | |
| ^xdoc.selectString[string(//s:code)] |