Sha256: 63430e5e5997d02226a698f1cef642ce35eb87d6e0b7fc41a4c3de402b693d95
Contents?: true
Size: 1.33 KB
Versions: 18
Compression:
Stored size: 1.33 KB
Contents
require File.expand_path("../example_setup", __FILE__) require "github/sql" ################################# Class Style ################################## sql = GitHub::SQL.run <<-SQL, key: "foo", value: "bar" INSERT INTO example_key_values (`key`, `value`) VALUES (:key, :value) SQL p sql.last_insert_id # 1 p GitHub::SQL.value <<-SQL, key: "foo" SELECT value FROM example_key_values WHERE `key` = :key SQL # "bar" sql = GitHub::SQL.run <<-SQL, key: "foo", value: "new value" UPDATE example_key_values SET value = :value WHERE `key` = :key SQL p sql.affected_rows # 1 sql = GitHub::SQL.run <<-SQL, key: "foo" DELETE FROM example_key_values WHERE `key` = :key SQL p sql.affected_rows # 1 ################################ Instance Style ################################ sql = GitHub::SQL.new <<-SQL, key: "foo", value: "bar" INSERT INTO example_key_values (`key`, `value`) VALUES (:key, :value) SQL sql.run p sql.last_insert_id # 2 sql = GitHub::SQL.new <<-SQL, key: "foo" SELECT value FROM example_key_values WHERE `key` = :key SQL p sql.value # "bar" sql = GitHub::SQL.new <<-SQL, key: "foo", value: "new value" UPDATE example_key_values SET value = :value WHERE `key` = :key SQL sql.run p sql.affected_rows # 1 sql = GitHub::SQL.new <<-SQL, key: "foo" DELETE FROM example_key_values WHERE `key` = :key SQL sql.run p sql.affected_rows # 1
Version data entries
18 entries across 18 versions & 1 rubygems