DB_common::setOption() – Sets run-time configuration options for PEAR DB


integer setOption ( string $option , mixed $value )


Sets run-time configuration options for PEAR DB.


string $option

name of the option to set

mixed $value

value to set the option to

Option Data Type Default Value Description
autofree boolean FALSE should results be freed automatically when there are no more rows?
debug integer 0 debug level
persistent boolean FALSE should the connection be persistent?
portability integer DB_PORTABILITY_NONE portability mode constant. These constants are bitwised, so they can be combined using | and removed using ^. See the examples below and the "Intro - Portability" for more information.
seqname_format string %s_seq the sprintf() format string used on sequence names. This format is applied to sequence names passed to createSequence(), nextID() and dropSequence().
ssl boolean FALSE use ssl to connect?

Return value

integer - DB_OK on success or a DB_Error object on failure


Possible PEAR_Error values
Error code Error message Reason Solution
NULL unknown option The given option does not exist Check $option for typographical errors


This function can not be called statically.


Simple setOption() example

// Once you have a valid DB object named $db...

Portability for lowercasing and trimming

// Once you have a valid DB object named $db...

All portability options except trimming

// Once you have a valid DB object named $db...
Sets the default fetch mode (Previous) Gets info about columns in a table or a query result (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.