|
NameConnector::Proxy::DBIDescriptionUse DBI to make a query to a database.UsageConfigurationmy $con = Connector::Proxy::DBI->new({ LOCATION => 'DBI:mysql:database=openxpki;host=localhost', dbuser => 'queryuser', password => 'verysecret', table => 'mytable', column => 1, condition => 'id = ?', ambiguous => 'die', }); Parameters
MethodsgetWill 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).If multiple rows are found, behaviour depends on the value of ambiguous. get_listWill 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).get_metaWill return scalar if the query has one result or list if the query has multiple rows. Returns undef if no rows are found.get_hashReturn 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. get_keysnot supported
Visit the GSP FreeBSD Man Page Interface. |