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
Connector::Proxy::DBI(3) User Contributed Perl Documentation Connector::Proxy::DBI(3)

Connector::Proxy::DBI

Use DBI to make a query to a database.

    my $con = Connector::Proxy::DBI->new({
        LOCATION => 'DBI:mysql:database=openxpki;host=localhost',
        dbuser => 'queryuser',
        password => 'verysecret',
        table => 'mytable',
        column => 1,
        condition => 'id = ?',
        ambiguous => 'die',
    });

The name of the table, can also be a JOIN clause (if supported by the driver).
For get/get_list the name of a single column to be returned.

For get_hash a hash where the keys are the target keys of the resulting hash and the values are the column names.

The condition using a question mark as placeholder. The placeholder(s) are fed from the path components.
Controls the behaviour of the connector if more than one result is found when a single one is expected (get/get_hash).
Return an empty result, will also die if die_on_undef is set.
The potential ambiguity is ignored and the first row fetched is returned. Note that depending on the database backend the actual result returned from the is very likely undetermined.
Die with an error message.

Will return the value of the requested column of the matching row. If no row is found, undef is returned (dies if die_on_undef is set). Note: You will also get undef if the row exists but the requested column has a NULL value.

If multiple rows are found, behaviour depends on the value of ambiguous.

Will return the selected column of all matching lines as a list. If no match is found undef is returned (dies if die_on_undef is set).

Will return scalar if the query has one result or list if the query has multiple rows. Returns undef if no rows are found.

Return a single row as hashref, by default all columns are returned as retrieved from the database. Pass a hashref to column, where the key is the target key and the value is the name of the column you need.

E.g. when your table has the columns id and name but you need the keys index and title in your result.

    $con->column({ 'id' => 'id', '`index`' => 'id', 'title' => 'name' });

Note: The mapping is set directly on the sql layer and as escaping reserved words is not standardized, we dont do it. You can add escape characters yourself to the column map where required, as shown for the word "index" in the given example.

not supported

2025-05-08 perl v5.40.2

Search for    or go to Top of page |  Section 3 |  Main Index

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