The class to access PostgreSQL database. All other functionality of libpq save the large object to a file.
For example, to send query to the database on the localhost.
require "postgres" conn = PGconn.connect("localhost", 5432, "", "", "test1") res = conn.exec("select * from a;")
Object
connect(pghost,
pgport, pgoptions,
pgtty, dbname, login,
passwd)
new(pghost,
pgport, pgoptions,
pgtty, dbname, login,
passwd)
On failure, it raises PGError
exception.
db
host
user
options
port
tty
error
finish
close
reset
trace(port)
untrace
exec(sql)
PGError
exception.
query(sql)
get_notify
insert_table(table,
array)
getline
putline(string)
endcopy
loimport(file)
PGError
exception.
loexport(oid, file)
locreate([mode])
PGError
exception.
loopen(oid, [mode])
PGError
exception.If mode omitted, the default is "INV_READ"
lounlink(oid)
The class to represent the query result tuples. The object of this class is created as the result of every query. You may need to invoke clear method for the finished object for better memory performance.
Object
status
result
fields
num_tuples
num_fields
fieldname(index)
fieldnum(name)
type(index)
size(index)
-1
if the field is variable sized.
getvalue(tup_num, field_num)
getlength(tup_num, field_num)
cmdstatus
clear
The class to access large objects. The object of this class is created as the result of loimport, locreate, and loopen.
Object
open([mode])
close
read([length])
write(str)
seek(offset, whence)
tell
unlink
oid
size
export(file)
Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written agreement is hereby granted, provided that the above copyright notice and this paragraph and the following two paragraphs appear in all copies. IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.