DB-Object

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

It returns the database handler.

## use\_cache

Provided with a boolean value and this sets or get the _use\_cache_ parameter.

## use\_bind

Provided with a boolean value and this sets or get the _use\_cache_ parameter.

## variables

Query the SQL variable $type

It returns a blank string if nothing was found, or the value found.

## version

This is a method that must be implemented by the driver package.

## where

See ["where" in DB::Object::Tables](https://metacpan.org/pod/DB%3A%3AObject%3A%3ATables#where)

## \_cache\_this

Provided with a query, this will cache it for future re-use.

It does some check and maintenance job to ensure the cache does not get too big whenever it exceed the value of $CACHE\_SIZE set in the main config file.

It returns the cached statement as an [DB::Object::Statement](https://metacpan.org/pod/DB%3A%3AObject%3A%3AStatement) object.

## \_check\_connect\_param

Provided with an hash reference of connection parameters, this will get the valid parameters by calling ["\_connection\_parameters"](#_connection_parameters) and the connection default options by calling ["\_connection\_options"](#_connection_options...

It returns the connection parameters hash reference.

## \_check\_default\_option

Provided with an hash reference of options, and it actually returns it, so this does not do much, because this method is supposed to be supereded by the driver package.

## \_connection\_options

Provided with an hash reference of connection parameters and this will returns an hash reference of options whose keys match the regular expression `/^[A-Z][a-zA-Z]+/`

So this does not do much, because this method is supposed to be superseded by the driver package.

## \_connection\_parameters

Returns an array reference containing the following keys: db login passwd host port driver database server opt uri debug

## \_connection\_params2hash

Provided with an hash reference of connection parameters and this will check if the following environment variables exists and if so use them: `DB_NAME`, `DB_LOGIN`, `DB_PASSWD`, `DB_HOST`, `DB_PORT`, `DB_DRIVER`, `DB_SCHEMA`

If the parameter property _uri_ was provided of if the environment variable `DB_CON_URI` is set, it will use this connection uri to get the necessary connection parameters values.

An [URI](https://metacpan.org/pod/URI) could be `http://localhost:5432?database=somedb` or `file:/foo/bar?opt={"RaiseError":true}`

Alternatively, if the connection parameter _conf\_file_ is provided then its json content will be read and decoded into an hash reference.

The following keys can be used in the json data in the _conf\_file_: `database`, `login`, `passwd`, `host`, `port`, `driver`, `schema`, `opt`

The port can be specified in the _host_ parameter by separating it with a semicolon such as `localhost:5432`

The _opt_ parameter can Alternatively be provided through the environment variable `DB_OPT`

It returns the hash reference of connection parameters.

## \_clean\_statement

Given a query string or a reference to it, it cleans the statement by removing leading and trailing space before and after line breaks.

It returns the cleaned up query as a string if the original query was provided as a scalar reference.

## \_convert\_datetime2object

Provided with an hash or hash reference of options and this will simply return the _data_ property.

This does not do anything meaningful, because it is supposed to be superseded by the diver package.

## \_convert\_json2hash

Provided with an hash or hash reference of options and this will simply return the _data_ property.

This does not do anything meaningful, because it is supposed to be superseded by the diver package.

## \_dbi\_connect

This will call ["\_dsn"](#_dsn) which must exist in the driver package, and based on the `dsn` received, this will initiate a ["connect\_cache" in DBI](https://metacpan.org/pod/DBI#connect_cache) if the object property ["cache\_connections"](#cache_c...

It returns the database handler.

## \_decode\_json

Provided with some json data and this will decode it using [JSON](https://metacpan.org/pod/JSON) and return the associated hash reference or ["undef" in perlfunc](https://metacpan.org/pod/perlfunc#undef) if an error occurred.

## \_dsn

This will die complaining the driver has not implemented this method, unless the driver did implement it.

## \_encode\_json

Provided with an hash reference and this will encode it into a json string and return it.

## \_make\_sth

Given a package name and a hash reference, this builds a statement object with all the necessary parameters.

It also sets the query time to the current time with the parameter _query\_time_

It returns an object of the given $package.

## \_param2hash

Provided with some hash reference parameters and this will simply return it, so it does not do anything meaningful.

This is supposed to be superseded by the driver package.

## \_process\_limit



( run in 0.753 second using v1.01-cache-2.11-cpan-13bb782fe5a )