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

FreeBSD Manual Pages

  
 
  

home | help
OpenXPKI::Server::DataUser:ContributednPerl:Server::Database::QueryBuilder(3)

Name
       OpenXPKI::Server::Database::QueryBuilder	- Programmatic interface to
       SQL queries

Description
       This class provides methods to create DBMS specific SQL queries that
       can be executed later on.

       It delegates most of the	work to	SQL::Abstract::More but	offers a
       slightly	modified and stripped down interface (customized for
       OpenXPKI).

Attributes
   Constructor parameters
       o   sqlam - SQL query builder (an instance of SQL::Abstract::More)

       o   namespace - namespace (i.e. schema) to prepend to table names (Str,
	   optional)

Methods
   new
       Constructor.

       Named parameters: see attributes	section	above.

   select
       Builds a	SELECT query and returns a OpenXPKI::Server::Database::Query
       object which contains SQL string	and bind parameters.

       The method parameters are documented in "select"	in
       OpenXPKI::Server::Database.

   subselect
       Builds a	subselect to be	used within another query and returns a
       reference to an ArrayRef.

       This will take something	like this:

	   CTX('dbi')->subselect('IN' => {
	       from => 'nature',
	       columns => [ 'id', 'fruit' ],
	       where =>	{ type => 'forbidden' }
	   })

       and turn	it into:

	   \[ "IN ($query)" => @bind ]

       The method parameters are documented in "subselect" in
       OpenXPKI::Server::Database.

   insert
       Builds an INSERT	query and returns a OpenXPKI::Server::Database::Query
       object which contains SQL string	and bind parameters.

       Named parameters:

       o   into	- Table	name (Str, required)

       o   values - Hash with column name / value pairs. Please	note that
	   "undef" is interpreted as "NULL" (HashRef, required)

   update
       Builds an UPDATE	query and returns a OpenXPKI::Server::Database::Query
       object which contains SQL string	and bind parameters.

       A WHERE clause is required to prevent accidential updates of all	rows
       in a table.

       The method parameters are documented in "update"	in
       OpenXPKI::Server::Database.

   delete
       Builds a	DELETE query and returns an OpenXPKI::Server::Database::Query
       object which contains SQL string	and bind parameters.

       To prevent accidential deletion of all rows of a	table you must specify
       parameter "all" if you want to do that:

	   $dbi->delete(
	       from => "mytab",
	       all => 1,
	   );

       The method parameters are documented in "delete"	in
       OpenXPKI::Server::Database.

perl v5.32.0			  2OpenXPKI::Server::Database::QueryBuilder(3)

Name | Description | Attributes | Methods

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=OpenXPKI::Server::Database::QueryBuilder&sektion=3&manpath=FreeBSD+12.2-RELEASE+and+Ports>

home | help