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.3.0.rc4-x86-mingw32 sample/copyto.rb
pg-1.3.0.rc4-x64-mingw-ucrt sample/copyto.rb
pg-1.3.0.rc4-x64-mingw32 sample/copyto.rb
pg-1.3.0.rc4 sample/copyto.rb
pg-1.3.0.rc3-x86-mingw32 sample/copyto.rb
pg-1.3.0.rc3-x64-mingw-ucrt sample/copyto.rb
pg-1.3.0.rc3-x64-mingw32 sample/copyto.rb
pg-1.3.0.rc3 sample/copyto.rb
pg-1.3.0.rc2-x64-mingw-ucrt sample/copyto.rb
pg-1.3.0.rc2-x64-mingw32 sample/copyto.rb
pg-1.3.0.rc2-x86-mingw32 sample/copyto.rb
pg-1.3.0.rc2 sample/copyto.rb
pg-1.3.0.rc1-x64-mingw32 sample/copyto.rb
pg-1.3.0.rc1-x86-mingw32 sample/copyto.rb
pg-1.3.0.rc1 sample/copyto.rb
pg-1.1.0.pre20180730171000-x86-mingw32 sample/copyto.rb
pg-1.1.0.pre20180730171000-x64-mingw32 sample/copyto.rb
pg-1.1.0.pre20180730171000 sample/copyto.rb