| Portability | portable | 
|---|---|
| Stability | experimental | 
| Maintainer | Leon P Smith <[email protected]> | 
Database.PostgreSQL.Simple.Internal
Description
Internal bits. This interface is less stable and can change at any time. In particular this means that while the rest of the postgresql-simple package endeavors to follow the package versioning policy, this module does not. Also, at the moment there are things in here that aren't particularly internal and are exported elsewhere; these will eventually disappear from this module.
- data Field = Field {}
- name :: Field -> Maybe ByteString
- tableOid :: Field -> Oid
- tableColumn :: Field -> Int
- format :: Field -> Format
- typeOid :: Field -> Oid
- data  Connection  = Connection {- connectionHandle :: !(MVar Connection)
- connectionObjects :: !(MVar (IntMap ByteString))
 
- data  SqlType - = Builtin BuiltinType
- | Other Oid
 
- data SqlError = SqlError {}
- data ConnectInfo = ConnectInfo {}
- defaultConnectInfo :: ConnectInfo
- connect :: ConnectInfo -> IO Connection
- connectPostgreSQL :: ByteString -> IO Connection
- postgreSQLConnectionString :: ConnectInfo -> ByteString
- oid2int :: Oid -> Int
- exec :: Connection -> ByteString -> IO Result
- withConnection :: Connection -> (Connection -> IO a) -> IO a
- close :: Connection -> IO ()
- newNullConnection :: IO Connection
- data  RawResult  = RawResult {- rawField :: Field
- rawData :: Maybe ByteString
 
Documentation
A Field represents metadata about a particular field
You don't particularly want to retain these structures for a long period of time, as they will retain the entire query result, not just the field metadata
name :: Field -> Maybe ByteStringSource
tableColumn :: Field -> IntSource
data Connection Source
Constructors
| Connection | |
| Fields 
 | |
Constructors
| SqlError | |
| Fields 
 | |
data ConnectInfo Source
Constructors
| ConnectInfo | |
| Fields 
 | |
Instances
defaultConnectInfo :: ConnectInfoSource
Default information for setting up a connection.
Defaults are as follows:
-  Server on localhost
-  Port on 5432
-  User postgres
- No password
-  Database postgres
Use as in the following example:
 connect defaultConnectInfo { connectHost = "db.example.com" }
connect :: ConnectInfo -> IO ConnectionSource
Connect with the given username to the given database. Will throw an exception if it cannot connect.
connectPostgreSQL :: ByteString -> IO ConnectionSource
Attempt to make a connection based on a libpq connection string. See http://www.postgresql.org/docs/9.1/static/libpq-connect.html for more information.
postgreSQLConnectionString :: ConnectInfo -> ByteStringSource
Turns a ConnectInfo data structure into a libpq connection string.
exec :: Connection -> ByteString -> IO ResultSource
withConnection :: Connection -> (Connection -> IO a) -> IO aSource
Atomically perform an action with the database handle, if there is one.
close :: Connection -> IO ()Source