This file contains hidden or 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
// SQLCL's Command Registry | |
var CommandRegistry = Java.type("oracle.dbtools.raptor.newscriptrunner.CommandRegistry"); | |
// CommandListener for creating any new command | |
var CommandListener = Java.type("oracle.dbtools.raptor.newscriptrunner.CommandListener") | |
var MultiLineHistory = Java.type("oracle.dbtools.raptor.console.MultiLineHistory") | |
// Broke the .js out from the Java.extend to be easier to read | |
var cmd = {}; |
This file contains hidden or 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 DatabaseChangeListener = Java.type("oracle.jdbc.dcn.DatabaseChangeListener"); | |
var Properties = Java.type("java.util.Properties"); | |
var OracleConnection = Java.type("oracle.jdbc.OracleConnection"); | |
var OracleStatement = Java.type("oracle.jdbc.OracleStatement"); | |
var cmd = {}; | |
cmd.onChange = function(e){ | |
// print it out but could go query the change instead | |
ctx.write("\n Data Changed:" + e.toString() + "\n"); | |
out.flush(); |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
FROM ubuntu:latest | |
# Install Java. | |
RUN apt-get update && \ | |
apt-get upgrade -y && \ | |
apt-get install -y software-properties-common && \ | |
add-apt-repository ppa:webupd8team/java -y && \ | |
apt-get update && \ | |
echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections && \ |
This file contains hidden or 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 hidden or 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 hidden or 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 | |
var CopyOption = Java.type("java.nio.file.StandardCopyOption"); | |
// put all files here >>> | |
var ddlPath = java.nio.file.FileSystems.getDefault().getPath('ddl') | |
var fs = java.nio.file.FileSystems.getDefault(); | |
var f = java.nio.file.Files; | |
if ( ! f.exists(ddlPath)) { | |
f.createDirectory(ddlPath) |
This file contains hidden or 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){ |