ah great thank you.
yes that worked - so what that implies is that:
1. don't use the PreparedQuery
2. use the select -> chained build query and insert the "parameters" into
the chain.
is that a work around ?
Doesn't feel quite "right" if the PreparedQuery has a bug ?
thank you.
On Friday, September 9, 2016 at 2:42:27 PM UTC+1, Oleksandr Gubchenko wrote:
>
> Can you try with this code snippet? I've tested it, and it works without
> exceptions.
>
> var selectedValue = database
> .Select()
> .From("Person")
> .Where("lastName")
> .Equals("Murphy")
> .ToList();
>
> Hope it helps.
>
> Il giorno venerdì 9 settembre 2016 15:18:04 UTC+2, Ticket Voodoo ha
> scritto:
>>
>> running the query
>> SELECT FROM Person WHERE lastName = 'Murphy'
>> in Studio brings back results so I know that the query works as well
>> against the VehicleHistoryGraph example db.
>>
>> On Friday, September 9, 2016 at 2:13:20 PM UTC+1, Ticket Voodoo wrote:
>>>
>>> line 106 is the .Query
>>>
>>> thanks :-)
>>> screen shot below
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Friday, September 9, 2016 at 2:08:54 PM UTC+1, Oleksandr Gubchenko
>>> wrote:
>>>>
>>>> You have an ArrayIndexOutOfBoundsException, can you post the line
>>>> numbers of your code?
>>>>
>>>> Il giorno venerdì 9 settembre 2016 12:53:50 UTC+2, Ticket Voodoo ha
>>>> scritto:
>>>>>
>>>>> I have the following 2 tests (see code below)
>>>>> The first test works fine CanQUeryDBNoParams,
>>>>> However, the second test CanQueryDBWithParams
>>>>> fails with the following error which I have unsuccessfuly tried to
>>>>> google for help with to no avail, so any help with this would be greatly
>>>>> appreciated.
>>>>>
>>>>> I am using the latest .net from nuget against the lastest OrientDB
>>>>> running on windows 10, as the first test works I know the code and
>>>>> database
>>>>> works.
>>>>>
>>>>> error:
>>>>> Test Name: CanQueryDBWithParams
>>>>> Test FullName:
>>>>> UnitTestTVGraphDB.UnitTestTVGraphDB.CanQueryDBWithParams
>>>>> Test Source:
>>>>> E:\TVMercurialSCM\johnc\Source\TicketVoodooGraphDB\UnitTestTVGraphDB\UnitTestTVGraphDB.cs
>>>>>
>>>>> : line 91
>>>>> Test Outcome: Failed
>>>>> Test Duration: 0:00:00.0297952
>>>>>
>>>>> Result StackTrace:
>>>>> at Orient.Client.Protocol.Response.Receive()
>>>>> at
>>>>> Orient.Client.Protocol.Connection.ExecuteOperationInternal(IOperation
>>>>> operation)
>>>>> at Orient.Client.Protocol.Connection.ExecuteOperation(IOperation
>>>>> operation)
>>>>> at Orient.Client.API.Query.PreparedQuery.RunInternal()
>>>>> at Orient.Client.API.Query.PreparedQuery.Run(String[] properties)
>>>>> at UnitTestTVGraphDB.UnitTestTVGraphDB.CanQueryDBWithParams() in
>>>>> E:\TVMercurialSCM\johnc\Source\TicketVoodooGraphDB\UnitTestTVGraphDB\UnitTestTVGraphDB.cs:line
>>>>>
>>>>> 106
>>>>> Result Message:
>>>>> Test method UnitTestTVGraphDB.UnitTestTVGraphDB.CanQueryDBWithParams
>>>>> threw exception:
>>>>> Orient.Client.OException:
>>>>> com.orientechnologies.orient.core.exception.OSerializationException:
>>>>> Error
>>>>> on unmarshalling content. Class: q
>>>>> DB name="VehicleHistoryGraph"
>>>>> java.lang.ArrayIndexOutOfBoundsException:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> [TestMethod]
>>>>> public void CanQueryDBNoParams()
>>>>> {
>>>>>
>>>>> using (GraphDbContext dbContext = new GraphDbContext())
>>>>> {
>>>>>
>>>>> using (ODatabase database = new
>>>>> ODatabase(GraphDbConnection.DatabaseAlias))
>>>>> {
>>>>> List<ODocument> result = database
>>>>> .Select("firstName").As("firstName")
>>>>>
>>>>> .Also("lastName").As("lastName")
>>>>> .Also("fullName").As("fullName")
>>>>> .Also("gender").As("gender")
>>>>> .Also("birthday").As("birthday")
>>>>> .From<Person>()
>>>>> .OrderBy("lastName").Descending()
>>>>> .ToList();
>>>>> Assert.IsNotNull(result);
>>>>> Assert.IsTrue(result.Count > 0);
>>>>> Console.WriteLine(String.Format("result count:{0}",
>>>>> result.Count));
>>>>>
>>>>> foreach (var doc in result)
>>>>> {
>>>>> Console.WriteLine(String.Format("CanQueryDBNoParams
>>>>> doc.OClassName:{0}", doc.OClassName ));
>>>>> }
>>>>> }
>>>>> }
>>>>> }
>>>>>
>>>>> [TestMethod]
>>>>> public void CanQueryDBWithParams()
>>>>> {
>>>>>
>>>>> using (GraphDbContext dbContext = new GraphDbContext())
>>>>> {
>>>>>
>>>>> using (ODatabase database = new
>>>>> ODatabase(GraphDbConnection.DatabaseAlias))
>>>>> {
>>>>>
>>>>> var query = new PreparedQuery(" SELECT FROM Person WHERE
>>>>> lastName = ? ", "*:0");
>>>>>
>>>>> var selectedValue = database
>>>>> .Query(query)
>>>>> .Run("Murphy")
>>>>> .ToList();
>>>>>
>>>>> Assert.IsTrue(selectedValue.Count > 0);
>>>>>
>>>>> }
>>>>> }
>>>>> }
>>>>>
>>>>>
>>>>>
--
---
You received this message because you are subscribed to the Google Groups
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.