[Tarantool-patches] [PATCH v3 19/20] netbox: introduce prepared statements

Nikita Pettik korablev at tarantool.org
Mon Dec 30 12:58:08 MSK 2019


On 25 Dec 23:41, Sergey Ostanevich wrote:
> Hi!
> 
> Thanks for the patch, one nit and one question.
> 
> Regards,
> Sergos
> 
> 
> 
> On 20 Dec 15:47, Nikita Pettik wrote:
> > @@ -1738,12 +1781,15 @@ tx_process_sql(struct cmsg *m)
> >  		port_destroy(&port);
> >  		goto error;
> >  	}
> > -	if (port_dump_msgpack(&port, out) != 0) {
> > +	/* Nothing to dump in case of UNPREPARE request. */
> > +	if (! is_unprepare) {
> 
> Unary ops - no spaces.

Ok, fixed.
 
> > +		if (port_dump_msgpack(&port, out) != 0) {
> > +			port_destroy(&port);
> > +			obuf_rollback_to_svp(out, &header_svp);
> > +			goto error;
> > +		}
> >  		port_destroy(&port);
> > -		obuf_rollback_to_svp(out, &header_svp);
> > -		goto error;
> >  	}
> > -	port_destroy(&port);
> >  	iproto_reply_sql(out, &header_svp, msg->header.sync, schema_version);
> >  	iproto_wpos_create(&msg->wpos, out);
> >  	return;
> > diff --git a/src/box/lua/net_box.lua b/src/box/lua/net_box.lua
> > index c2e1bb9c4..b4811edfa 100644
> > --- a/src/box/lua/net_box.lua
> > +++ b/src/box/lua/net_box.lua
> > @@ -104,6 +104,8 @@ local method_encoder = {
> >      upsert  = internal.encode_upsert,
> >      select  = internal.encode_select,
> >      execute = internal.encode_execute,
> > +    prepare = internal.encode_prepare,
> > +    unprepare = internal.encode_prepare,
> >      get     = internal.encode_select,
> >      min     = internal.encode_select,
> >      max     = internal.encode_select,
> > @@ -128,6 +130,8 @@ local method_decoder = {
> >      upsert  = decode_nil,
> >      select  = internal.decode_select,
> >      execute = internal.decode_execute,
> > +    prepare = internal.decode_prepare,
> > +    unprepare = decode_nil,

No. Result of prepare contains metadata (like names, types etc),
meanwhile result of unprepare contains only response status,
so there's nothing to decode.
 
> should it be internal.decode_prepare?
> 
> >      get     = decode_get,
> >      min     = decode_get,
> >      max     = decode_get,


More information about the Tarantool-patches mailing list