NodeJS和ORACLE PL / SQL集成平台(node + plsql)oracle oracle oracle
Want to build solid information system solely on PL/SQL and javascript easily,
no rely on any other programming language or technical stack? develop with NORADLE.
The word NORADLE is combination of node.js and oracle,
It aims at
procedure bind_data is
cursor c_packages is
select *
from user_objects a
where a.object_type = 'PACKAGE'
and rownum <= 5
order by a.object_name asc;
begin
b.l('<!DOCTYPE html>');
o.t('<html>');
o.t('<body>');
o.t('<table rules=all cellspacing=0 cellpadding=5 style="border:1px solid silver;">');
o.t(' <caption>', 'bind sql data to table example');
o.t(' <thead>', o.t('<tr>', m.w('<th>@</th>', 'package name,created')));
o.t(' <tbody>');
for i in c_packages loop
o.t('<tr>');
o.t(' <td>', i.object_name);
o.t(' <td>', t.d2s(i.created));
o.t('</tr>');
end loop;
o.t(' </tbody>');
o.t('</table>');
o.t('</body>');
o.t('</html>');
end;
create or replace package body chart_b is
procedure common_preface(default_type varchar2) is
v_chart_type varchar2(30) := r.getc('chart_type', default_type);
begin
src_b.header;
o.u('<link rel=stylesheet/>', '[animate.css]');
o.u('<script>', '[chart.js]', '');
o.u('<script>', '[zepto.js]', '');
o.u('<script>', '[underscore.js]', '');
o.t('<canvas#cc width=600 height=400>', '');
o.t('<script>',
t.ps('
var ctx = document.getElementById("cc").getContext("2d")
, demoChart = new Chart(ctx)
, chartType=":1"
;',
st(v_chart_type)));
end;
procedure salary_min_max_by_job_id is
cur sys_refcursor;
begin
if r.is_xhr then
open cur for
select a.job_id, count(*) cnt, avg(a.salary) avg, min(a.salary) min, max(a.salary) max
from employees a
group by a.job_id
order by avg asc;
rs.print(cur);
return;
end if;
common_preface('Bar');
o.t('<div#links>');
o.u(' <a>', r.prog || '?chart_type=Line', 'Line');
o.u(' <a>', r.prog || '?chart_type=Bar', 'Bar');
o.u(' <a>', r.prog || '?chart_type=Radar', 'Rader');
o.t('</div>');
b.l('<script>
$.getJSON(location.pathname+"?data", function(data){
var salaries = data.$DATA.rows;
var chartData = {
labels : _.pluck(salaries, "job_id"),
datasets : [
{
fillColor : "rgba(220,220,220,0.5)",
strokeColor : "rgba(220,220,220,1)",
pointColor : "rgba(220,220,220,1)",
pointStrokeColor : "#fff",
data : _.pluck(salaries, "min")
},
{
fillColor : "rgba(151,187,205,0.5)",
strokeColor : "rgba(151,187,205,1)",
pointColor : "rgba(151,187,205,1)",
pointStrokeColor : "#fff",
data : _.pluck(salaries, "max")
}
]
};
demoChart[chartType](chartData);
});</script>');
end;
end chart_b;
note: from v0.14.0, noradle is split into several sub projects under https://github.com/noradle.
it’s for those considerations:
{{browser}} -----------(http)--------------> {{1.noradle-http}} --- / {{noradle-console}}
http client / \ /
\--------(http)-> {{proxy(nginx)}} -----/ {{noradle-dispatcher}} <------ {{oracle}}
\----(SCGI)----> {{2.noradle-scgi}} ----/ /
\---(FCGI)----> {{3.noradle-fcgi}} -----/
(note: 123 require {{noradle-nodejs-client}} )
the submodule list, all under github noradle