Following is the code in my AM implementation
public void edit(){`testVO().setWhereClause(null);
testVO().setWhereClauseParams(null);
testVO().applyViewCriteria(testVO().getViewCriteria("SearchCriteria"));
testVO().setNamedWhereClauseParam("a",method.getContentOwnerId());
testVO().setNamedWhereClauseParam("b",method.getTaxSrch());
testVO().setNamedWhereClauseParam("c",method.getTaxRgmCodeSrch());
testVO().setNamedWhereClauseParam("d",method.getTaxStatCodeSrch());
testVO().setNamedWhereClauseParam("e",method.getTaxRateCodeSrch());
testVO().setNamedWhereClauseParam("f",method.getRateTypeCode());
testVO().setNamedWhereClauseParam("g",method.getTaxJurisCodeSrch());
testVO().executeQuery();}`
testVO() method returns the TestVO. Bind variables are being picked up (can tell from the log) but when the line
testVO().executeQuery()
is encountered, the query is not getting executed.
Any ideas why this might happen or how to debug this.
Thanks.
Can you see your VO executing when you open it from BC Tester?
Related
I am trying to execute a UDF which uses a CLR assembly. Each time I try to run it I get the below error:
Msg 6522, Level 16, State 1, Line 45
A .NET Framework error occurred during execution of user-defined routine or aggregate "Geocode":
System.NullReferenceException: Object reference not set to an instance of an object.
at ProSpatial.UserDefinedFunctions.GeocodeUDF(SqlString countryRegion, SqlString adminDistrict, SqlString locality, SqlString postalCode, SqlString addressLine)
It is a geocoding assembly, which is based on the below blog:
https://alastaira.wordpress.com/2012/05/04/geocoding-in-sql-server-with-the-bing-maps-locations-api/
Is there anything I can do to fix it? It was working fine, but just stopped working recently. I changed the Bing Maps key to a new one, but that hasn't resolved the issue. Anyone have any ideas?
Cheers
Edit: I entered a formatted URL into Chrome, to see if I can get the error. I entered the below URL format:
http://dev.virtualearth.net/REST/v1/Locations?countryRegion={0}&adminDistrict={1}&locality={2}&postalCode={3}&addressLine={4}&key={5}&output=xml
All I did was to replace items 0 to 5 with their respective entries. I left the curly brackets in there, and then also tried it without the curly brackets. Without the curly brackets, the URL returned a result with no issues.
In the browser, I am getting geocoded results, but not in SQL any more
Just worked it out. One of the address fields that was being geocoded was null in the database, and the API did not like that. So I removed that from the geocoding list
Looking at the code in that blog, if you are passing in a NULL, then it's not the API that's throwing the error. The error is happening because NULL values are not being handled when the method is first called. The code just casts the SqlString input parameters to string without first checking to see if there is a value in the SqlString variable. SqlString is very similar to a nullable string.
Fortunately, it is rather easy to adjust the code to properly handle NULL values in the input parameters. Starting with a redacted snippet of the original code below, I will show how to do this for one parameter and you can repeat that modification for the others (well, the ones that might actually be NULL in the DB; no need to do this for parameters that are guaranteed to be there due to being in a NOT NULL column).
public static SqlGeography GeocodeUDF(
SqlString countryRegion,
SqlString adminDistrict,
SqlString locality,
SqlString postalCode,
SqlString addressLine
)
{
...
string localAdminDistrict = string.Empty;
if (!adminDistrict.IsNull)
{
localAdminDistrict = adminDistrict.Value;
}
// Attempt to geocode the requested address
try
{
geocodeResponse = Geocode(
(string)countryRegion,
localAdminDistrict,
(string)locality,
(string)postalCode,
(string)addressLine
);
}
All I did was:
Added a local variable for localAdminDistrict, defaulted to an empty string.
Added an if block to set localAdminDistrict if adminDistrict is not null.
Updated the call to Geocode() to use localAdminDistrict instead of (string)adminDistrict.
This should work as long as the Bing Maps API is ok with an empty value for adminDistrict (i.e. ...&adminDistrict=&locality=... ), as opposed to adminDistrict not being present in the GET request (which is easy enough, it just requires an additional modification).
ALSO: As long as you are going to be in there updating the code, you really should move the calls to the Close() and Dispose() methods into a finally block for that try / catch.
For more info on working with SQLCLR in general, please visit: SQLCLR Info
What I'm trying to is to double click on a row in a WPF datagrid. To achieve this I'm using the following code:
WpfTable invoiceList = new WpfTable(base.MainWindow);
invoiceList.SearchProperties.Add(WpfTable.PropertyNames.AutomationId, "datagridID");
invoiceList.WaitForControlReady(15000);
Mouse.DoubleClick(invoiceList.GetRow(0));
When I run this on my machine the test passes but when I run the same test via MTM I get the following error:
Test method
org.Application.Automation.TestCases.CommentsTests.VerifyExistingCommentsTest
threw exception:
Microsoft.VisualStudio.TestTools.UITest.Extension.PlaybackFailureException:
Cannot perform 'DoubleClick' on the control. Additional Details:
TechnologyName: 'UIA' ControlType: 'Row' FrameworkId: 'WPF' --->
System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has
been returned from a call to a COM component.
Could someone point in the right direction as to how I could fix this?
In case anyone else is facing this issue, I changed my code to the following to get it to work.
WpfControl row = invoiceList.GetRow(0);
row.WaitForControlReady();
Mouse.DoubleClick(new System.Drawing.Point(row.BoundingRectangle.X + row.BoundingRectangle.Width, row.BoundingRectangle.Y + row.BoundingRectangle.Height/2));
So instead of double clicking on the WpfRow object, I used the Mouse.DoubleClick(new System.Drawing.Point()) option and passed center point (i.e System.Drawing.Point) as the parameter. As to why the previous approach didn't work, I'm afraid I cannot explain.
So, here's my controller code:
public function admin_index(){
$clients = $this->paginate();
$this->set(compact('clients'));
}
And here's the relevant query from my SQL dump for this page:
SELECT `Client`.`id`, `Client`.`user_id`, `Client`.`first_name`, `Client`.`last_name`, `Client`.`company`, `Client`.`phone`, `Client`.`created`, `Client`.`modified`, (IF(LENGTH(company) > 0,company,CONCAT(first_name," ",last_name))) AS `Client__name` FROM `clients` AS `Client` WHERE 1 = 1 LIMIT 20
This query returns 1 row (under Num rows, 1 is displayed, just to be clear :).
In the view (or the controller), var_dump($clients) gives NULL
I can't understand why that is happening!
In the controller change:
$this->set(compact('clients'));
for
$this->set('clients', compact('clients'));
Because if not the variable in the view has no name, so you can't access it.
Well, I feel like a bit of a chump...
The offending code was actually in the model file, client.php.
public function afterFind(){
//todo
}
I was planning on writing some code here, but neglected to. afterFind needs to return an array of results. I wasn't doing so, hence all calls to Client::find (ie via ClientsController::paginate) were returning NULL, not even an empty array.
HI..
I have a database created and having a table inside it..
now when i am inserting a value in my table it doesnot work...
And please tell me how to see the error if occurs in the eclipse plug in . I am very new to blackberry.
now the snippet code for inserting the value is
Database d;
URI myUri = URI.create("file:///SDCard/Databases/SQLite_Guide/", "Mynewdatabase1.db");
d= DatabaseFactory.create(myUri);
d.close;
Statement s1=d.createStatement("INSERT INTO People(Name,Age)VALUES ('uttam',23)");
s1.prepare();
s1.execute();
s1.close();
d.close();
You're closing the data base before calling createStatement? That isn't going to work. Is this the actual code, because the first you're missing the parens on the first call: d.close;
I am attempting to retrieve an entry from my datastore with this:
query = UserData.gql("WHERE mDeviceId = :1", id)
Utils.log("my Object:" + str(query))
entry = query.get()
It just so happens that the variable 'id' doesn't even exist (typo), so I know how to fix this, but I don't understand why the result I get won't let me call get() on it. When I do, I get the error:
Exception: Unsupported type for property : <type 'builtin_function_or_method'>
Normally I just check if entry == None to see if I get no results. Does anyone know why this occurs and if I should be doing my checks for None differently, in case I have such typos in the future?
A variable named id is not defined in your code, so it passes the builtin function id, and QL complains that it's getting a function when it expected a value (integer?).
Check to make sure you're assigning id a value before you use it.
Even better, don't shadow builtins with your own variables-- it'll cause confusing errors like this. :-)