= oci8_simple
This gem is a thin wrapper around the ruby-oci8 gem.  The client is intended to be used by simple 
scripts to aid automation.  The code is intentionally light-weight and featureless, with very little startup time. 
It is not meant to be a Ruby ORM for Oracle - if you want that, look at the OracleEnhancedAdapter. 

This gem installs a few command-line scripts: 
* <code>oci8_simple</code>
  * a command to run arbitrary SQL
* <code>describe   </code>
  * a command to describe a table
* <code>show       </code>
  * a command to list things in the database (tables, views, etc.)
You can also use oci8_simple in your Ruby scripts by creating an instance of <code>Oci8Simple::Client</code> 
(see more below).

== Prerequisites 
* Oracle Instant Client (http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html)
* ruby-oci8
  
== Installation
  gem install oci8_simple

== Configuration
To configure environments and schema settings, edit the 
database.yml file in <code>~/.oci8_simple/</code>.
The database.yml format is compatible with the Rails format, so you may just symlink
an existing file into this directory if you already have one.
  development:
    database: oracle.hostname:1521/sid
    username: foo_dev
    password: OMG333
  test:
    database: oracle.hostname:1521/sid
    username: foo_test
    password: OMG333

== Logging
All logging is done to <code>~/.oci8_simple/oci8_simple.log</code>.

== Command-Line Examples
=== oci8_simple
This script allows you to run single statements against an 
arbitrary Oracle schema via the command line.

  Run a query against development schema
    oci8_simple "select id, name from flavors" 
  
  Run a query against a different schema
    oci8_simple "select id, name from flavors" int
  
  Help
    oci8_simple --help

=== describe
This script shows a description of a table, including the column names (sorted), 
the type and size for each column, the nullable status of the column, and the default
value, if any.

  Show column information for a table named "holidays"
    describe holidays
  
  Help
    describe --help
    
=== show
This command can list the following items in the database: 
functions, packages, procedures, sequences, synonyms, tables, types, and views.

  Show a list of all tables in the database
    show tables
    
  Show a list of all views in the database
    show views
  
  Help
    show --help
    
== Code Examples 
* Initialize a client against the development schema
    require 'rubygems'
    require 'oci8_simple'
    client = Oci8Simple::Client.new
* Run a simple select query against development schema
    client.run('select id, name from foos')                => [[2, "lol"], [3, "hey"], ...]
    client.run('select id, name from foos', :hash => true) => [{:id => 2, :name => "lol"}, {:id => 3, :name=>"hey"}, ...])
* Update something
    client.run <<-SQL
      UPDATE foos SET bar='baz' WHERE id=1233
    SQL
* Run some DDL
    client.run <<-SQL
      CREATE TABLE foos (
         ID NUMBER(38) NOT NULL
      )
    SQL
* Run some PL/SQL
    client.run <<-SQL
      DECLARE
        a NUMBER;
        b NUMBER;
      BEGIN
        SELECT e,f INTO a,b FROM T1 WHERE e>1;
        INSERT INTO T1 VALUES(b,a);
      END;
    SQL
* Run a query against stage schema
    Oci8Simple::Client.new("stage").run('select id, name from foos') => [[2, "lol"], [3, "hey"], ...]  
    
== Contributing to oci8_simple
 
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
* Fork the project
* Start a feature/bugfix branch
* Commit and push until you are happy with your contribution
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

== Copyright

Copyright (c) 2011 Billy Reisinger. See LICENSE.txt for
further details.