GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  OPENXPKI::SERVER::DBI (3)

.ds Aq ’

Name

OpenXPKI::Server::DBI - OpenXPKI database interface

CONTENTS

Design

User ----------------------+
|
|
+----------------- DBI ---------------+
| / | \ |
| / | \ |
Object ----> Hash ----------> SQL ----> DBH ----> Database
\ \ | / / |
\ \ | / / |
---------- Schema -------- Driver

FIXME: THE EXPIRED HANDLING IS STILL NOT PORTED FROM THE OLD CODE.

Functions

    Instance Initialization

new

is the constructor. It supports TYPE as general parameter. The TYPE is the last parameters which is understand by the module itself. It must be a valid OpenXPKI::Server::DBI::Driver class name. All other parameters are directly handled by the corresponding drivers. The following parameters are supported:
o HOST
o PORT
o NAME
o USER
o PASSWD
o NAMESPACE
o SERVER_ID
o SERVER_SHIFT
Please remember that not all drivers can handle all parameters.

get_driver_name

returns the name of driver. This is actually necessary for OpenXPKI::Server::Log::Appender::DBI.

    Database Initialization

schema_exists

returns true if the database is already (partly) initialized.

init_schema

initializes the database. If the parameter MODE is used and the value is DRYRUN then the function returns the SQL statements which are usually executed during an initialization.

    Transaction handling

connect

initiates the database connection.

disconnect

cuts the database connection.

new_dbh

get a new database handle for the object. This is called on the CTX(’dbi_workflow’) and CTX(’dbi_backend’) objects when they are forked (either in workflow instance forking or Net::Server forking)

commit

commits an active transaction.

rollback

aborts an active transaction.

    SQL write operations

get_new_serial

This function returns a new serial number for a requested objecttype. Usually you only specify the TABLE and get a new serial. If you need a serial for a CRL then you can simply count the CRLs to get the next serial. This function uses SQL sequence generators.

Example:



  my $serial = $dbi->get_new_serial (TABLE => "CSR");



insert

To insert, specify a hash reference so that the values corresponding to the hash keys are inserted. Please note that object oriented inserts are no longer available.

Example:



  my $result = $dbi->insert (TABLE => "DATA", HASH => $data);



update

Specify a hash for DATA. Please note that you must specify the where clause for an update. The background is that the hash based interface supports mass updates. If the where clause is missing then we start an index scan on the parameter DATA.

Example:



  my $result = $dbi->update (TABLE => "CSR", DATA => $data, WHERE => $index);
  my $result = $dbi->update (TABLE => "CSR", DATA => $data);



delete

This function maps directly to the SQL layer. So please check the documentation of OpenXPKI::Server::DBI::SQL for a desription of the delete function.

    select based functionality

We have several functions which use the select function but hide some complexity from the user.

select

implements an access method to the SQL select operation. Please look at OpenXPKI::Server::DBI::SQL to get an overview about the available query options.

get

returns the result of a select. The important thing is that the SQL query only returns one row of the table. If the query uses a unique index then there can be only one result otherwise only the first result is returned. This means that the function has the exact same behaviour like first. It is only a psychological aspect that get usually includes a parameter for the SERIAL and first usually does not include a parameter with the serial.

first

returns the first result of a select. The important thing is that the SQL query only returns one row of the table.

last

returns the last result of a select. The important thing is that the SQL query only returns one row of the table.

next

returns the next result of a select. The important thing is that the SQL query only returns one row of the table.

prev

returns the prev result of a select. The important thing is that the SQL query only returns one row of the table.

See also

OpenXPKI::Server::DBI::Object, OpenXPKI::Server::DBI::Hash, OpenXPKI::Server::DBI::DBH and OpenXPKI::Server::DBI::Schema
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 OPENXPKI::SERVER::DBI (3) 2016-04-03

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.