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.

       Named parameters:

       o   columns - List of column names (ArrayRef[Str], required)

       o   from	- Table	name (or list of) (Str | ArrayRef[Str],	required)

       o   from_join - A string	to describe table relations for	FROM ..	JOIN
	   following the spec in "join"	in SQL::Abstract::More (Str)

	       from_join => "certificate  req_key=req_key  csr"

	   Please note that you	cannot specify "from" and "from_join" at the
	   same	time.

       o   where - WHERE clause	following the spec in "WHERE-CLAUSES" in
	   SQL::Abstract (Str |	ArrayRef | HashRef)

       o   group_by - GROUP BY column (or list of) (Str	| ArrayRef)

       o   having - HAVING clause following the	spec in	"WHERE-CLAUSES"	in
	   SQL::Abstract (Str |	ArrayRef | HashRef)

       o   order_by - Plain ORDER BY string or list of columns.	Each column
	   name	can be preceded	by a "-" for descending	sort (Str | ArrayRef)

       o   limit - (Int)

       o   offset - (Int)

   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.

       Named parameters:

       o   table - Table name (Str, required)

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

       o   where - WHERE clause	following the spec in "WHERE-CLAUSES" in
	   SQL::Abstract (Str |	ArrayRef | HashRef)

   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,
	   );

       Named parameters:

       o   from	- Table	name (Str, required)

       o   where - WHERE clause	following the spec in "WHERE-CLAUSES" in
	   SQL::Abstract (Str |	ArrayRef | HashRef)

       o   all - Set this to 1 instead of specifying "where" to	delete all
	   rows	(Bool)

perl v5.24.1			  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.0-RELEASE+and+Ports>

home | help