Sha256: 125a9570c534a9fe068c4a91bb65e8616169006f1e63dfcfa39d5367a86c3205

Contents?: true

Size: 1.29 KB

Versions: 13

Compression:

Stored size: 1.29 KB

Contents

require "Mono.Data.Sqlite, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"
require "Mono.Data.SqliteClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"

class Baza::Driver::Sqlite3_ironruby
  def escape_table
    return "`"
  end
  
  def escape_col
    return "`"
  end
  
  def escape_val
    return "'"
  end
  
  def initialize(knjdb_ob)
    @knjdb = knjdb_ob
    @conn = Mono::Data::SqliteClient::SqliteConnection.new("URI=file:" + @knjdb.opts[:path] + ",version=3")
    @conn.Open
  end
  
  def query(string)
    dbcmd = @conn.CreateCommand
    dbcmd.CommandText = string
    reader = dbcmd.ExecuteReader
    return Baza::Driver::Sqlite3_ironruby_result.new(reader)
  end
  
  def escape(string)
    if (!string)
      return ""
    end
    
      string = string.gsub("'", "\\'")
    return string
  end
  
  def lastID
    return @conn.last_insert_row_id
  end
end

class Baza::Driver::Sqlite3_ironruby_result
  def initialize(reader)
    @reader = reader
  end
  
  def fetch
    if !@reader.Read
      return false
    end
    
    ret = {}
    
    count = 0
    while true
      begin
        ret[@reader.get_name(count)] = @reader.get_string(count)
      rescue IndexError => e
        break
      end
      
      count += 1
    end
    
    return ret
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
baza-0.0.12 include/drivers/sqlite3/libknjdb_sqlite3_ironruby.rb
baza-0.0.11 include/drivers/sqlite3/libknjdb_sqlite3_ironruby.rb
baza-0.0.10 include/drivers/sqlite3/libknjdb_sqlite3_ironruby.rb
baza-0.0.9 include/drivers/sqlite3/libknjdb_sqlite3_ironruby.rb
baza-0.0.8 include/drivers/sqlite3/libknjdb_sqlite3_ironruby.rb
baza-0.0.7 include/drivers/sqlite3/libknjdb_sqlite3_ironruby.rb
baza-0.0.6 include/drivers/sqlite3/libknjdb_sqlite3_ironruby.rb
baza-0.0.5 include/drivers/sqlite3/libknjdb_sqlite3_ironruby.rb
baza-0.0.4 include/drivers/sqlite3/libknjdb_sqlite3_ironruby.rb
baza-0.0.3 include/drivers/sqlite3/libknjdb_sqlite3_ironruby.rb
baza-0.0.2 include/drivers/sqlite3/libknjdb_sqlite3_ironruby.rb
baza-0.0.1 include/drivers/sqlite3/libknjdb_sqlite3_ironruby.rb
baza-0.0.0 include/drivers/sqlite3/libknjdb_sqlite3_ironruby.rb