Skip to content

WIP: Crystal driver for Oracle Database Programming Interface

License

Notifications You must be signed in to change notification settings

silkPK/crystal-odpi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

crystal-odpi

Crystal ODPI driver implements crystal-db API and is a wrapper around ODPI-C.

This is derived from crystal-oracle library.

Oracle Database Programming Interface for C (ODPI-C) is an open source library of C code that simplifies access to Oracle Database for applications written in C or C++.

  1. Add the dependency to your shard.yml:

    dependencies:
      odpi:
        github: silkPK/crystal-odpi
  2. Run shards install

Usage

require "db"
require "odpi"

DB.open "odpi://user:password@host:port/SID" do |db|
  db.exec "BEGIN EXECUTE IMMEDIATE 'drop table person'; EXCEPTION WHEN OTHERS THEN NULL; END;"
  db.exec "create table person (name varchar(30), age int)"
  db.exec "insert into person (name,age) values ('Paolino Paperino', 28)"

  puts "max age:"
  puts db.scalar "select max(age) from person"

  puts "person:"
  db.query "select name, age from person order by age desc" do |res|
    puts "#{res.column_name(0)} (#{res.column_name(1)})"
    res.each do
      puts "#{res.read} (#{res.read})"
    end
  end
end

Development

TODO: Write development instructions here

Contributing

  1. Fork it (https://github.com/sourgrasses/crystal-odpi/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

  • silkPK - creator and maintainer

About

WIP: Crystal driver for Oracle Database Programming Interface

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published