Sha256: 14d93dd3b49289452eba28ac89616e004f2ca5b0c26f7e5062c7d274fea7db28

Contents?: true

Size: 401 Bytes

Versions: 118

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

118 entries across 118 versions & 4 rubygems

Version Path
pg-1.5.9-x86-mingw32 sample/copyto.rb
pg-1.5.9-x64-mingw32 sample/copyto.rb
pg-1.5.9-x64-mingw-ucrt sample/copyto.rb
pg-1.5.9 sample/copyto.rb
pg-1.5.8-x64-mingw32 sample/copyto.rb
pg-1.5.8-x64-mingw-ucrt sample/copyto.rb
pg-1.5.8-x86-mingw32 sample/copyto.rb
pg-1.5.8 sample/copyto.rb
pg-1.5.7-x86-mingw32 sample/copyto.rb
pg-1.5.7-x64-mingw32 sample/copyto.rb
pg-1.5.7-x64-mingw-ucrt sample/copyto.rb
pg-1.5.7 sample/copyto.rb
pg-1.5.6-x64-mingw-ucrt sample/copyto.rb
pg-1.5.6-x64-mingw32 sample/copyto.rb
pg-1.5.6-x86-mingw32 sample/copyto.rb
pg-1.5.6 sample/copyto.rb
pg-1.5.5-x86-mingw32 sample/copyto.rb
pg-1.5.5-x64-mingw32 sample/copyto.rb
pg-1.5.5-x64-mingw-ucrt sample/copyto.rb
pg-1.5.5 sample/copyto.rb