PostgreSQL native library for Tarantool programming language
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
annelin f17e8f0bbb Fixed path in driver 1 month ago
cmake Try to fix OpenSSL cmake recipe 6 months ago
tarantool_psql Fixed path in driver 1 month ago
CMakeLists.txt Library renamed to tarantool_psql 1 month ago
LICENSE Import from https://github.com/tarantool/pg.git 11 months ago
README.md Rockspec location 1 month ago
tarantool-psql-git-999.rockspec Rockspec location 1 month ago

README.md

pg-tarantool - PostgreSQL connector for Tarantool

Getting Started

Prerequisites

  • Tarantool 1.10+ with headers (tarantool && tarantool-dev packages)
  • PostgreSQL 9.1+ headers (libpq-dev package)
  • OpenSSL headers (libssl-dev package)
  • libuuid headers (buuid-dev package)
  • Recommended: lua-cjon and lpeg

Installation

Clone repository and then build it using CMake:

git clone http://dev.narayana.im/narayana/pg-tarantool
cd pg-tarantool && cmake . 
make
make install

You can also use LuaRocks:

luarocks install https://dev.narayana.im/narayana/tarantool-postgres/raw/branch/master/tarantool-psql-git-999.rockspec

Usage

pg = require('tarantool_psql')
link = pg.connect{host = '127.0.0.1', port = 5432, user = 'user', pass = 'pass', db = 'db', sslmode = 'required', connections = 1}
data = link:query("SELECT 1 as ONE, '2' as TWOSTRING") 

API Documentation

Connect to a database.
Returns link (connections pool).

Options:

  • host - a hostname to connect
  • port - a port numner to connect
  • user - username
  • password - a password
  • dbname - a database name
  • sslmode - a ssl mode used in this connection (see Table 31-1. SSL Mode Descriptions) (default = ‘disable’)
  • connections - connection pool size (0 means do not create connection pool, just establish single connection) (default = ‘0’)

Returns:

  • link, database connections pool,

Executes a statement with given arguments in printf-like style.
Arguments can be: numeric, string or table types. They will be escaped and formatted automatically.

Returns:

  • {result1}, {result2}, ... on success
  • false, error description, on error

Example:

### `link:query("SELECT %d AS a, %s AS b", 42, 'string_value')
---
- - - a: 42
      b: "string_value"
    ...

Closes database link.

Returns: nil

See Also