We can use config.ini file containing the DB info. And use function Zend_Config_Ini() to get the file content.
config.ini file:
; Database Settings
db.adapter = PDO_MySQL ; A Zend_Db adapter name
db.dbname = zend_study
db.hostname = localhost
db.username = pma
db.password = 123456
usually we will use Initializer.php file to do all initialization work.
Here is two functions about configurate server info and intialize DB.
Using Profile:
--getTotalNumQueries() returns the total number of queries that have been profiled.
--getTotalElapsedSecs() returns the total number of seconds elapsed for all profiled queries.
--getQueryProfiles() returns an array of all query profiles.
--getLastQueryProfile() returns the last (most recent) query profile, regardless of whether or not the query has finished (if it hasn't, the end time will be null)
--clear() clears any past query profiles from the stack.
--getQuery() returns the SQL text of the query. The SQL text of a prepared statement with parameters is the text at the time the query was prepared, so it contains parameter placeholders, not the values used when the statement is executed.
--getQueryParams() returns an array of parameter values used when executing a prepared query. This includes both bound parameters and arguments to the statement's execute() method. The keys of the array are the positional (1-based) or named (string) parameter indices.
--getElapsedSecs() returns the number of seconds the query ran.
2. Zend_Db_Table
Here we have four DB tabls, they are associated, so when we create these table class, we must define their relationships
2.2 Fetching a Parent Row
2.3 Fetching a Rowset via a Many-to-many Relationship