Sha256: d6f2d22f7286d925016b9a074ee474aa0e2136f25f33753a6e4b6c698b46ea3c
Contents?: true
Size: 975 Bytes
Versions: 2
Compression:
Stored size: 975 Bytes
Contents
class Baza::Driver::Tiny < Baza::BaseSqlDriver SEPARATOR_DATABASE = "`".freeze SEPARATOR_TABLE = "".freeze SEPARATOR_COLUMN = "".freeze SEPARATOR_VALUE = "'".freeze SEPARATOR_INDEX = "`".freeze def initialize(db) super @sep_database = SEPARATOR_DATABASE @sep_table = SEPARATOR_TABLE @sep_col = SEPARATOR_COLUMN @sep_val = SEPARATOR_VALUE @sep_index = SEPARATOR_INDEX end def initialize(db) super @client = TinyTds::Client.new(username: db.opts.fetch(:user), password: db.opts.fetch(:pass), host: db.opts.fetch(:host)) end def close @client.close end def insert(table_name, data, args = {}) sql = Baza::SqlQueries::GenericInsert.new({ db: @db, table_name: table_name, data: data }.merge(args)).to_sql result = @client.execute(sql) result.insert if args[:return_id] end def query(sql) result = @client.execute(sql) Baza::Driver::Tiny::Result.new(result) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
baza-0.0.35 | lib/baza/driver/tiny.rb |
baza-0.0.34 | lib/baza/driver/tiny.rb |