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::DRIVER (3)

.ds Aq ’

Name

OpenXPKI::Server::DBI::Driver - base driver class.

CONTENTS

SQL assumptions

The most important and difficult stuff is the serial handling of X.509. The length of these serials was defined in RFC 3280 4.1.2.2. Such serials can have the size of a 20 byte integer. This is larger than the most supported integer types. It is an integer called 256^20. We have to perform a small aproximation for the decimal length:

256^10 = 256^2)^10
= 65535^10
= (65535^2)^5
= 4294836225^5
< 4300000000^5 = (43*10^8)^5
= 43^5*10^40
= 147.008.443*10^40
< 10^9*10^40 = 10^49

Some systems support such large decimal numbers. Other systems have a problem with this. Otherwise we need a working ordering at minimum for requests. This does not work if we use varchar.

The idea is a small hack. We use BIGINT for real integers and NUMERIC for virtual integers. This means that BIGINT must be mapped to an integer datatype while NUMERIC can be mapped to a character datatype too. If there is a field which is an integer but it must support large certificate serials then we use NUMERIC. Otherwise we use BIGINT.

Variables

The only global variable is COLUMN which includes a mapping from SQL columns to abstract types. The module replaces the abstract types by the real types of the driver during the execution of the constructor function new.

Functions

    new

The constructor expects at minimum three parameters - DBH with an instance of OpenXPKI::Server::DBI::DBH and DB_Type with the driver name. All other parameters are exclusively to initialize the driver instance. Please check the specification of the driver function get_dsn for the additionally supported parameters.

    column_is_numeric

returns true if a column is numeric

    column_is_string

returns true if a column is a string

    get_table_option

returns a string with options which can be attached to the SQL command which creates a table.

    get_column_type

returns the native SQL type of a specific database for the specified column.

    get_abstract_column_type

returns the original column type which is not database specific. This is useful if you want to detect how you have to handle a special column. Pleasde see the description of the driver requirements for more details about datatypes.

Driver Specification

    Variables

TYPE

This variable must be supported by the driver.

This is a hash which must include the real SQL types of the following abstract types:
o TIMESTAMP
o TEXT

A text data type that does not need to be indexed by the database. Cannot be ordered by.

o LONGTEXT A text data type that is capable of storing large amounts of text data and that does not need to be indexed by the database. Cannot be ordered by. May not be searchable via a where clause.
o TEXT_KEY
o BIGINT
o NUMERIC
o SERIAL

This must be a complete specification of an integer which increments itself - e.g. auto_increment or serial. Please see the other drivers for some examples. This is really critical for logging.

DBI_OPTION

This variable must be supported by the driver.

It contains the hash reference with the DBI options for the database connection.

LIMIT

This variable must be supported by the driver.

This variable contains a string with the substrings __QUERY__ and __MAXITEMS__. These substrings will be substituted by the corresponding values. After this the resulting query will be executed and should only return __MAXITEMS__ results of the original __QUERY__.

TABLE_OPTION

This variable can be supported by the driver.

This string will be attached to SQL code which creates a new table. It can be used for example to specify a storage type (e.g. MySQL: Type=InnoDB).

    Functions

All specified functions must be supported by each driver.

get_dsn

must return the DSN which can be used by DBI to connect to the database. The parameters which will be passed are the following:
o NAME
The drivers may use only a subset of the parameters.

get_new_serial

returns a new serial for the specified table. The table can be specified with the parameter TABLE.

sequence_exists

checks whether a sequence which is specified with NAME exists or not.

create_sequence

create a sequence which is specified with NAME. If the parameter MODE is set to dryrun then the function returns the executed SQL code and does not execute the code directly. This is used to allow users to execute such critical code by themselves.

See also

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


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

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