@@ -44,11 +44,11 @@ func (c *conn) prepare(ctx context.Context, query string) (driver.Stmt, error) {
44
44
return nil , driver .ErrBadConn
45
45
}
46
46
47
- response , err := c .httpClient .post (ctx , & message.PrepareRequest {
47
+ response , err := c .httpClient .post (ctx , message.PrepareRequest_builder {
48
48
ConnectionId : c .connectionId ,
49
49
Sql : query ,
50
50
MaxRowsTotal : c .config .maxRowsTotal ,
51
- })
51
+ }. Build () )
52
52
53
53
if err != nil {
54
54
return nil , c .avaticaErrorToResponseErrorOrError (err )
@@ -57,10 +57,10 @@ func (c *conn) prepare(ctx context.Context, query string) (driver.Stmt, error) {
57
57
prepareResponse := response .(* message.PrepareResponse )
58
58
59
59
return & stmt {
60
- statementID : prepareResponse .Statement . Id ,
60
+ statementID : prepareResponse .GetStatement (). GetId () ,
61
61
conn : c ,
62
- parameters : prepareResponse .Statement . Signature . Parameters ,
63
- handle : prepareResponse .Statement ,
62
+ parameters : prepareResponse .GetStatement (). GetSignature (). GetParameters () ,
63
+ handle : prepareResponse .GetStatement () ,
64
64
batchUpdates : make ([]* message.UpdateBatch , 0 ),
65
65
}, nil
66
66
}
@@ -79,9 +79,9 @@ func (c *conn) Close() error {
79
79
return driver .ErrBadConn
80
80
}
81
81
82
- _ , err := c .httpClient .post (context .Background (), & message.CloseConnectionRequest {
82
+ _ , err := c .httpClient .post (context .Background (), message.CloseConnectionRequest_builder {
83
83
ConnectionId : c .connectionId ,
84
- })
84
+ }. Build () )
85
85
86
86
c .connectionId = ""
87
87
@@ -106,14 +106,14 @@ func (c *conn) begin(ctx context.Context, isolationLevel isoLevel) (driver.Tx, e
106
106
isolationLevel = isoLevel (c .config .transactionIsolation )
107
107
}
108
108
109
- _ , err := c .httpClient .post (ctx , & message.ConnectionSyncRequest {
109
+ _ , err := c .httpClient .post (ctx , message.ConnectionSyncRequest_builder {
110
110
ConnectionId : c .connectionId ,
111
- ConnProps : & message.ConnectionProperties {
111
+ ConnProps : message.ConnectionProperties_builder {
112
112
AutoCommit : false ,
113
113
HasAutoCommit : true ,
114
114
TransactionIsolation : uint32 (isolationLevel ),
115
- },
116
- })
115
+ }. Build () ,
116
+ }. Build () )
117
117
118
118
if err != nil {
119
119
return nil , c .avaticaErrorToResponseErrorOrError (err )
@@ -137,31 +137,31 @@ func (c *conn) exec(ctx context.Context, query string, args []namedValue) (drive
137
137
return nil , driver .ErrSkip
138
138
}
139
139
140
- st , err := c .httpClient .post (ctx , & message.CreateStatementRequest {
140
+ st , err := c .httpClient .post (ctx , message.CreateStatementRequest_builder {
141
141
ConnectionId : c .connectionId ,
142
- })
142
+ }. Build () )
143
143
144
144
if err != nil {
145
145
return nil , c .avaticaErrorToResponseErrorOrError (err )
146
146
}
147
147
148
- statementID := st .(* message.CreateStatementResponse ).StatementId
148
+ statementID := st .(* message.CreateStatementResponse ).GetStatementId ()
149
149
defer c .closeStatement (context .Background (), statementID )
150
150
151
- res , err := c .httpClient .post (ctx , & message.PrepareAndExecuteRequest {
151
+ res , err := c .httpClient .post (ctx , message.PrepareAndExecuteRequest_builder {
152
152
ConnectionId : c .connectionId ,
153
153
StatementId : statementID ,
154
154
Sql : query ,
155
155
MaxRowsTotal : c .config .maxRowsTotal ,
156
156
FirstFrameMaxSize : c .config .frameMaxSize ,
157
- })
157
+ }. Build () )
158
158
159
159
if err != nil {
160
160
return nil , c .avaticaErrorToResponseErrorOrError (err )
161
161
}
162
162
163
163
// Currently there is only 1 ResultSet per response for exec
164
- changed := int64 (res .(* message.ExecuteResponse ).Results [0 ].UpdateCount )
164
+ changed := int64 (res .(* message.ExecuteResponse ).GetResults () [0 ].GetUpdateCount () )
165
165
166
166
return & result {
167
167
affectedRows : changed ,
@@ -183,30 +183,30 @@ func (c *conn) query(ctx context.Context, query string, args []namedValue) (driv
183
183
return nil , driver .ErrSkip
184
184
}
185
185
186
- st , err := c .httpClient .post (ctx , & message.CreateStatementRequest {
186
+ st , err := c .httpClient .post (ctx , message.CreateStatementRequest_builder {
187
187
ConnectionId : c .connectionId ,
188
- })
188
+ }. Build () )
189
189
190
190
if err != nil {
191
191
return nil , c .avaticaErrorToResponseErrorOrError (err )
192
192
}
193
193
194
- statementID := st .(* message.CreateStatementResponse ).StatementId
194
+ statementID := st .(* message.CreateStatementResponse ).GetStatementId ()
195
195
196
- res , err := c .httpClient .post (ctx , & message.PrepareAndExecuteRequest {
196
+ res , err := c .httpClient .post (ctx , message.PrepareAndExecuteRequest_builder {
197
197
ConnectionId : c .connectionId ,
198
198
StatementId : statementID ,
199
199
Sql : query ,
200
200
MaxRowsTotal : c .config .maxRowsTotal ,
201
201
FirstFrameMaxSize : c .config .frameMaxSize ,
202
- })
202
+ }. Build () )
203
203
204
204
if err != nil {
205
205
_ = c .closeStatement (context .Background (), statementID )
206
206
return nil , c .avaticaErrorToResponseErrorOrError (err )
207
207
}
208
208
209
- resultSets := res .(* message.ExecuteResponse ).Results
209
+ resultSets := res .(* message.ExecuteResponse ).GetResults ()
210
210
211
211
return newRows (c , statementID , true , resultSets ), nil
212
212
}
@@ -226,11 +226,11 @@ func (c *conn) avaticaErrorToResponseErrorOrError(err error) error {
226
226
}
227
227
228
228
return avaticaErrors.ResponseError {
229
- Exceptions : avaticaErr .message .Exceptions ,
230
- ErrorMessage : avaticaErr .message .ErrorMessage ,
231
- Severity : int8 (avaticaErr .message .Severity ),
232
- ErrorCode : avaticaErrors .ErrorCode (avaticaErr .message .ErrorCode ),
233
- SqlState : avaticaErrors .SQLState (avaticaErr .message .SqlState ),
229
+ Exceptions : avaticaErr .message .GetExceptions () ,
230
+ ErrorMessage : avaticaErr .message .GetErrorMessage () ,
231
+ Severity : int8 (avaticaErr .message .GetSeverity () ),
232
+ ErrorCode : avaticaErrors .ErrorCode (avaticaErr .message .GetErrorCode () ),
233
+ SqlState : avaticaErrors .SQLState (avaticaErr .message .GetSqlState () ),
234
234
Metadata : & avaticaErrors.RPCMetadata {
235
235
ServerAddress : message .ServerAddressFromMetadata (avaticaErr .message ),
236
236
},
@@ -247,9 +247,9 @@ func (c *conn) ResetSession(_ context.Context) error {
247
247
}
248
248
249
249
func (c * conn ) closeStatement (ctx context.Context , statementID uint32 ) error {
250
- _ , err := c .httpClient .post (context .Background (), & message.CloseStatementRequest {
250
+ _ , err := c .httpClient .post (context .Background (), message.CloseStatementRequest_builder {
251
251
ConnectionId : c .connectionId ,
252
252
StatementId : statementID ,
253
- })
253
+ }. Build () )
254
254
return c .avaticaErrorToResponseErrorOrError (err )
255
255
}
0 commit comments