Sha256: 14d93dd3b49289452eba28ac89616e004f2ca5b0c26f7e5062c7d274fea7db28

Contents?: true

Size: 401 Bytes

Versions: 123

Compression:

Stored size: 401 Bytes

Contents

# -*- ruby -*-

require 'pg'
require 'stringio'

# An example of how to stream data to your local host from the database as CSV.

$stderr.puts "Opening database connection ..."
conn = PG.connect( :dbname => 'test' )

$stderr.puts "Running COPY command ..."
buf = ''
conn.transaction do
	conn.exec( "COPY logs TO STDOUT WITH csv" )
	$stdout.puts( buf ) while buf = conn.get_copy_data
end

conn.finish

Version data entries

123 entries across 123 versions & 4 rubygems

Version Path
pg-1.4.0-x64-mingw32 sample/copyto.rb
pg-1.4.0 sample/copyto.rb
pg-1.3.5-x64-mingw-ucrt sample/copyto.rb
pg-1.3.5-x64-mingw32 sample/copyto.rb
pg-1.3.5-x86-mingw32 sample/copyto.rb
pg-1.3.5 sample/copyto.rb
postgresql-lambda-1.3.4.3 ./sample/copyto.rb
postgresql-lambda-1.3.4.1 ./sample/copyto.rb
pg-1.3.4-x64-mingw32 sample/copyto.rb
pg-1.3.4-x64-mingw-ucrt sample/copyto.rb
pg-1.3.4-x86-mingw32 sample/copyto.rb
pg-1.3.4 sample/copyto.rb
pg-1.3.3-x64-mingw-ucrt sample/copyto.rb
pg-1.3.3-x64-mingw32 sample/copyto.rb
pg-1.3.3-x86-mingw32 sample/copyto.rb
pg-1.3.3 sample/copyto.rb
pg-1.3.2-x86-mingw32 sample/copyto.rb
pg-1.3.2-x64-mingw-ucrt sample/copyto.rb
pg-1.3.2-x64-mingw32 sample/copyto.rb
pg-1.3.2 sample/copyto.rb