def test(header, body): # Connect and authenticate c = Connection('localhost', server.sql.port) c.connect() print 'query', repr_dict(header), repr_dict(body) header = msgpack.dumps(header) body = msgpack.dumps(body) query = msgpack.dumps(len(header) + len(body)) + header + body # Send raw request using connectred socket s = c._socket try: s.send(query) except OSError as e: print ' => ', 'Failed to send request' c.close() sql("ping")
test({ IPROTO_CODE : REQUEST_TYPE_REPLACE }, { IPROTO_SPACE_ID: 280 }) print "\n" print "IPROTO_CALL" test({ IPROTO_CODE : REQUEST_TYPE_CALL }, {}) test({ IPROTO_CODE : REQUEST_TYPE_CALL }, { IPROTO_KEY: ('procname', )}) print "\n" # gh-434 Bee crashes on multiple iproto requests with WAL enabled admin("db.cfg.wal_mode") admin("space = db.schema.space.create('test', { id = 567 })") admin("index = space:create_index('primary', { type = 'hash' })") admin("db.schema.user.grant('guest', 'read,write,execute', 'space', 'test')") c = Connection('localhost', server.sql.port) c.connect() request1 = RequestInsert(c, 567, [1, "baobab"]) request2 = RequestInsert(c, 567, [2, "obbaba"]) s = c._socket try: s.send(bytes(request1) + bytes(request2)) except OSError as e: print ' => ', 'Failed to send request' response1 = Response(c, c._read_response()) response2 = Response(c, c._read_response()) print response1.__str__() print response2.__str__() request1 = RequestInsert(c, 567, [3, "occama"]) request2 = RequestSelect(c, 567, 0, [1], 0, 1, 0) s = c._socket