This is a binary question, not an API question. But while using the
node-orientdb api (or even the java api). If I wanted to loop through
updates instead of synchronously.
*Like this:*
db.open().then(function(){
  db.sql("UPDATE FROM users SET type=1 WHERE id=1", {mode:"a"});
  db.sql("UPDATE FROM users SET type=1 WHERE id=2", {mode:"a"});
});

*or this:*
db.open().then(function(){
  for(var g=0; g<list.length; g++) {
      db.sql("UPDATE FROM users SET type=1 WHERE id="+g, {mode:"a"});
  }
});

It doesn't seem possible on the binary side. The method, "db.sql" sends the
command, COMMAND, to the OrientDB Binary. And the mode lets the binary know
what type of query
("a"=com.orientechnologies.orient.core.sql.query.OSQLAsynchQuery). The
"db.open" method opens a database connection.

But the binary doesn't seem to allow asynchronous insert/update statements
only select statements. I assume it is because it may confuse the system if
the same record is being updated at the same time. Was this intended or is
there another way running update and/or insert sql statements to the binary
asynchronously?

*My only thought is to create a connection for each async command:*
db.open().then(function(){
  db.sql("UPDATE FROM users SET type=1 WHERE id=1", {mode:"a"});
});
db.open().then(function(){
  db.sql("UPDATE FROM users SET type=1 WHERE id=2", {mode:"a"});
});

Thanks,
Giraldo



On Feb 14, 2014 9:15 AM, "Andrey Lomakin" <[email protected]> wrote:

> Hi,
> Sorry can not understand, how asynchronous update command should work ?
> Could you provide example ?
>
>
> On Thu, Feb 13, 2014 at 10:07 PM, Giraldo Rosales <[email protected]>wrote:
>
>> Is there a way to run the binary command, COMMAND, asynchronously with an
>> UPDATE and/or INSERT sql command? I see non-idempotent commands use
>> com.orientechnologies.orient.core.sql.OCommandSQL. SELECT sql statements
>> can use com.orientechnologies.orient.core.sql.query.OSQLSynchQuery
>> or com.orientechnologies.orient.core.sql.query.OSQLAsynchQuery.
>>
>> So I am assuming there is no way to async an UPDATE? Even with the
>> versioning? If there isn't is there a workaround? Or is it bad to open up a
>> new connection for each non-idempotent command?
>>
>> Thanks,
>> Giraldo
>>
>> --
>>
>> ---
>> 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/groups/opt_out.
>>
>
>
>
> --
> Best regards,
> Andrey Lomakin.
>
> Orient Technologies
> the Company behind OrientDB
>
>  --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "OrientDB" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/orient-database/2yCrji3GEi4/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 

--- 
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/groups/opt_out.

Reply via email to