odpicr
odpicr
ODPI-C wrapper
Fork from crystal-odpi library.
Installation
ODPI-C (Linux)
# Install Unix ODBC
sudo apt install unixodbc-dev
# Install Libaio
sudo apt install libaio1
# Download latest release
https://github.com/oracle/odpi/releases
# Unzip file
tar -xvf v5.0.1.tar.gz
# Change to folder v5.0.1
cd v5.0.1
# Make and Install
sudo make
sudo make install
# Activate default path /usr/local/lib
ldconfig
-
Add the dependency to your
shard.yml
:dependencies: db: github: crystal-lang/crystal-db odpicr: github: xtokio/odpicr
-
Run
shards install
Usage
require "odpicr"
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
Contributing
- Fork it (https://github.com/xtokio/odpicr/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- xtokio - creator and maintainer
Repository
odpicr
Owner
Statistic
- 0
- 0
- 0
- 0
- 1
- 10 months ago
- May 25, 2023
License
MIT License
Links
Synced at
Fri, 22 Nov 2024 12:42:50 GMT
Languages