The state machine starts in "type" state.

case "type":
var r = self.popByte();
if (r) {
self.state = (r.data == "\0") ? "status" : "item";
progress = true;
}
break

But the first time it gets in here popByte returns an empty object for r.  I would have expected it to get that they "type" is \000b.  Maybe there's something wrong at the deeper interpretation level.  This does look like a proper response from BaseX:

S1<<
'\u000b<person>Gumby\nman</person>\u0000\u000b<person>Pokey\nhorse</person>\u0000\u0000\u0000'

Does it not?


On Tue, Jul 23, 2013 at 4:09 PM, Gerald de Jong <gerald@delving.eu> wrote:
Hi Andy!  Thanks for getting back to me so quickly.  I'm indeed using:

package.json:    "basex": "~0.6.1"

I thought as well that it might be an old reply, but all I do is create a database, insert a document, and then query for something that is not there.

I am using BaseX 7.6 if that makes any difference.

Maybe you can see it.  Here's the debug of what goes back and forth during the whole session:

S1<<
'1374588092554420000\u0000'
S1>>
'admin\u0000'
S1>>
'713de454606e785a0666bd57e6554891\u0000'
S1<<
'\u0000'
S1: authorized
S1>>
'create db gumby\u0000'
S1<<
'\u0000Database \'gumby\' created in 5.01 ms.\n\u0000\u0000'
response:  { result: '',
  info: 'Database \'gumby\' created in 5.01 ms.\n',
  ok: true }
.S1>>
'\t/people.xml\u0000<people><person>Gumby\nman</person><something>else</something><person>Pokey\nhorse</person></people>\u0000'
S1<<
'Path "people.xml" added in 1.88 ms.\n\u0000\u0000'
response:  { ok: true, result: 'Path "people.xml" added in 1.88 ms.\n' }
.S1>>
'\u0000//somethingNotThere\u0000'
S1<<
'0\u0000\u0000'
response:  { ok: true, result: '0' }
S1>>
'\u00040\u0000'
S1<<
'\u0000\u0000'

And then it hangs, since the callback isn't called.  

If, instead, I do a query that does give results back I get the first value prefixed with \000b, which I believe is intended to indicate that the result is an "element".

S1<<
'\u000b<person>Gumby\nman</person>\u0000\u000b<person>Pokey\nhorse</person>\u0000\u0000\u0000'
response:  { ok: true,
  result:
   [ '\u000b<person>Gumby\nman</person>',
     '<person>Pokey\nhorse</person>' ] }
{"ok":true,"result":["\u000b<person>Gumby\nman</person>","<person>Pokey\nhorse</person>"]}

See what I mean?

-Gerald


On Tue, Jul 23, 2013 at 3:54 PM, Andy Bunce <bunce.andy@gmail.com> wrote:
Hi Gerald,

Could that '\u0000\u0000' be part of an asynchronous  response to some previous command?

Otherwise it looks fine:
-> '\u0000 () \u0000'   // create query returning empty sequence
<- '1\u0000 \u0000'     //The 1 is the query handle.
-> '\u0004 1 \u0000'    //Execute the query with handle 1
<- '\u0000 \u0000'      // no result no error


Are you using https://npmjs.org/package/basex? If you can raise any problems or questions on github and I will take a look.

/Andy

On Tue, Jul 23, 2013 at 12:43 PM, Gerald de Jong <gerald@delving.eu> wrote:
So the driver sends a query for something that should give no results:

'\u0000/somethingNotThere\u0000'

It then receives, to my surprise:

'\u0000\u0000'

followed by:

'1\u0000\u0000'

then sends:

'\u00041\u0000'

and receives again:

'\u0000\u0000'

Are these proper responses.. is the driver misunderstanding them?



On Tue, Jul 23, 2013 at 1:41 PM, Gerald de Jong <gerald@delving.eu> wrote:
Woops, somehow sent before I intended.  Just a sec.


On Tue, Jul 23, 2013 at 1:40 PM, Gerald de Jong <gerald@delving.eu> wrote:
I'm trying to quickly prototype a REST server which uses BaseX for persistence using NodeJS.

I'm able to create a session, add a document, query that document, and then close the session.  Fine.

But when I create a query that should return no results, it seems the NodeJS module for BaseX I'm using seems to completely misunderstand the result and never execute the callback.

I looked at the protocol spec http://docs.basex.org/wiki/Server_Protocol but it doesn't seem to give back what is specified here.  I need a sanity check.

The driver sends this:

--
Delving BV, Vasteland 8, Rotterdam
http://www.delving.eu
http://twitter.com/fluxe
skype: beautifulcode
+31629339805

_______________________________________________
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk





--
Delving BV, Vasteland 8, Rotterdam
http://www.delving.eu
http://twitter.com/fluxe
skype: beautifulcode
+31629339805



--
Delving BV, Vasteland 8, Rotterdam
http://www.delving.eu
http://twitter.com/fluxe
skype: beautifulcode
+31629339805