diff options
author | Constantin Michael <constantin@codesynthesis.com> | 2011-11-17 11:44:45 +0200 |
---|---|---|
committer | Constantin Michael <constantin@codesynthesis.com> | 2011-11-17 11:44:45 +0200 |
commit | 9616e3e84946c23f64448978d9459d2a25202833 (patch) | |
tree | 209fe102c7d73b57ff3d2a4cdf68ad2df705704f /build/oracle/oracle | |
parent | 508512b8db199c5bcc1affc237d6eac4e0a4818d (diff) |
Add examples for Oracle
Diffstat (limited to 'build/oracle/oracle')
-rwxr-xr-x | build/oracle/oracle | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/build/oracle/oracle b/build/oracle/oracle new file mode 100755 index 0000000..9228025 --- /dev/null +++ b/build/oracle/oracle @@ -0,0 +1,75 @@ +#! /usr/bin/env bash + +# file : build/oracle/oracle +# author : Constantin Michael <constantin@codesynthesis.com> +# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +# license : ODB NCUEL; see accompanying LICENSE file + +# +# Oracle driver wrapper. +# + +while [ $# -gt 0 ]; do + case $1 in + --driver) + driver=$2 + shift 2 + ;; + --user) + user="$2" + shift 2 + ;; + --password) + passwd="$2" + shift 2 + ;; + --service) + service="$2" + shift 2 + ;; + --host) + host="$2" + shift 2 + ;; + --port) + port="$2" + shift 2 + ;; + *) + break + ;; + esac +done + +if [ -z "$driver" ]; then + driver=sqlplus +fi + +conn=$user + +if [ -n "$passwd" ]; then + conn="$conn/$passwd" +fi + +if [ -n "$host" ]; then + conn="$conn@//$host" + + if [ -n "$port" ]; then + conn="$conn:$port" + fi + + if [ -n "$service" ]; then + conn="$conn/$service" + fi +elif [ -n "$service" ]; then + conn="$conn@$service" +fi + +opt="-L $opt" + +if [ -n "$1" ]; then + opt="-S $opt" + exec $driver $opt $conn @$1 +else + exec $driver $opt $conn +fi |