summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
Diffstat (limited to 'framework')
-rw-r--r--framework/Data/TDbCommand.php20
-rw-r--r--framework/Exceptions/messages.txt6
-rw-r--r--framework/Web/Javascripts/js/compressed/ajax.js5
-rw-r--r--framework/Web/Javascripts/js/compressed/prado.js2
-rw-r--r--framework/Web/Javascripts/js/debug/ajax.js11
-rw-r--r--framework/Web/Javascripts/js/debug/prado.js4
-rw-r--r--framework/Web/Javascripts/prado/ajax3.js11
7 files changed, 43 insertions, 16 deletions
diff --git a/framework/Data/TDbCommand.php b/framework/Data/TDbCommand.php
index fc18a4bc..054aa653 100644
--- a/framework/Data/TDbCommand.php
+++ b/framework/Data/TDbCommand.php
@@ -115,7 +115,7 @@ class TDbCommand extends TComponent
}
catch(Exception $e)
{
- throw new TDbException('dbcommand_prepare_failed',$e->getMessage());
+ throw new TDbException('dbcommand_prepare_failed',$e->getMessage(),$this->getText());
}
}
}
@@ -190,11 +190,20 @@ class TDbCommand extends TComponent
}
catch(Exception $e)
{
- throw new TDbException('dbcommand_execute_failed',$e->getMessage());
+ throw new TDbException('dbcommand_execute_failed',$e->getMessage(),$this->getDebugStatementText());
}
}
/**
+ * @return String prepared SQL text for debugging purposes.
+ */
+ protected function getDebugStatementText()
+ {
+ if(Prado::getApplication()->getMode() === TApplicationMode::Debug)
+ return $this->_statement instanceof PDOStatement ? $this->getConnection()->getPdoInstance().$this->_statement->queryString : $this->getText();
+ }
+
+ /**
* Executes the SQL statement and returns query result.
* This method is for executing an SQL query that returns result set.
* @return TDbDataReader the reader object for fetching the query result
@@ -202,7 +211,6 @@ class TDbCommand extends TComponent
*/
public function query()
{
-// Prado::debug();
try
{
if($this->_statement instanceof PDOStatement)
@@ -213,7 +221,7 @@ class TDbCommand extends TComponent
}
catch(Exception $e)
{
- throw new TDbException('dbcommand_query_failed',$e->getMessage());
+ throw new TDbException('dbcommand_query_failed',$e->getMessage(),$this->getDebugStatementText());
}
}
@@ -239,7 +247,7 @@ class TDbCommand extends TComponent
}
catch(Exception $e)
{
- throw new TDbException('dbcommand_query_failed',$e->getMessage());
+ throw new TDbException('dbcommand_query_failed',$e->getMessage(),$this->getDebugStatementText());
}
}
@@ -267,7 +275,7 @@ class TDbCommand extends TComponent
}
catch(Exception $e)
{
- throw new TDbException('dbcommand_query_failed',$e->getMessage());
+ throw new TDbException('dbcommand_query_failed',$e->getMessage(),$this->getDebugStatementText());
}
}
}
diff --git a/framework/Exceptions/messages.txt b/framework/Exceptions/messages.txt
index 28b0b1e7..1df4349f 100644
--- a/framework/Exceptions/messages.txt
+++ b/framework/Exceptions/messages.txt
@@ -357,9 +357,9 @@ tactivecustomvalidator_clientfunction_unsupported = {0} does not support client
dbconnection_open_failed = TDbConnection failed to establish DB connection: {0}
dbconnection_connection_inactive = TDbConnection is inactive.
-dbcommand_prepare_failed = TDbCommand failed to prepare the SQL statement: {0}
-dbcommand_execute_failed = TDbCommand failed to execute the SQL statement: {0}
-dbcommand_query_failed = TDbCommand failed to execute the query SQL: {0}
+dbcommand_prepare_failed = TDbCommand failed to prepare the SQL statement "{1}": {0}
+dbcommand_execute_failed = TDbCommand failed to execute the SQL statement "{1}": {0}
+dbcommand_query_failed = TDbCommand failed to execute the query SQL "{1}": {0}
dbcommand_column_empty = TDbCommand returned an empty result and could not obtain the scalar.
dbdatareader_rewind_invalid = TDbDataReader is a forward-only stream. It can only be traversed once.
dbtransaction_transaction_inactive = TDbTransaction is inactive.
diff --git a/framework/Web/Javascripts/js/compressed/ajax.js b/framework/Web/Javascripts/js/compressed/ajax.js
index d1698aa5..ffc57483 100644
--- a/framework/Web/Javascripts/js/compressed/ajax.js
+++ b/framework/Web/Javascripts/js/compressed/ajax.js
@@ -99,8 +99,9 @@ Ajax.Responders.register({onComplete:function(request)
Prado.CallbackRequest.tryNextRequest();}});Event.OnLoad(function()
{if(typeof Logger!="undefined")
Ajax.Responders.register(Prado.CallbackRequest.Exception);});Prado.CallbackRequest.prototype={initialize:function(id,options)
-{this.url=window.location.href;this.request=null;this.Enabled=true;this.id=id;if(typeof(id)=="string")
-Prado.CallbackRequest.requests[id]=this;this.options=Object.extend({RequestTimeOut:30000,EnablePageStateUpdate:true,HasPriority:true,CausesValidation:true,ValidationGroup:null,PostInputs:true},options||{});},setCallbackParameter:function(value)
+{this.url=this.getCallbackUrl();this.request=null;this.Enabled=true;this.id=id;if(typeof(id)=="string")
+Prado.CallbackRequest.requests[id]=this;this.options=Object.extend({RequestTimeOut:30000,EnablePageStateUpdate:true,HasPriority:true,CausesValidation:true,ValidationGroup:null,PostInputs:true},options||{});},getCallbackUrl:function()
+{return $('PRADO_PAGESTATE').form.action;},setCallbackParameter:function(value)
{this.options['params']=value;},getCallbackParameter:function()
{return this.options['params'];},setRequestTimeOut:function(timeout)
{this.options['RequestTimeOut']=timeout;},getRequestTimeOut:function()
diff --git a/framework/Web/Javascripts/js/compressed/prado.js b/framework/Web/Javascripts/js/compressed/prado.js
index e2df8e08..a1da1efb 100644
--- a/framework/Web/Javascripts/js/compressed/prado.js
+++ b/framework/Web/Javascripts/js/compressed/prado.js
@@ -284,7 +284,7 @@ if(typeof(element)=="string")
method.toFunction().apply(this,[element,""+content]);}
else
{method.toFunction().apply(this,[""+content]);}},extractContent:function(text,boundary)
-{f=RegExp('(<!--'+boundary+'-->)([\\s\\S\\w\\W]*)(<!--//'+boundary+'-->)',"m");result=text.match(f);if(result&&result.length>=2)
+{var f=RegExp('(<!--'+boundary+'-->)([\\s\\S\\w\\W]*)(<!--//'+boundary+'-->)',"m");var result=text.match(f);if(result&&result.length>=2)
return result[2];else
return null;},evaluateScript:function(content)
{content.evalScripts();}}
diff --git a/framework/Web/Javascripts/js/debug/ajax.js b/framework/Web/Javascripts/js/debug/ajax.js
index c2822f10..9b1046ba 100644
--- a/framework/Web/Javascripts/js/debug/ajax.js
+++ b/framework/Web/Javascripts/js/debug/ajax.js
@@ -734,7 +734,7 @@ Prado.CallbackRequest.prototype =
/**
* Callback URL, same url as the current page.
*/
- this.url = window.location.href;
+ this.url = this.getCallbackUrl();
/**
* Current callback request.
@@ -759,6 +759,15 @@ Prado.CallbackRequest.prototype =
},
/**
+ * Gets the url from the forms that contains the PRADO_PAGESTATE
+ * @return {String} callback url.
+ */
+ getCallbackUrl : function()
+ {
+ return $('PRADO_PAGESTATE').form.action;
+ },
+
+ /**
* Sets the request parameter
* @param {Object} parameter value
*/
diff --git a/framework/Web/Javascripts/js/debug/prado.js b/framework/Web/Javascripts/js/debug/prado.js
index ca95bfbb..9a6cc823 100644
--- a/framework/Web/Javascripts/js/debug/prado.js
+++ b/framework/Web/Javascripts/js/debug/prado.js
@@ -3023,8 +3023,8 @@ Prado.Element =
extractContent : function(text, boundary)
{
- f = RegExp('(<!--'+boundary+'-->)([\\s\\S\\w\\W]*)(<!--//'+boundary+'-->)',"m");
- result = text.match(f);
+ var f = RegExp('(<!--'+boundary+'-->)([\\s\\S\\w\\W]*)(<!--//'+boundary+'-->)',"m");
+ var result = text.match(f);
if(result && result.length >= 2)
return result[2];
else
diff --git a/framework/Web/Javascripts/prado/ajax3.js b/framework/Web/Javascripts/prado/ajax3.js
index 4783800f..f6bb048f 100644
--- a/framework/Web/Javascripts/prado/ajax3.js
+++ b/framework/Web/Javascripts/prado/ajax3.js
@@ -446,7 +446,7 @@ Prado.CallbackRequest.prototype =
/**
* Callback URL, same url as the current page.
*/
- this.url = window.location.href;
+ this.url = this.getCallbackUrl();
/**
* Current callback request.
@@ -471,6 +471,15 @@ Prado.CallbackRequest.prototype =
},
/**
+ * Gets the url from the forms that contains the PRADO_PAGESTATE
+ * @return {String} callback url.
+ */
+ getCallbackUrl : function()
+ {
+ return $('PRADO_PAGESTATE').form.action;
+ },
+
+ /**
* Sets the request parameter
* @param {Object} parameter value
*/