Database Handling Failed Scenario - Joomla! Forum - community, help and support
hi everyone, new joomla , ask following question.
1. connection , disconnection
i use following execute query database:
from understanding database object created , connection establised, happen after finish executing loadresult.
q1: connection database automatically terminate after loadresult() finish executing or have make function terminate it?
q2: $db object destroy @ point?
2. failed scenario
i using innodb engine. friend recommended using try/catch/finally. including code structure below:
q3. has implement scenario in joomla , correct approach?
q4. joomla have similar handle situation failed transaction?
i appreciate advice can give. website building, expecting high traffic 5000-10000 users. definite proper db management prioritize achieve. have checked documentation jdatabase::committrans() , there nothing implement function.
thank everyone.
1. connection , disconnection
i use following execute query database:
code: select all
$db =& jfactory::getdbo();
$db->setquery( $queryvar );
$result = $db->loadresult();from understanding database object created , connection establised, happen after finish executing loadresult.
q1: connection database automatically terminate after loadresult() finish executing or have make function terminate it?
q2: $db object destroy @ point?
2. failed scenario
i using innodb engine. friend recommended using try/catch/finally. including code structure below:
code: select all
try
{
begintransaction()
//database action here
commit()
}
catch error
{
rollback() //cancel saving database, , rollback changes
}
finally
{
closeconnection()
//set database handle null close connection
}q3. has implement scenario in joomla , correct approach?
q4. joomla have similar handle situation failed transaction?
i appreciate advice can give. website building, expecting high traffic 5000-10000 users. definite proper db management prioritize achieve. have checked documentation jdatabase::committrans() , there nothing implement function.
thank everyone.
Comments
Post a Comment