* libraries/sqlvalidator.php3, libraries/sqlvalidator.class.php3:
- Function documentation and cleanup
This commit is contained in:
@@ -16,14 +16,17 @@
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @author Robin Johnson <robbat2@orbis-terrarum.net>
|
||||
* @version $Revision$
|
||||
* @author Robin Johnson <robbat2@users.sourceforge.net>
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
if (!defined('PMA_SQL_VALIDATOR_CLASS_INCLUDED')) {
|
||||
define('PMA_SQL_VALIDATOR_CLASS_INCLUDED', 1);
|
||||
|
||||
include("SOAP/Client.php");
|
||||
@include("SOAP/Client.php");
|
||||
if(!class_exists('SOAP_Client') {
|
||||
$GLOBALS['sqlvalidator_error'] = TRUE;
|
||||
} else {
|
||||
|
||||
// Ok, so we have SOAP Support, so let's use it!
|
||||
|
||||
@@ -52,6 +55,7 @@ if (!defined('PMA_SQL_VALIDATOR_CLASS_INCLUDED')) {
|
||||
$this->url = "http://sqlvalidator.mimer.com/v1/services";
|
||||
$this->serviceName = 'SQL99Validator';
|
||||
$this->wsdl = '?wsdl';
|
||||
|
||||
$this->outputType = 'html';
|
||||
|
||||
$this->username = 'anonymous';
|
||||
@@ -119,6 +123,11 @@ if (!defined('PMA_SQL_VALIDATOR_CLASS_INCLUDED')) {
|
||||
{
|
||||
$this->interactive = $interactive;
|
||||
}
|
||||
|
||||
function setOutputType($outputtype)
|
||||
{
|
||||
$this->OutputType = $outputtype;
|
||||
}
|
||||
|
||||
function start()
|
||||
{
|
||||
@@ -145,28 +154,69 @@ if (!defined('PMA_SQL_VALIDATOR_CLASS_INCLUDED')) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Call to determine just if a query is valid or not.
|
||||
*
|
||||
* @param string SQL statement to validate
|
||||
*
|
||||
* @return string Validator string from Mimer
|
||||
*
|
||||
* @see _validate
|
||||
*/
|
||||
function isValid($sql)
|
||||
{
|
||||
$res = $this->_validate($sql);
|
||||
return $res->standard;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Call for complete validator response
|
||||
*
|
||||
* @param string SQL statement to validate
|
||||
*
|
||||
* @return string Validator string from Mimer
|
||||
*
|
||||
* @see _validate
|
||||
*/
|
||||
function ValidationString($sql)
|
||||
{
|
||||
$res = $this->_validate($sql);
|
||||
return $res->data;
|
||||
}
|
||||
|
||||
/* Private functions beyond here
|
||||
*
|
||||
*/
|
||||
/** Private functions beyond here
|
||||
* You don't need to mess with these
|
||||
*/
|
||||
|
||||
/**
|
||||
* Service opening
|
||||
*
|
||||
* @param string URL of Mimer SQL Validator WSDL file
|
||||
*
|
||||
* @return object Object to use
|
||||
*/
|
||||
function _openService($url)
|
||||
{
|
||||
$obj = new SOAP_Client($url,TRUE);
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Service initializer to connect to server
|
||||
*
|
||||
* @param object Service object
|
||||
* @param string Username
|
||||
* @param string Password
|
||||
* @param string Name of calling program
|
||||
* @param string Version of calling program
|
||||
* @param string Target DBMS
|
||||
* @param string Version of target DBMS
|
||||
* @param string Connection Technology
|
||||
* @param string version of Connection Technology
|
||||
* @param number boolean of 1/0 to specify if we are an interactive system
|
||||
*
|
||||
* @return object stdClass return object with data
|
||||
*/
|
||||
function _openSession($obj, $username, $password, $callingProgram, $callingProgramVersion, $targetDbms, $targetDbmsVersion, $connectionTechnology, $connectionTechnologyVersion, $interactive)
|
||||
{
|
||||
|
||||
@@ -176,17 +226,28 @@ if (!defined('PMA_SQL_VALIDATOR_CLASS_INCLUDED')) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Standard calling method
|
||||
*
|
||||
* @param sql SQL statement to validate
|
||||
* @return Raw string from Mimer
|
||||
*/
|
||||
* Validator sytem call
|
||||
*
|
||||
* @param object Service object
|
||||
* @param object Session object
|
||||
* @param string SQL Query to validate
|
||||
* @param string Data return type
|
||||
*
|
||||
* @return object stClass return with data
|
||||
*/
|
||||
function _validateSQL($obj,$session,$sql,$method)
|
||||
{
|
||||
$res = $obj->validateSQL($session->sessionId, $session->sessionKey, $sql, $this->outputType);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validator sytem call
|
||||
*
|
||||
* @param string SQL Query to validate
|
||||
*
|
||||
* @return object stClass return with data
|
||||
*/
|
||||
function _validate($sql)
|
||||
{
|
||||
$ret = $this->_validateSQL($this->serviceLink, $this->sessionData, $sql, $this->outputType);
|
||||
|
Reference in New Issue
Block a user