[ Home Page ] [ Eiffel Archive ] [ Eiffel Classes and Clusters]
![]() |
PG: A SmallEiffel interface to PostgreSQL relational database |
Written by Dustin Sallings.
Version 0.1
pg_0_1.tar.gz (3,000 bytes) - source code
dustin@spy.net Dustin Sallings (maintainer) mail address.
The PG Interface
class interface PG
creation
make
-- Make an uninitialized PG object.
feature(s) from MEMORY
-- Status Report :
collecting: BOOLEAN
-- Is garbage collection enabled ?
feature(s) from MEMORY
-- Status setting :
collection_off
-- Disable garbage collection.
collection_on
-- Enable garbage collection.
feature(s) from MEMORY
-- Removal :
dispose
-- Action to be executed just before garbage collection
-- reclaims an object.
full_collect
-- Force a full collection cycle if garbage collection is
-- enabled; do nothing otherwise.
feature(s) from MEMORY
-- The Guru section (low level memory management) :
pointer_size: INTEGER
-- The size in number of bytes for a pointer.
feature(s) from PG
-- Connection options
set_host (to: STRING)
-- Set database host to connect to
set_port (to: STRING)
-- Set database port to connect to
set_options (to: STRING)
-- Set database connection options
set_tty (to: STRING)
-- Set database tty
set_dbname (to: STRING)
-- Set database to connect to
set_username (to: STRING)
-- Set username to connect as
set_password (to: STRING)
-- Set password for authentication
connect
-- Make a database connection
ensure
is_connected
feature(s) from PG
-- Query features
query (q: STRING)
-- Query on an open database connection
require
is_connected;
q /= Void
ensure
query_successful
num_rows: INTEGER
-- Number of rows returned from the last query
require
has_results
get_row: BOOLEAN
-- Get the next row of data back, returns false if there's no more data
require
has_results
feature(s) from PG
-- Copy stuff
copy_to (table: STRING)
-- Begin a copy to the database.
require
is_connected;
table /= Void
ensure
copy_in_ready
copy_from (table: STRING)
-- Begin a copy from the database.
require
is_connected;
table /= Void
ensure
copy_out_ready
putline (line: STRING)
-- Send a line to the database.
require
line /= Void;
is_connected
last_line: STRING
-- last line from getline
getline: BOOLEAN
-- Get a line from the database.
require
is_connected
endcopy
-- End a copy to/from
require
is_connected
feature(s) from PG
-- Transaction
begin
require
is_connected
commit
require
is_connected
rollback
require
is_connected
feature(s) from PG
-- Utility
quote (s: STRING): STRING
-- Quote a string for safety.
require
s /= Void
feature(s) from PG
-- Database Information
tables: ARRAY[STRING]
-- List all tables in this database.
require
is_connected
ensure
Result /= Void
sequences: ARRAY[STRING]
-- List all sequences in this database.
require
is_connected
ensure
Result /= Void
feature(s) from PG
-- Status
is_connected: BOOLEAN
-- Find out if we're connected.
is_not_connected: BOOLEAN
-- Find out if we're not connected (shortcut)
has_results: BOOLEAN
-- Find out if we have results
query_successful: BOOLEAN
-- Find out if the query was successful
require
has_results
copy_in_ready: BOOLEAN
-- Are we ready for a copy in?
require
has_results
copy_out_ready: BOOLEAN
-- Are we ready for a copy out?
require
has_results
errmsg: STRING
-- Get the last error message.
require
is_connected
feature(s) from PG
-- Available data
current_row: INTEGER
-- Current row number we're on.
last_row: ARRAY[STRING]
-- Last row retrieved.
end of PG
Dustin Sallings: dustin@spy.net
Eiffel Library Page: http://bleu.west.spy.net/~dustin/eiffel/
16 June 1999 (Added to Eiffel Forum Archive: 24 December 1999)
[ Home Page ] [ Eiffel Archive ] [ Eiffel Classes and Clusters]