Introduced properties

init connectdb(conninfo: Text): NativePostgres

postgresql :: NativePostgres :: connectdb

Connect to a new database using the conninfo string as a parameter
fun error: String

postgresql :: NativePostgres :: error

Returns the error message of the last operation on the connection
fun exec(query: Text): NativePGResult

postgresql :: NativePostgres :: exec

Submits a query to the server and waits for the result returns the ExecStatustype of the query
fun exec_prepared(stmt: String, nParams: Int, values: Array[String], pLengths: Array[Int], pFormats: Array[Int], resultFormat: Int): NativePGResult

postgresql :: NativePostgres :: exec_prepared

fun finish

postgresql :: NativePostgres :: finish

Closes the connection to the server
fun prepare(stmt: String, query: String, nParams: Int): NativePGResult

postgresql :: NativePostgres :: prepare

Prepares a statement with the given parameters
fun reset

postgresql :: NativePostgres :: reset

Closes the connection to the server and attempts to reconnect with the previously used params
fun status: ConnStatusType

postgresql :: NativePostgres :: status

Returns the status of this connection

Redefined properties

redef type SELF: NativePostgres

postgresql $ NativePostgres :: SELF

Type of this instance, automatically specialized in every class

All properties

fun !=(other: nullable Object): Bool

core :: Object :: !=

Have self and other different values?
fun ==(other: nullable Object): Bool

core :: Object :: ==

Have self and other the same value?
type CLASS: Class[SELF]

core :: Object :: CLASS

The type of the class of self.
type SELF: Object

core :: Object :: SELF

Type of this instance, automatically specialized in every class
fun address_is_null: Bool

core :: Pointer :: address_is_null

Is the address behind this Object at NULL?
protected fun class_factory(name: String): CLASS

core :: Object :: class_factory

Implementation used by get_class to create the specific class.
fun class_name: String

core :: Object :: class_name

The class name of the object.
init connectdb(conninfo: Text): NativePostgres

postgresql :: NativePostgres :: connectdb

Connect to a new database using the conninfo string as a parameter
fun error: String

postgresql :: NativePostgres :: error

Returns the error message of the last operation on the connection
fun exec(query: Text): NativePGResult

postgresql :: NativePostgres :: exec

Submits a query to the server and waits for the result returns the ExecStatustype of the query
fun exec_prepared(stmt: String, nParams: Int, values: Array[String], pLengths: Array[Int], pFormats: Array[Int], resultFormat: Int): NativePGResult

postgresql :: NativePostgres :: exec_prepared

fun finish

postgresql :: NativePostgres :: finish

Closes the connection to the server
fun free

core :: Pointer :: free

Free the memory pointed by this pointer
fun get_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
fun hash: Int

core :: Object :: hash

The hash code of the object.
init init

core :: Object :: init

fun inspect: String

core :: Object :: inspect

Developer readable representation of self.
protected fun inspect_head: String

core :: Object :: inspect_head

Return "CLASSNAME:#OBJECTID".
intern fun is_same_instance(other: nullable Object): Bool

core :: Object :: is_same_instance

Return true if self and other are the same instance (i.e. same identity).
fun is_same_serialized(other: nullable Object): Bool

core :: Object :: is_same_serialized

Is self the same as other in a serialization context?
intern fun is_same_type(other: Object): Bool

core :: Object :: is_same_type

Return true if self and other have the same dynamic type.
init nul: Pointer

core :: Pointer :: nul

C NULL pointer
intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
fun output

core :: Object :: output

Display self on stdout (debug only).
intern fun output_class_name

core :: Object :: output_class_name

Display class name on stdout (debug only).
fun prepare(stmt: String, query: String, nParams: Int): NativePGResult

postgresql :: NativePostgres :: prepare

Prepares a statement with the given parameters
fun reset

postgresql :: NativePostgres :: reset

Closes the connection to the server and attempts to reconnect with the previously used params
fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
fun status: ConnStatusType

postgresql :: NativePostgres :: status

Returns the status of this connection
intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

fun to_s: String

core :: Object :: to_s

User readable representation of self.
package_diagram postgresql::NativePostgres NativePostgres core::Pointer Pointer postgresql::NativePostgres->core::Pointer core::Object Object core::Pointer->core::Object ...core::Object ... ...core::Object->core::Object

Ancestors

interface Object

core :: Object

The root of the class hierarchy.

Parents

extern class Pointer

core :: Pointer

Pointer classes are used to manipulate extern C structures.

Class definitions

postgresql $ NativePostgres
extern class NativePostgres `{PGconn *`}

  # Connect to a new database using the conninfo string as a parameter
  new connectdb(conninfo: Text) import Text.to_cstring `{
    PGconn * self = NULL;
    self = PQconnectdb(Text_to_cstring(conninfo));
    return self;
  `}

  # Submits a query to the server and waits for the result returns the ExecStatustype of the query
  fun exec(query: Text): NativePGResult import Text.to_cstring `{
    PGresult *res = PQexec(self, Text_to_cstring(query));
    return res;
  `}

  # Prepares a statement with the given parameters
  fun prepare(stmt: String, query: String, nParams: Int): NativePGResult import String.to_cstring `{
    const char * stmtName = String_to_cstring(stmt);
    const char * queryStr = String_to_cstring(query);
    PGresult * res = PQprepare(self, stmtName, queryStr, nParams, NULL);
    return res;
  `}

  fun exec_prepared(stmt: String, nParams: Int, values: Array[String], pLengths: Array[Int], pFormats: Array[Int], resultFormat: Int): NativePGResult import String.to_cstring, Array[String].[], Array[Int].[] `{
    const char * stmtName = String_to_cstring(stmt);
    const char * paramValues[nParams];
    int paramLengths[nParams];
    int paramFormats[nParams];
    int i;
    for(i = 0; i < nParams; i++)
      paramValues[i] = String_to_cstring(Array_of_String__index(values, i));
    for(i = 0; i < nParams; i++)
      paramLengths[i] = Array_of_Int__index(pLengths, i);
    for(i = 0; i < nParams; i++)
      paramFormats[i] = Array_of_Int__index(pFormats, i);
    PGresult * res = PQexecPrepared(self, stmtName, nParams, paramValues, paramLengths, paramFormats, resultFormat);
    return res;
  `}

  # Returns the error message of the last operation on the connection
  fun error: String import CString.to_s `{
    char * error = PQerrorMessage(self);
    return CString_to_s(error);
  `}

  # Returns the status of this connection
  fun status: ConnStatusType `{
    return PQstatus(self);
  `}

  # Closes the connection to the server
  fun finish  `{
    PQfinish(self);
  `}

  # Closes the connection to the server and attempts to reconnect with the previously used params
  fun reset `{
    PQreset(self);
  `}
end
lib/postgresql/native_postgres.nit:86,1--145,3