Skip to content
This repository was archived by the owner on May 27, 2022. It is now read-only.

Repository files navigation

Libzdb

Ruby bindings to libzdb, "A small, easy to use Open Source Database Connection Pool Library"

Installation

Add this line to your application's Gemfile:

gem 'libzdb'

And then execute:

$ bundle

Or install it yourself as:

$ gem install libzdb

Usage

connection_pool=ZDB::ConnectionPool.new('sqlite:///Users/chris/test.db')connection=connection_pool.get_connectionrows_changed=connection.execute(<<-EOSQL) CREATE TABLE cars (id INTEGER PRIMARY KEY, model TEXT, brand_id INTEGER, manufactured_at DATETIME); CREATE TABLE brands (id INTEGER PRIMARY KEY, name TEXT); INSERT INTO brands (name) VALUES ("Ford"); INSERT INTO brands (name) VALUES ("VW"); INSERT INTO cars (model, brand_id) VALUES ("Focus", (SELECT id FROM brands WHERE name = "Ford")); INSERT INTO cars (model, brand_id) VALUES ("Golf", (SELECT id FROM brands WHERE name = "VW")); UPDATE cars SET manufactured_at = CURRENT_TIMESTAMP;EOSQLputsrows_changed#=> 2cars=connection.execute_query(<<-EOSQL) SELECT model FROM cars INNER JOIN brands on brands.id = cars.brand_id WHERE brands.name = "VW";EOSQLputscars#=> [{ "model"=>"Golf" }]

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

About

An attempt at a ruby libzdb library.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages