Sorry, you are right.  I just wrote a simple test and it doesn't look like 
variable substitution works for "create".

None of the following work:

create edge from :rid1 to :rid2
create edge from ? to ?
create edge from ( select from :rid1 ) to ( select from :rid2 )
create edge from ( select from ? ) to ( select from ? )

The wiki does not talk about this and should be updated (or maybe it's just 
a bug?):
https://github.com/orientechnologies/orientdb/wiki/Document-Database


On Monday, March 31, 2014 5:11:48 PM UTC-4, alexander anguiano wrote:
>
> the ? work in other queries that i've used.  I tried using the names and 
> that doesn't work either.
>
> ORecordId mod = new ORecordId(rid1);
> ORecordId rd = new ORecordId(rid2);
> Map<String,Object> params = new HashMap<String,Object>();
> params.put("rid1", mod);
> params.put("rid2", rd);
>   request.command(new  OCommandSQL("create edge MemberOf from :rid1 to 
> :rid2")).execute(params);
>
> I get this
> Error on execution of command: sql.create edge MemberOf from :rid1 to :rid2
>
> later in the stack i get this
> Caused by: ! java.lang.NumberFormatException: For input string: ""
>
>
> On Monday, March 31, 2014 3:11:54 PM UTC-5, alexander anguiano wrote:
>>
>> Ok, i tried passing the ORecordId  like this
>>
>> String rid1 = ...
>> Srtring rid2 =...
>> request.command(new  OCommandSQL("create edge  MemberOf ? to 
>> ?")).execute(new 
>> ORecordId(rid1), new ORecordId(rid2));
>>
>> and now i get this
>>
>> Argument '?' is not a RecordId in form of string. Format must be: 
>> <cluster-id>:<cluster-position>
>>
>>
>> On Monday, March 31, 2014 2:15:09 PM UTC-5, alexander anguiano wrote:
>>>
>>> How do you create an edge using OCommandRequest,
>>>
>>> I'm using 1.6.4 of orierntdb
>>>
>>> OCommandRequest request =...
>>>
>>> request.command(new  OCommandSQL("create edge  MemberOf ? to 
>>> ?")).execute(rid1,rid2);
>>>
>>> gives me
>>>
>>> Cannot find a command executor for the command request: sql.? to ?
>>>
>>

-- 

--- 
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 orient-database+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to