<pre>
<QtClientOutput sourceDir="src" subDir="wob" priInclude="wob.pri"/>
-<PHPServerOutput sourceDir="www" subDir="inc/wob" extension=".php" clean="yes"/>
+<PHPServerOutput sourceDir="www" subDir="inc/wob" extension=".php" clean="yes" transactionBase="WobTransaction"/>
<HtmlOutput sourceDir="doc" subDir="wob"/>
</pre>
The QtClientOutput tag tells woc to create a generator for a Qt based client - the priInclude attribute tells woc which name it should give to the QMake include for its generated output.<p>
-The PHPServerOutput tag tells woc to create a generator for a PHP based server. The "extension" attribute tells woc which file extension to use for the generated files (default is .php). Woc will automatically create a "autoload" (plus extension) file that should be included from the main body of the PHP project to load the automatically generated classes.<p>
+The PHPServerOutput tag tells woc to create a generator for a PHP based server. The "extension" attribute tells woc which file extension to use for the generated files (default is .php). Woc will automatically create a "autoload" (plus extension) file that should be included from the main body of the PHP project to load the automatically generated classes. The <tt>transactionBase</tt> attribute allows to chose an extended class as base class of generated transactions - it is recommended to overwrite some protected functions in order to be able to get more information inside transactions.<p>
The HtmlOutput tag tells woc where to generate API documentation.
{
header("X-WobResponse-Status: Error");
print("<WobResponse status=\"error\"><Error type=\"non-wob\">Request is not known, Aborting.</Error></WobResponse>\n");
+ $this->abortTransaction();
exit();
}
public function notAuthenticated(){
header("X-WobResponse-Status: Error");
print("<WobResponse status=\"error\"><Error type=\"auth\">User is not authenticated or does not have permission to execute this request, Aborting.</Error></WobResponse>\n");
+ $this->abortTransaction();
exit();
}
public function xmlParserError(){
header("X-WobResponse-Status: Error");
print("<WobResponse status=\"error\"><Error type=\"xml\">Error while parsing request XML, Aborting.</Error></WobResponse>\n");
+ $this->abortTransaction();
exit();
}
public function handleException($ex){
header("X-WobResponse-Status: Error");
print("<WobResponse status=\"error\"><Error type=\"exception\">".xq($ex->getMessage())."</Error></WobResponse>\n");
+ $this->abortTransaction();
exit();
}
public function abortWithError($text,$type="server"){
header("X-WobResponse-Status: Error");
print("<WobResponse status=\"error\"><Error type=\"".xq($type)."\">".xq($text)."</Error></WobResponse>\n");
+ $this->abortTransaction();
exit();
}
{
$this->abortWithError(tr("Transaction not implemented."));
}
+
+ /**stub: overwrite this to implement a real transaction start action (eg. sending the DB a "BEGIN TRANSACTION" statement)*/
+ protected function startTransaction(){}
+ /**stub: overwrite this to implement a real transaction commit action (eg. sending the DB a "COMMIT TRANSACTION" statement)*/
+ protected function commitTransaction(){}
+ /**stub: overwrite this to implement a real transaction abort action (eg. sending the DB a "ROLLBACK TRANSACTION" statement)*/
+ protected function abortTransaction(){}
+
+ /**stub: returns whether the user is authenticated, overwrite if you want to use authenticated or authorized transactions*/
+ protected function isAuthenticated(){return false;}
+ /**stub: returns whether the user is authorized to run a specific transaction, overwrite if you want to use authorized transactions*/
+ protected function isAuthorized($transactioName){return false;}
+ /**stub: returns the name of the user (default returns empty string)*/
+ protected function userName(){return "";}
};
?>
\ No newline at end of file
virtual void newTransaction(const WocTransaction&);
private:
QString m_basedir,m_subdir,m_fileext;
- //QString m_isauth,m_hasrole,m_username,m_authinit;
QString m_transbase;
QFile m_loader,m_schema,m_transact;