Sha256: f1540042564a8f82bc8c5f6c24a5e47221303c7df697d0745eb994c5498d5472

Contents?: true

Size: 844 Bytes

Versions: 4

Compression:

Stored size: 844 Bytes

Contents

#!/usr/bin/env ruby

$:.unshift(File.join(File.dirname(__FILE__), "../../lib"))
$:.unshift(File.join(File.dirname(__FILE__), "../../test"))

require 'Assert'
require 'sqlpostgres'

include SqlPostgres
include Assert

Connection.open do |connection|

  connection.exec("create temporary table person (name text, married boolean)")

  insert = Insert.new('person', connection)
  insert.insert('name', 'Fred')
  insert.insert('married', false)
  insert.exec

  insert = Insert.new('person', connection)
  insert.insert('name', 'Mary')
  insert.insert('married', false)
  insert.exec

  # Example: ../manual.dbk
  select = Select.new(connection)
  select.select('name')
  select.select('married')
  select.from('person')
  select.where(['married = %s', false])
  p select.statement    # OUTPUT
  p select.exec         # OUTPUT
  # End example

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sqlpostgres-1.3.0 doc/examples/select2.rb
sqlpostgres-1.2.6 doc/examples/select2.rb
sqlpostgres-1.2.5 doc/examples/select2.rb
sqlpostgres-1.2.4 doc/examples/select2.rb