Skip to content

Commit 5a019b7

Browse files
committed
fixed minor binding bug
1 parent db8ac0d commit 5a019b7

File tree

1 file changed

+18
-24
lines changed

1 file changed

+18
-24
lines changed

src/util/macros.h

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -157,38 +157,32 @@ inline bool IS_32BIT_INT(double num) {
157157

158158
// Common bind logic for statements (must match STATEMENT_BIND_T_BUFFERS).
159159
#define STATEMENT_BIND(stmt, info, info_length, bind_type) \
160-
if (info_length > 0) { \
161-
Binder _binder(stmt->st_handle, bind_type); \
162-
_binder.Bind(info, info_length, stmt); \
163-
const char* _err = _binder.GetError(); \
164-
if (_err) { \
165-
STATEMENT_CLEAR_BINDINGS(stmt); \
166-
return Nan::ThrowError(_err); \
167-
} \
160+
Binder _binder(stmt->st_handle, bind_type); \
161+
_binder.Bind(info, info_length, stmt); \
162+
const char* _err = _binder.GetError(); \
163+
if (_err) { \
164+
STATEMENT_CLEAR_BINDINGS(stmt); \
165+
return Nan::ThrowError(_err); \
168166
}
169167

170168
// Should be the same as STATEMENT_BIND, but uses the transient_buffers option.
171169
#define STATEMENT_BIND_T_BUFFERS(stmt, info, info_length, bind_type) \
172-
if (info_length > 0) { \
173-
Binder _binder(stmt->st_handle, bind_type, true); \
174-
_binder.Bind(info, info_length, stmt); \
175-
const char* _err = _binder.GetError(); \
176-
if (_err) { \
177-
STATEMENT_CLEAR_BINDINGS(stmt); \
178-
return Nan::ThrowError(_err); \
179-
} \
170+
Binder _binder(stmt->st_handle, bind_type, true); \
171+
_binder.Bind(info, info_length, stmt); \
172+
const char* _err = _binder.GetError(); \
173+
if (_err) { \
174+
STATEMENT_CLEAR_BINDINGS(stmt); \
175+
return Nan::ThrowError(_err); \
180176
}
181177

182178
// Common bind logic for transactions.
183179
#define TRANSACTION_BIND(trans, info, info_length, bind_type) \
184-
if (info_length > 0) { \
185-
MultiBinder _binder(trans->handles, trans->handle_count, bind_type); \
186-
_binder.Bind(info, info_length, trans); \
187-
const char* _err = _binder.GetError(); \
188-
if (_err) { \
189-
TRANSACTION_CLEAR_BINDINGS(trans); \
190-
return Nan::ThrowError(_err); \
191-
} \
180+
MultiBinder _binder(trans->handles, trans->handle_count, bind_type); \
181+
_binder.Bind(info, info_length, trans); \
182+
const char* _err = _binder.GetError(); \
183+
if (_err) { \
184+
TRANSACTION_CLEAR_BINDINGS(trans); \
185+
return Nan::ThrowError(_err); \
192186
}
193187

194188
// The macro-instruction that runs before an SQLite request.

0 commit comments

Comments
 (0)