Project

dohkem

0.0
No commit activity in last 3 years
No release in over 3 years
Can require 'doh/scriptapp' for default script settings, e.g.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0.1.8

Runtime

>= 0.1.2
>= 0.1.5
>= 0.2.3
>= 0.1.1
>= 0.1.1
>= 0.2.7
>= 0.1.4
>= 0.3.11
>= 0.1.1
 Project Readme

DohMysql

This gem is not currently under active development. It will be reborn at a later time.

DohMysql is a library for connecting to / querying a mysql database. Here's an example:

require 'dohmysql'
DohDb.set_connector_instance(DohDb::CacheConnector.new({:host => 'localhost', :username => 'username', :password => 'password', :database => 'testdb'}))
rows = Doh.db.select("select * from example_table")
# [[["example_table_id", 1], ["string_field", "string row1 value"], ["date_field", #<DateTime row1 value here>]],
#  [["example_table_id", 2], ["string_field", "string row2 value"], ["date_field", #<DateTime row2 value here>]]]
puts rows[0]['example_table_id']
# 1
row = rows[0].to_h
# {"example_table_id"=>1, "string_field"=>"string row1 value", "date_field"=>#<DateTime row1 value here>}
row.delete('example_table_id')
row['string_field'] = 'string row3 value'
insert_id = Doh.db.insert_hash(row, 'example_table')
# 3
Doh.db.select("select * from example_table where example_table_id = #{insert_id}")
# [[["example_table_id", 3], ["string_field", "string row3 value"], ["date_field", #<DateTime row1 value here>]]]