tglman / orientdb-c Goto Github PK
View Code? Open in Web Editor NEWThe C client of OrientDB
The C client of OrientDB
This also posted on Google groups.
https://groups.google.com/forum/#!topic/orient-database/is5FlxUPxX4
There seems to be a bug with executing multiple SQL queries with the same Session ID and socket, and running into a problem.
Basically, the server just doesnt respond after the first query.
Here's the sample code, that executes 2 queries after each other:
https://gist.github.com/willmoss/6828221
It's shown in the schema:
DB_OPEN
RESPONSE (+SESSION_ID)
........
REQUEST (+SESSION_ID)
RESPONSE (+SESSION_ID)
REQUEST (+SESSION_ID)
RESPONSE (+SESSION_ID)
..
........
DB_CLOSE (+SESSION_ID)
TCPIP SOCKET CLOSE
https://code.google.com/p/orient/wiki/NetworkBinaryProtocol#Session-Id
https://code.google.com/p/orient/wiki/NetworkBinaryProtocol#COMMAND
Now, when I execute Request #1 , i cannot execute any further request #2, #3 , etc..
EG.
(bytes are shown as " hex/int/ascii " )
// perform initialization - session_ID is 2
send: 29/41/)
(operation type - 41)
send: 00/0/ 00/0/ 00/0/ 02/2/
(sess-ID)
send: 73/115/s
(mode=synchronous)
send: 00/0/ 00/0/ 00/0/ 76/118/v
(class-name=v)
// command payload:
send: 00/0/ 00/0/ 00/0/ 31/49/1 63/99/c 6F/111/o 6D/109/m 2E/46/. 6F/111/o 72/114/r 69/105/i 65/101/e 6E/110/n 74/116/t 65/101/e 63/99/c 68/104/h 6E/110/n 6F/111/o 6C/108/l 6F/111/o 67/103/g 69/105/i 65/101/e 73/115/s 2E/46/. 6F/111/o 72/114/r 69/105/i 65/101/e 6E/110/n 74/116/t 2E/46/. 63/99/c 6F/111/o 72/114/r 65/101/e 2E/46/. 73/115/s 71/113/q 6C/108/l 2E/46/. 4F/79/O 43/67/C 6F/111/o 6D/109/m 6D/109/m 61/97/a 6E/110/n 64/100/d 53/83/S 51/81/Q 4C/76/L 00/0/ 00/0/ 00/0/ 29/41/) 73/115/s 65/101/e 6C/108/l 65/101/e 63/99/c 74/116/t 20/32/ 2A/42/* 20/32/ 66/102/f 72/114/r 6F/111/o 6D/109/m 20/32/ 4F/79/O 55/85/U 73/115/s 65/101/e 72/114/r 20/32/ 77/119/w 68/104/h 65/101/e 72/114/r 65/101/e 20/32/ 6E/110/n 61/97/a 6D/109/m 65/101/e 20/32/ 3D/61/= 20/32/ 27/39/' 61/97/a 64/100/d 6D/109/m 69/105/i 6E/110/n 27/39/' 20/32/ FFFFFFFF/-1/? FFFFFFFF/-1/? FFFFFFFF/-1/? FFFFFFFF/-1/? 00/0/ 00/0/ 00/0/ 00/0/ 00/0/ 00/0/ 00/0/ 00/0/ 00/0/ 00/0/ 00/0/ 00/0/ 00/0/ 00/0/ 00/0/ 00/0/ (118)
recv: /0/00
recv: /0/00 /0/00 /0/00 /2/02
(sess-ID)
recv: l/108/6C
(payload-status - l)
// response content below
recv: /0/00 /0/00 /0/00 /1/01
recv: /0/00 /0/00
recv: d/100/64
recv: /0/00 /5/05
recv: /0/00 /0/00 /0/00 /0/00 /0/00 /0/00 /0/00 /0/00
recv: /0/00 /0/00 /0/00 /0/00
recv: /0/00 /0/00 /0/00 ?/-124/FFFFFF84
recv: O/79/4F U/85/55 s/115/73 e/101/65 r/114/72 @/64/40 n/110/6E a/97/61 m/109/6D e/101/65 :/58/3A "/34/22 a/97/61 d/100/64 m/109/6D i/105/69 n/110/6E "/34/22 ,/44/2C p/112/70 a/97/61 s/115/73 s/115/73 w/119/77 o/111/6F r/114/72 d/100/64 :/58/3A "/34/22 {/123/7B S/83/53 H/72/48 A/65/41 -/45/2D 2/50/32 5/53/35 6/54/36 }/125/7D 8/56/38 C/67/43 6/54/36 9/57/39 7/55/37 6/54/36 E/69/45 5/53/35 B/66/42 5/53/35 4/52/34 1/49/31 0/48/30 4/52/34 1/49/31 5/53/35 B/66/42 D/68/44 E/69/45 9/57/39 0/48/30 8/56/38 B/66/42 D/68/44 4/52/34 D/68/44 E/69/45 E/69/45 1/49/31 5/53/35 D/68/44 F/70/46 B/66/42 1/49/31 6/54/36 7/55/37 A/65/41 9/57/39 C/67/43 8/56/38 7/55/37 3/51/33 F/70/46 C/67/43 4/52/34 B/66/42 B/66/42 8/56/38 A/65/41 8/56/38 1/49/31 F/70/46 6/54/36 F/70/46 2/50/32 A/65/41 B/66/42 4/52/34 4/52/34 8/56/38 A/65/41 9/57/39 1/49/31 8/56/38 "/34/22 ,/44/2C s/115/73 t/116/74 a/97/61 t/116/74 u/117/75 s/115/73 :/58/3A "/34/22 A/65/41 C/67/43 T/84/54 I/73/49 V/86/56 E/69/45 "/34/22 ,/44/2C r/114/72 o/111/6F l/108/6C e/101/65 s/115/73 :/58/3A </60/3C #/35/23 4/52/34 :/58/3A 0/48/30 >/62/3E
...... so, you can see Request #1 is a success.
(just send the same command again)
// exactly same SEND headers as in request #1
send: 29/41/)
send: 00/0/ 00/0/ 00/0/ 02/2/
send: 73/115/s
send: 00/0/ 00/0/ 00/0/ 76/118/v
// command payload below:
send: 00/0/ 00/0/ 00/0/ 31/49/1 63/99/c 6F/111/o 6D/109/m 2E/46/. 6F/111/o 72/114/r 69/105/i 65/101/e 6E/110/n 74/116/t 65/101/e 63/99/c 68/104/h 6E/110/n 6F/111/o 6C/108/l 6F/111/o 67/103/g 69/105/i 65/101/e 73/115/s 2E/46/. 6F/111/o 72/114/r 69/105/i 65/101/e 6E/110/n 74/116/t 2E/46/. 63/99/c 6F/111/o 72/114/r 65/101/e 2E/46/. 73/115/s 71/113/q 6C/108/l 2E/46/. 4F/79/O 43/67/C 6F/111/o 6D/109/m 6D/109/m 61/97/a 6E/110/n 64/100/d 53/83/S 51/81/Q 4C/76/L 00/0/ 00/0/ 00/0/ 29/41/) 73/115/s 65/101/e 6C/108/l 65/101/e 63/99/c 74/116/t 20/32/ 2A/42/* 20/32/ 66/102/f 72/114/r 6F/111/o 6D/109/m 20/32/ 4F/79/O 55/85/U 73/115/s 65/101/e 72/114/r 20/32/ 77/119/w 68/104/h 65/101/e 72/114/r 65/101/e 20/32/ 6E/110/n 61/97/a 6D/109/m 65/101/e 20/32/ 3D/61/= 20/32/ 27/39/' 61/97/a 64/100/d 6D/109/m 69/105/i 6E/110/n 27/39/' 20/32/ FFFFFFFF/-1/? FFFFFFFF/-1/? FFFFFFFF/-1/? FFFFFFFF/-1/? 00/0/ 00/0/ 00/0/ 00/0/ 00/0/ 00/0/ 00/0/ 00/0/ 00/0/ 00/0/ 00/0/ 00/0/ 00/0/ 00/0/ 00/0/ 00/0/ (118)
recv: /0/00
recv: /0/00 /0/00 /0/00 /0/00
// no response
??????
Any queries that are longer than 2 x START_BUFFER_SIZE will not be properly executed and the program will terminate with
This is due to a limit set in o_output_stream_byte_write_bytes() and o_output_stream_byte_buffer(),
In o_output_stream_byte_write_bytes(), the buffer will only expand to max of 2 x START_BUFFER_SIZE .
A fix is to increase this value, however code needs to be refactored so its supports any value.
o_output_stream_byte.c
void o_output_stream_byte_write_bytes(struct o_output_stream * stream, void *bytes, int nbytes)
{
...
if (buff->cursor + nbytes >= buff->size)
{
buff->size = buff->size * 4;
}
}
o_output_stream_byte.c
struct o_output_stream * o_output_stream_byte_buffer()
{
...
stream->size = START_BUFFER_SIZE;
...
}
Question in title..
Hi, I'am want to use OrientDB from C++, but on the "APIs and Drivers" site, there are just two links to projects for C/C++ Drivers which are both out-of-date and have an advise in the readme, that I should not use them. So my question is, is there a recommended way how to use OrientDB from C/C++? Or is there an Driver which is actually under development where I can help or so?
Hi there,
I was referred to this project by Luca after submitting this post to the mailing list: http://groups.google.com/group/orient-database/browse_thread/thread/84797f409501bb0b
I would like to make the same suggestion to you as a possible add-on to the work you're doing here. The URL above describes the idea in more detail, but I'll give a quick synopsis. Sqlite has a "virtual table" interface (http://www.sqlite.org/vtab.html) which is a well documented api that, when implemented, makes sqlite facade to any data source behind it.
The motivation behind doing this is that once completed, is that ANY programming language with a sqlite API (I can't think of many that don't have one) would be capable of accessing OrientDB (in addition to the sqlite cli). I think this would be a highly desirable thing for the project, and it would also be a natural fit as Orient actually has a sql interface.
I lack the C skills to provide any useful help in such an effort, but I would be willing to help in any other capacity I can (testing, documentation, etc).
What do you think?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.