forked from fl00r/go-tarantool-1.6
    
        
        - 
                Notifications
    You must be signed in to change notification settings 
- Fork 60
TNTP-3334: IPROTO_IS_SYNC support for begin/commit #447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            2 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      
    File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              This file was deleted.
      
      Oops, something went wrong.
      
    
  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|  | @@ -22,26 +22,6 @@ type Prepared struct { | |||||||
| Conn *Connection | ||||||||
| } | ||||||||
|  | ||||||||
| func fillPrepare(enc *msgpack.Encoder, expr string) error { | ||||||||
| enc.EncodeMapLen(1) | ||||||||
| enc.EncodeUint(uint64(iproto.IPROTO_SQL_TEXT)) | ||||||||
| return enc.EncodeString(expr) | ||||||||
| } | ||||||||
|  | ||||||||
| func fillUnprepare(enc *msgpack.Encoder, stmt Prepared) error { | ||||||||
| enc.EncodeMapLen(1) | ||||||||
| enc.EncodeUint(uint64(iproto.IPROTO_STMT_ID)) | ||||||||
| return enc.EncodeUint(uint64(stmt.StatementID)) | ||||||||
| } | ||||||||
|  | ||||||||
| func fillExecutePrepared(enc *msgpack.Encoder, stmt Prepared, args interface{}) error { | ||||||||
| enc.EncodeMapLen(2) | ||||||||
| enc.EncodeUint(uint64(iproto.IPROTO_STMT_ID)) | ||||||||
| enc.EncodeUint(uint64(stmt.StatementID)) | ||||||||
| enc.EncodeUint(uint64(iproto.IPROTO_SQL_BIND)) | ||||||||
| return encodeSQLBind(enc, args) | ||||||||
| } | ||||||||
|  | ||||||||
| // NewPreparedFromResponse constructs a Prepared object. | ||||||||
| func NewPreparedFromResponse(conn *Connection, resp Response) (*Prepared, error) { | ||||||||
| if resp == nil { | ||||||||
|  | @@ -81,8 +61,16 @@ func NewPrepareRequest(expr string) *PrepareRequest { | |||||||
| } | ||||||||
|  | ||||||||
| // Body fills an msgpack.Encoder with the execute request body. | ||||||||
| func (req *PrepareRequest) Body(res SchemaResolver, enc *msgpack.Encoder) error { | ||||||||
| return fillPrepare(enc, req.expr) | ||||||||
| func (req *PrepareRequest) Body(_ SchemaResolver, enc *msgpack.Encoder) error { | ||||||||
| if err := enc.EncodeMapLen(1); err != nil { | ||||||||
| return err | ||||||||
| } | ||||||||
|  | ||||||||
| if err := enc.EncodeUint(uint64(iproto.IPROTO_SQL_TEXT)); err != nil { | ||||||||
| return err | ||||||||
| } | ||||||||
|  | ||||||||
| return enc.EncodeString(req.expr) | ||||||||
| } | ||||||||
|  | ||||||||
| // Context sets a passed context to the request. | ||||||||
|  | @@ -126,8 +114,16 @@ func (req *UnprepareRequest) Conn() *Connection { | |||||||
| } | ||||||||
|  | ||||||||
| // Body fills an msgpack.Encoder with the execute request body. | ||||||||
| func (req *UnprepareRequest) Body(res SchemaResolver, enc *msgpack.Encoder) error { | ||||||||
| return fillUnprepare(enc, *req.stmt) | ||||||||
| func (req *UnprepareRequest) Body(_ SchemaResolver, enc *msgpack.Encoder) error { | ||||||||
| if err := enc.EncodeMapLen(1); err != nil { | ||||||||
| return err | ||||||||
| } | ||||||||
|  | ||||||||
| if err := enc.EncodeUint(uint64(iproto.IPROTO_STMT_ID)); err != nil { | ||||||||
| return err | ||||||||
| } | ||||||||
|  | ||||||||
| return enc.EncodeUint(uint64(req.stmt.StatementID)) | ||||||||
| } | ||||||||
|  | ||||||||
| // Context sets a passed context to the request. | ||||||||
|  | @@ -171,8 +167,24 @@ func (req *ExecutePreparedRequest) Args(args interface{}) *ExecutePreparedReques | |||||||
| } | ||||||||
|  | ||||||||
| // Body fills an msgpack.Encoder with the execute request body. | ||||||||
| func (req *ExecutePreparedRequest) Body(res SchemaResolver, enc *msgpack.Encoder) error { | ||||||||
| return fillExecutePrepared(enc, *req.stmt, req.args) | ||||||||
| func (req *ExecutePreparedRequest) Body(_ SchemaResolver, enc *msgpack.Encoder) error { | ||||||||
| if err := enc.EncodeMapLen(2); err != nil { | ||||||||
| return err | ||||||||
| } | ||||||||
|  | ||||||||
| if err := enc.EncodeUint(uint64(iproto.IPROTO_STMT_ID)); err != nil { | ||||||||
| return err | ||||||||
| } | ||||||||
|  | ||||||||
| if err := enc.EncodeUint(uint64(req.stmt.StatementID)); err != nil { | ||||||||
| return err | ||||||||
| } | ||||||||
|  | ||||||||
| if err := enc.EncodeUint(uint64(iproto.IPROTO_SQL_BIND)); err != nil { | ||||||||
| return err | ||||||||
| } | ||||||||
|  | ||||||||
| return encodeSQLBind(enc, req.args) | ||||||||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 
        Suggested change
       
 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed | ||||||||
| } | ||||||||
|  | ||||||||
| // Context sets a passed context to the request. | ||||||||
|  | ||||||||
      
      Oops, something went wrong.
        
    
  
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For here and all other functions.
Just a cosmetic: it would a bit better to add empty lines between blocks.
At least if we add linters from
ttthey will force add such lines.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed