Thanks for pointing out that I was using the wrong list, I've submitted 
this issue in the correct list now (but waiting for approval).

On Friday, October 3, 2014 6:19:35 PM UTC+2, Ricardo Peres wrote:
>
> This is not the proper list for this kind of questions; in the future, I 
> ask you to use nhusers instead.
> As for your question, I'm not a MySQL user, can you try instead:
>
> session.CreateSQLQuery("SET @id = 0; SELECT @id");
>
> Maybe there's a different syntax in MySQL.
>
> RP
>
>
>
> On Friday, October 3, 2014 2:52:53 PM UTC+1, Danny Stommen wrote:
>>
>> Hi all,
>>
>> I have "job queue" table, where several worker processes can take a job 
>> from.
>>
>> To "claim" a job, I want to execute the following query:
>>
>>                     SET @id = 0;
>>
>>                     UPDATE job
>>                   INNER JOIN 
>>                 (
>>                         SELECT id AS tempid,  @id := id;
>>                         FROM job
>>                         WHERE active_host IS NULL 
>>                           AND enabled = 1
>>                           AND next_start < NOW()
>>                         ORDER BY next_start ASC
>>                         LIMIT 1                          
>>                      ) tmp 
>>                     ON id = tempid
>>                     SET active_host = :host;
>>                     
>>                     SELECT @id;
>>
>>
>> This works just fine in the normal MySQL Workbench, but NHibernate keeps 
>> having issues with the user defined variable @id. Even just executing "SET 
>> @id = 0" fails:
>>
>>  var r = session.CreateSQLQuery("SET @id = 1; ").UniqueResult();
>> "could not execute query\r\n[ SET @id = 1; ]\r\n[SQL: SET @id = 1;]"
>> inner exception: Fatal error encountered during command execution.
>>
>> Is it possible to do this using NHibernate?
>>
>>
>> Thanks!
>>
>> Danny
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"nhibernate-development" 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.

Reply via email to