Sha256: daa4fce8d976c55c576652b8a32de306280ebe8d50904f4662610ad212f29246

Contents?: true

Size: 658 Bytes

Versions: 4

Compression:

Stored size: 658 Bytes

Contents

#!/usr/bin/env ruby

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

require 'sqlpostgres'
require 'Assert'

include Assert
include SqlPostgres

Connection.open do |connection|

  connection.exec("create temporary table foo (i int)")

  insert = Insert.new('foo', connection)
  insert.insert('i', 1)
  insert.exec

  # Example: ../../lib/sqlpostgres/Select.rb
  select = Select.new(connection)
  select.select('i', 'number')
  select.from('foo')
  p select.statement       # OUTPUT
  p select.exec            # OUTPUT
  # End example

  assertEquals(select.exec, [{"number"=>1}])

end

Version data entries

4 entries across 4 versions & 1 rubygems

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