Skip to content
Snippets Groups Projects
Commit 9991b129 authored by Julien Lopez's avatar Julien Lopez
Browse files

Add test on side effects

parent d1cb15d3
No related branches found
No related tags found
No related merge requests found
emp = new.tableRef("emp", "PostgreSQL", "postgre.config", "public")
minsalary = 2500.0
q = query.select(function (x) {
res = new.env()
res$empno = x$empno
res$ename = x$ename
res$salary = (function (dol, dept){
a = dol * 89.0 / 100.0
while (a > 500.0 * dept) a = a * 89.0 / 100.0
a
})(x$sal, x$deptno)
res },
query.where(function (x) x$sal >= minsalary,
query.from(emp)))
results = query.force(q)
print(results)
ename empno salary
1 SMITH 1 984.1472014255202
2 WARD 3 908.9094161734163
3 JONES 4 971.310575818447
4 SCOTT 8 1483.7593697011998
5 ADAMS 11 1387.5865368834952
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment