This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
script | |
// | |
// AS A SQLcl SCRIPT | |
// | |
var json = {"INPUT": "hello world"}; | |
var reply = httpPost("HTTP://API.SHOUTCLOUD.IO/V1/SHOUT", JSON.stringify(json)); | |
ctx.write("\n\n"); | |
ctx.write(JSON.stringify(reply)); | |
ctx.write("\n\n"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Thread = java.lang.Thread; | |
var ServerSocket = java.net.ServerSocket; | |
var PrintWriter = java.io.PrintWriter; | |
var InputStreamReader = java.io.InputStreamReader; | |
var BufferedReader = java.io.BufferedReader; | |
var FileInputStream = java.io.FileInputStream; | |
var ByteArray = Java.type("byte[]"); | |
var PORT = 8080; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// declare the 2 java files needed | |
var DriverManager = Java.type("java.sql.DriverManager"); | |
var ScriptExecutor = Java.type("oracle.dbtools.raptor.newscriptrunner.ScriptExecutor"); | |
// piece the args back together minus the bg command | |
var BGsql=""; | |
for(var i=1;i<args.length;i++){ | |
BGsql = BGsql + " " + args[i]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// declare the 2 java files needed | |
var DriverManager = Java.type("java.sql.DriverManager"); | |
var ScriptExecutor = Java.type("oracle.dbtools.raptor.newscriptrunner.ScriptExecutor"); | |
var BufferedOutputStream = Java.type("java.io.BufferedOutputStream") | |
var ByteArrayOutputStream = Java.type("java.io.ByteArrayOutputStream") | |
var String = Java.type("java.lang.String") | |
var BGsql=""; | |
for(var i=1;i<args.length;i++){ | |
BGsql = BGsql + " " + args[i]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// grab the results of the page | |
var PAGE = prev == null ? null : prev.getResponseDataAsString(); | |
// debug | |
OUT.println('PRE PROCESSING...'); | |
function put(id){ | |
vars.put(id, getValue(PAGE,id,'')); | |
} | |
// simple function to grab the value from the page or return the default x | |
function getValue(page,id,v){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
var first = util.executeReturnOneCol("select 1 from dualx"); | |
ctx.write('\n\n FIRST: ' + first + '\n\n'); | |
} catch (e ) { | |
ctx.write('\n\n ERROR' + e + '\n\n'); | |
} | |
sqlcl.setStmt('select X from YZ'); | |
sqlcl.run(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
load('helpers.js'); | |
/* | |
CREATE TABLE K | |
( PATH VARCHAR2(2000), | |
BLOB_CONTENT BLOB, | |
mime varchar2(40), | |
WHEN TIMESTAMP (6) | |
) | |
*/ | |
/* File name */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ddl = (function () { | |
function DDL() { | |
this.options = { | |
//columnNamePrefix: "?", | |
"Object Prefix": {value:"a"}, | |
Schema: {value:"hr"}, | |
"On Delete": {value:'Cascade',check:['Cascade','Restrict','Set Null']}, | |
Compression: {value:'No',check:['Yes','No']}, | |
"Include Drops": {value:'No',check:['Yes','No']}, | |
"Date Data Type":{value:'DATE',check:['DATE','TIMESTAMP','Timestamp with time zone','Timestamp with local time zone']}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tree = (function(){ | |
var tab= ' '; | |
function ddlnode( x, inputLine, parent ) { | |
this.x = x; | |
this.y = function() { | |
if( this.children.length == 0 ) | |
return this.x+1; | |
else | |
return this.children[this.children.length-1].y(); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require('request'),fs = require('fs'),colors = require('colors'); | |
var url = "http://KLRICE:klrice@localhost:9090/ords/klrice/_/sql" | |
// loop args 0="node" 1="compile" 2...= files to send | |
for (var i = 2; i < process.argv.length; i++) { | |
fs.createReadStream(process.argv[i]).pipe(request.post({ | |
url : url, | |
proxy:'', | |
method: 'POST', | |
time:true, |