BUG 7140 DBArray SQl parser notices removed

Only if each SQl part exist then try to execute
This commit is contained in:
Hugo Loza
2011-07-03 11:24:18 -04:00
parent c865a4fa8e
commit 5201e3e7f3
2 changed files with 51 additions and 18 deletions

View File

@@ -51,13 +51,24 @@ class soapNtlm {
* @return unknown * @return unknown
*/ */
public function stream_open($path, $mode, $options, $opened_path) { public function stream_open($path, $mode, $options, $opened_path) {
//echo "[NTLMStream::stream_open] $path , mode=$mode \n"; echo "[NTLMStream::stream_open] $path , mode=$mode \n";
$authPath=explode("|", urldecode($path));
G::pr($authPath);
$path=$authPath[0];
G::pr($path);
$authO=explode(":",$authPath[1]);
G::pr($authO);
$this->path = $path; $this->path = $path;
$this->user=$authO[0];
$this->password=$authO[1];
$this->mode = $mode; $this->mode = $mode;
$this->options = $options; $this->options = $options;
$this->opened_path = $opened_path; $this->opened_path = $opened_path;
$this->createBuffer($path); $this->createBuffer($this->path);
return true; return true;
} }
@@ -67,7 +78,7 @@ class soapNtlm {
* *
*/ */
public function stream_close() { public function stream_close() {
//echo "[NTLMStream::stream_close] \n"; echo "[NTLMStream::stream_close] \n";
curl_close($this->ch); curl_close($this->ch);
} }
@@ -78,7 +89,7 @@ class soapNtlm {
* @return content from pos to count * @return content from pos to count
*/ */
public function stream_read($count) { public function stream_read($count) {
//echo "[NTLMStream::stream_read] $count \n"; echo "[NTLMStream::stream_read] $count \n";
if (strlen($this->buffer) == 0) { if (strlen($this->buffer) == 0) {
return false; return false;
} }
@@ -97,7 +108,7 @@ class soapNtlm {
* @return content from pos to count * @return content from pos to count
*/ */
public function stream_write($data) { public function stream_write($data) {
//echo "[NTLMStream::stream_write] \n"; echo "[NTLMStream::stream_write] \n";
if (strlen($this->buffer) == 0) { if (strlen($this->buffer) == 0) {
return false; return false;
} }
@@ -109,7 +120,7 @@ class soapNtlm {
* @return true if eof else false * @return true if eof else false
*/ */
public function stream_eof() { public function stream_eof() {
//echo "[NTLMStream::stream_eof] "; echo "[NTLMStream::stream_eof] ";
if ($this->pos > strlen($this->buffer)) { if ($this->pos > strlen($this->buffer)) {
echo "true \n"; echo "true \n";
return true; return true;
@@ -131,7 +142,7 @@ class soapNtlm {
* Flush stream data * Flush stream data
*/ */
public function stream_flush() { public function stream_flush() {
//echo "[NTLMStream::stream_flush] \n"; echo "[NTLMStream::stream_flush] \n";
$this->buffer = null; $this->buffer = null;
$this->pos = null; $this->pos = null;
} }
@@ -142,7 +153,7 @@ class soapNtlm {
* @return array stat information * @return array stat information
*/ */
public function stream_stat() { public function stream_stat() {
//echo "[NTLMStream::stream_stat] \n"; echo "[NTLMStream::stream_stat] \n";
$this->createBuffer($this->path); $this->createBuffer($this->path);
$stat = array( $stat = array(
@@ -158,8 +169,16 @@ class soapNtlm {
* @return array stat information * @return array stat information
*/ */
public function url_stat($path, $flags) { public function url_stat($path, $flags) {
//echo "[NTLMStream::url_stat] \n"; echo "[NTLMStream::url_stat] -> $path \n";
$this->createBuffer($path); $authPath=explode("|", urldecode($path));
G::pr($authPath);
$path=$authPath[0];
G::pr($path);
$authO=explode(":",$authPath[1]);
G::pr($authO);
$this->user=$authO[0];
$this->password=$authO[1];
$this->createBuffer($this->path);
$stat = array( $stat = array(
'size' => strlen($this->buffer), 'size' => strlen($this->buffer),
); );
@@ -177,15 +196,16 @@ class soapNtlm {
return; return;
} }
//echo "[NTLMStream::createBuffer] create buffer from : $path\n"; echo "[NTLMStream::createBuffer] create buffer from : $path \n";
$this->ch = curl_init($path); $this->ch = curl_init($this->path);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($this->ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); curl_setopt($this->ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($this->ch, CURLOPT_HTTPAUTH, CURLAUTH_NTLM); curl_setopt($this->ch, CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
curl_setopt($this->ch, CURLOPT_USERPWD, $this->user . ':' . $this->password); curl_setopt($this->ch, CURLOPT_USERPWD, $this->user . ':' . $this->password);
G::pr($this->ch);
echo $this->buffer = curl_exec($this->ch); echo $this->buffer = curl_exec($this->ch);
//echo "[NTLMStream::createBuffer] buffer size : " . strlen($this->buffer) . "bytes\n"; echo "[NTLMStream::createBuffer] buffer size : " . strlen($this->buffer) . "bytes\n";
$this->pos = 0; $this->pos = 0;
} }
@@ -230,6 +250,12 @@ class PMServiceNTLMSoapClient extends NTLMSoapClient {
protected $user; protected $user;
protected $password; protected $password;
function setAuth($auth){
$authInfo=explode(":",$auth);
$this->user=$authInfo[0];
$this->password=$authInfo[1];
}
} }
class PMServiceProviderNTLMStream extends soapNtlm { class PMServiceProviderNTLMStream extends soapNtlm {

View File

@@ -244,9 +244,16 @@ class DBArrayConnection implements Connection {
$sql = array(); $sql = array();
$sql['selectClause'][0] = isset($matches[1]) ? $matches[1] : '';//Include selectClause. By JHL $sql['selectClause'][0] = isset($matches[1]) ? $matches[1] : '';//Include selectClause. By JHL
$sql['fromClause'][0] = isset($matches[2]) ? $matches[2] : ''; $sql['fromClause'][0] = isset($matches[2]) ? $matches[2] : '';
$sql['whereClause'][0] = isset($matches[3]) ? $matches[3] : ''; //$sql['whereClause'][0] = isset($matches[3]) ? $matches[3] : '';
$sql['groupByClause'][0] = isset($matches[4]) ? $matches[4] : ''; if(isset($matches[3])){
$sql['orderByClause'][0] = isset($matches[5]) ? $matches[5] : ''; $sql['whereClause'][0] = $matches[3];
}
if(isset($matches[4])){
$sql['groupByClause'][0] = $matches[4];
}
if(isset($matches[5])){
$sql['orderByClause'][0] = $matches[5];
}
$sql['limit'] = 0; $sql['limit'] = 0;
@@ -326,8 +333,8 @@ class DBArrayConnection implements Connection {
return $resultSet; return $resultSet;
} }
//else
if (is_array($this->dataSql['orderByClause']) && count($this->dataSql['orderByClause']) > 0) { if (isset($this->dataSql['orderByClause'])&&is_array($this->dataSql['orderByClause']) && count($this->dataSql['orderByClause']) > 0) {
foreach ($resultRow as $key => $row) { foreach ($resultRow as $key => $row) {
foreach ($this->dataSql['orderByClause'] as $keyOrder => $valOrder) { foreach ($this->dataSql['orderByClause'] as $keyOrder => $valOrder) {
if (isset($row[$valOrder['columnName']])) { if (isset($row[$valOrder['columnName']])) {