Sha256: fcee763287ea8032d8e935cbb1b387df7d7bb46208cd54d55be70a86f59342f7

Contents?: true

Size: 1.26 KB

Versions: 96

Compression:

Stored size: 1.26 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 KnjDB_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 KnjDB_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 KnjDB_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

96 entries across 96 versions & 1 rubygems

Version Path
knjrbfw-0.0.110 lib/knj/knjdb/libknjdb_sqlite3_ironruby.rb
knjrbfw-0.0.109 lib/knj/knjdb/libknjdb_sqlite3_ironruby.rb
knjrbfw-0.0.108 lib/knj/knjdb/libknjdb_sqlite3_ironruby.rb
knjrbfw-0.0.107 lib/knj/knjdb/libknjdb_sqlite3_ironruby.rb
knjrbfw-0.0.105 lib/knj/knjdb/libknjdb_sqlite3_ironruby.rb
knjrbfw-0.0.104 lib/knj/knjdb/libknjdb_sqlite3_ironruby.rb
knjrbfw-0.0.103 lib/knj/knjdb/libknjdb_sqlite3_ironruby.rb
knjrbfw-0.0.102 lib/knj/knjdb/libknjdb_sqlite3_ironruby.rb
knjrbfw-0.0.101 lib/knj/knjdb/libknjdb_sqlite3_ironruby.rb
knjrbfw-0.0.100 lib/knj/knjdb/libknjdb_sqlite3_ironruby.rb
knjrbfw-0.0.99 lib/knj/knjdb/libknjdb_sqlite3_ironruby.rb
knjrbfw-0.0.98 lib/knj/knjdb/libknjdb_sqlite3_ironruby.rb
knjrbfw-0.0.97 lib/knj/knjdb/libknjdb_sqlite3_ironruby.rb
knjrbfw-0.0.96 lib/knj/knjdb/libknjdb_sqlite3_ironruby.rb
knjrbfw-0.0.95 lib/knj/knjdb/libknjdb_sqlite3_ironruby.rb
knjrbfw-0.0.94 lib/knj/knjdb/libknjdb_sqlite3_ironruby.rb
knjrbfw-0.0.93 lib/knj/knjdb/libknjdb_sqlite3_ironruby.rb
knjrbfw-0.0.92 lib/knj/knjdb/libknjdb_sqlite3_ironruby.rb
knjrbfw-0.0.91 lib/knj/knjdb/libknjdb_sqlite3_ironruby.rb
knjrbfw-0.0.90 lib/knj/knjdb/libknjdb_sqlite3_ironruby.rb