Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
OpenXPKI::Server::DBI:UservContributed Perl DoOpenXPKI::Server::DBI::Driver(3)

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

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  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.

       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.

       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.

       returns true if a column	is numeric

       returns true if a column	is a string

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

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

       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

       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


       This variable must be supported by the driver.

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


       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__.


       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:

       All specified functions must be supported by each driver.


       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.


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


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


       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

perl v5.24.1			  2017-07-03  OpenXPKI::Server::DBI::Driver(3)

Name | SQL assumptions | Variables | Functions | Driver Specification | See also

Want to link to this manual page? Use this URL:

home | help