Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
cloneengine
Advanced tools
A tool for cloning database tables; from Postgres into Oracle
Postgres Type | Oracle Type |
---|---|
varchar | varchar2 |
numeric | number |
int4 | integer |
timestamp | varchar2 |
bool | varchar2 |
text | varchar2 |
Type | Behavior | Category |
---|---|---|
start | Emits on start only | activity |
connection | Emits when connection is opened or closed | activity |
rowsToProcess | Emits the row count number of the table to be cloned | activity |
process | Emits when data is being processed | activity |
bytesCached | Emits the number of bytes cashed | activity |
countsMatch | Emits true if source and destination row counts match | activity |
finish | Emits on finish only | activity |
operation | Emits a summary of operation only | summary |
ERROR! | Emits when errors occur | activity |
Emitter Property | Property Description |
---|---|
activityId | Operation step unique ID |
operation | Operation name |
operationId | Operation unique ID |
msgType | Operation message type (start, connection, process, finish, operation, ERROR!) |
step | Operation step number |
time | Operation ISO formatted timestamp |
description | Operation description |
Download the following TWO Oracle Instant Client Packages (here: http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html ). Please make sure to download the correct packages for your system architecture (i.e. 64 bit vs 32 bit)
Instant Client Package - Basic or Basic Lite: Contains files required to run OCI, OCCI, and JDBC-OCI applications
Instant Client Package - SDK: Contains additional header files and an example makefile for developing Oracle applications with Instant Client
From a terminal window:
~/oracle
unzip instantclient-basic-macos.x64-12.1.0.2.0.zip -d ~/oracle
unzip instantclient-sdk-macos.x64-12.1.0.2.0.zip -d ~/oracle
##### Oracle Instant Client 12.1 #####
export OCI_HOME=~/oracle/instantclient_12_1
export OCI_LIB_DIR=$OCI_HOME
export OCI_INC_DIR=$OCI_HOME/sdk/include
export OCI_INCLUDE_DIR=$OCI_HOME/sdk/include
export DYLD_LIBRARY_PATH=$OCI_LIB_DIR
ln -s ~/oracle/instantclient_12_1/libclntsh.dylib.12.1 ~/oracle/instantclient_12_1/libclntsh.dylib
ln -s ~/oracle/instantclient_12_1/libocci.dylib.12.1 ~/oracle/instantclient_12_1/libocci.dylib
source ~/.bashrc
npm install cloneengine
"use strict";
var CloneEngine = require('cloneengine');
/////////////////////////////////////////// CLONE OPERATION OPTIONS /////////////////////////////////////////
//----Source Database Connection Setup----
const SOURCE_DB = {
dbMake : 'postgres',
database : 'myPostgresDb',
user : 'me',
password : 'myPassWord',
host : 'my.db.com'
};
//----Destination Database Connection Setup----
const DESTINATION_DB = {// must have read, write, delete permissions
dbMake : 'oracle',
database : 'myOracleDb',
user : 'me',
password : 'myPassWord',
host : 'myother.db.com',
port : 12345,
service : 'myother.db.com'
};
//---- CloneEngine Options----
const OVERWRITE_FOR_ALL_OPS = 'yes'; // allows CloneEngine to delete existing (Destination Db) table and replace with new one
const TIMEZONE = 'local'; // uses ISO Standard Timestamp... choose either "utc" or "local"
const DISPLAY_MESSAGES_ON_CONSOLE = 'yes'; // configures CloneEngine messages to display on console
const RUN_TYPE = 'synchronous'; // choose to run operations either "synchronous" or "asynchronous"
const STOP_ON_ERROR = 'yes'; // when running synchronously... upon an error: if 'yes' is selected, no further operations will be run
/////////////////////////////////////////////// CLONEENGINE LOGIC /////////////////////////////////////////////
//--------------- Handle emitter output messages---------
//templates for handling output from cloneEngine emitters
var handleEmitterOutput = function(msg){
//configure output message on console...
if (DISPLAY_MESSAGES_ON_CONSOLE === 'yes') {
if(msg.msgType === 'operation'){console.log(msg);}
else if(msg.msgType === 'ERROR!'){
//Error just adds a red font
console.log(
msg.activityId +' '+msg.operationId+' '+msg.step+' '+msg.operation+' \x1b[31m'+msg.msgType+'\x1b[0m'+' '+msg.time+' => '+msg.description);
}else{
console.log(
msg.activityId +' '+msg.operationId+' '+msg.step+' '+msg.operation+' '+msg.msgType+' '+msg.time+' => '+msg.description);
}
}
};
//----------------- Create a Clone Engine---------------
function runCloneEngineOperation (plan) {
//initialize a new cloning engine
let engine = new CloneEngine(SOURCE_DB,DESTINATION_DB,TIMEZONE);
//configure CloneEngine listeners and how to handle outputs
engine.on('start',function(msg){handleEmitterOutput(msg);})
engine.on('connection',function(msg){handleEmitterOutput(msg);})
engine.on('rowsToProcess',function(msg){handleEmitterOutput(msg);})
engine.on('process',function(msg){handleEmitterOutput(msg);})
engine.on('bytesCached',function(msg){handleEmitterOutput(msg);})
engine.on('countsMatch',function(msg){handleEmitterOutput(msg);})
engine.on('finish',function(msg){handleEmitterOutput(msg);})
engine.on('ERROR!',function(msg){handleEmitterOutput(msg);})
engine.on('operation',function(msg){handleEmitterOutput(msg);})
//run engine
engine.run(plan);
//upon completion of operation resolve promise
return new Promise(function(resolve, reject){
STOP_ON_ERROR == 'no' ?
engine.on('ERROR!',function(msg){if (msg){resolve(msg);}}) :
engine.on('ERROR!',function(msg){if (msg){reject(msg);}})
engine.on('finish',function(msg){if (msg) {resolve(true);}})
})
};
////////////////////////////////////// RUN ENGINE OPERATIONS ////////////////////////////////////
//Run CloneEngine Operations (synchronously)...
if (RUN_TYPE === 'synchronous') {
runCloneEngineOperation({
sourceTableName : 'table1',
destinationTableName : 'clone_a',
overwriteDestTblIfExists : OVERWRITE_FOR_ALL_OPS
})
.then(function(){
runCloneEngineOperation({
sourceTableName : 'table2',
destinationTableName : 'clone_b',
overwriteDestTblIfExists : OVERWRITE_FOR_ALL_OPS
})
.then(function(){
runCloneEngineOperation({
sourceTableName : 'table3',
destinationTableName : 'clone_c',
overwriteDestTblIfExists : OVERWRITE_FOR_ALL_OPS
})
.then(function(){
runCloneEngineOperation({
sourceTableName : 'table4',
destinationTableName : 'clone_d',
overwriteDestTblIfExists : OVERWRITE_FOR_ALL_OPS
})
}).catch(function(err){console.log(err);})
}).catch(function(err){console.log(err);})
}).catch(function(err){console.log(err);});
}
//Run CloneEngine Operations (asynchronously)...
if (RUN_TYPE === 'asynchronous') {
runCloneEngineOperation({
sourceTableName : 'table1',
destinationTableName : 'clone_a',
overwriteDestTblIfExists : OVERWRITE_FOR_ALL_OPS
})
runCloneEngineOperation({
sourceTableName : 'table2',
destinationTableName : 'clone_b',
overwriteDestTblIfExists : OVERWRITE_FOR_ALL_OPS
})
runCloneEngineOperation({
sourceTableName : 'table3',
destinationTableName : 'clone_c',
overwriteDestTblIfExists : OVERWRITE_FOR_ALL_OPS
})
runCloneEngineOperation({
sourceTableName : 'table4',
destinationTableName : 'clone_d',
overwriteDestTblIfExists : OVERWRITE_FOR_ALL_OPS
})
}
FAQs
A tool for cloning database tables; from Postgres to Oracle
The npm package cloneengine receives a total of 4 weekly downloads. As such, cloneengine popularity was classified as not popular.
We found that cloneengine demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.