I saw the presentation of roadmap 2014, and the following code is presented as a new Alpha feature.
But it is not possible to execute it in Alpha 12v3.5.
When Alpha release the javascript server-side feature?
But it is not possible to execute it in Alpha 12v3.5.
When Alpha release the javascript server-side feature?
Code:
<!DOCTYPE html> <html> <head> <meta name="generator" content="Alpha Anywhere HTML Editor Version 12 Build 2689-4440"> <!-- must use in order to make XP Themes render --> <meta HTTP-EQUIV="MSThemeCompatible" content="Yes" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <meta name="apple-mobile-web-app-capable" content="yes" /> <title>SQL from Javascript</title> </head> <body> <p>The code block on this page is server-side javascript</p> <a5% debugger; var country = request.variables.country; if(typeof country === 'undefined') country='uk'; var a5 = AlphaAnywhere; var cn = new a5.sql.connection(); var args = new a5.sql.arguments(); args.add('whatCountry',country); var cs = '::Name::northwind'; var flag = cn.open(cs); print('Connection was opened:'+flag+'<br><br>'); var sql = "select * from customers where country = :whatCountry"; flag = cn.execute(sql.args); if(flag === false) { print('error executing sql'); } else { var rs = cn.resultset; var flag = rs.nextRow(); var count = 0; var arr = []; debugger; while(flag){ count = count + 1; arr.push('<p>'+rs.data("customerId")+'</p>'); flag = rs.nextRow(); } var html = arr.join(''); print(html); print('<br><br>'); print('rows in query:'+count); } cn.close(); %> </body> </html>
Comment