@@ -859,20 +859,27 @@ void Statement::JS_new (v8::FunctionCallbackInfo <v8 :: Value> const & info)
859
859
if (handle == NULL ) {
860
860
return ThrowRangeError (" The supplied SQL string contains no statements" );
861
861
}
862
- for (char c; (c = *tail); ++tail) {
863
- if (IS_SKIPPED (c)) continue ;
862
+
863
+ for (char c; (c = *tail); ) {
864
+ if (IS_SKIPPED (c)) {
865
+ ++tail;
866
+ continue ;
867
+ }
864
868
if (c == ' /' && tail[1 ] == ' *' ) {
865
869
tail += 2 ;
866
870
for (char c; (c = *tail); ++tail) {
867
871
if (c == ' *' && tail[1 ] == ' /' ) {
868
- tail += 1 ;
872
+ tail += 2 ;
869
873
break ;
870
874
}
871
875
}
872
876
} else if (c == ' -' && tail[1 ] == ' -' ) {
873
877
tail += 2 ;
874
878
for (char c; (c = *tail); ++tail) {
875
- if (c == ' \n ' ) break ;
879
+ if (c == ' \n ' ) {
880
+ ++tail;
881
+ break ;
882
+ }
876
883
}
877
884
} else {
878
885
sqlite3_finalize (handle);
@@ -891,9 +898,9 @@ void Statement::JS_new (v8::FunctionCallbackInfo <v8 :: Value> const & info)
891
898
892
899
info.GetReturnValue ().Set (info.This ());
893
900
}
894
- #line 149 "./src/objects/statement.lzz"
901
+ #line 156 "./src/objects/statement.lzz"
895
902
void Statement::JS_run (v8::FunctionCallbackInfo <v8 :: Value> const & info)
896
- #line 149 "./src/objects/statement.lzz"
903
+ #line 156 "./src/objects/statement.lzz"
897
904
{
898
905
Statement * stmt = node :: ObjectWrap :: Unwrap < Statement > ( info . This ( ) ) ; ( ( void ) 0 ) ; sqlite3_stmt * handle = stmt -> handle ; Database * db = stmt -> db ; if ( ! db -> GetState ( ) -> open ) return ThrowTypeError ( "The database connection is not open" ) ; if ( db -> GetState ( ) -> busy ) return ThrowTypeError ( "This database connection is busy executing a query" ) ; if ( stmt -> locked ) return ThrowTypeError ( "This statement is busy executing a query" ) ; if ( ! db -> GetState ( ) -> unsafe_mode ) { if ( db -> GetState ( ) -> iterators ) return ThrowTypeError ( "This database connection is busy executing a query" ) ; } ( ( void ) 0 ) ; const bool bound = stmt -> bound ; if ( ! bound ) { Binder binder ( handle ) ; if ( ! binder . Bind ( info , info . Length ( ) , stmt ) ) { sqlite3_clear_bindings ( handle ) ; return ; } ( ( void ) 0 ) ; } else if ( info . Length ( ) > 0 ) { return ThrowTypeError ( "This statement already has bound parameters" ) ; } ( ( void ) 0 ) ; db -> GetState ( ) -> busy = true ; v8 :: Isolate * isolate = info . GetIsolate ( ) ; if ( db -> Log ( isolate , handle ) ) { db -> GetState ( ) -> busy = false ; db -> ThrowDatabaseError ( ) ; if ( ! bound ) { sqlite3_clear_bindings ( handle ) ; } return ; } ( ( void ) 0 ) ;
899
906
sqlite3* db_handle = db->GetHandle ();
@@ -916,9 +923,9 @@ void Statement::JS_run (v8::FunctionCallbackInfo <v8 :: Value> const & info)
916
923
}
917
924
db -> GetState ( ) -> busy = false ; db -> ThrowDatabaseError ( ) ; if ( ! bound ) { sqlite3_clear_bindings ( handle ) ; } return ;
918
925
}
919
- #line 172 "./src/objects/statement.lzz"
926
+ #line 179 "./src/objects/statement.lzz"
920
927
void Statement::JS_get (v8::FunctionCallbackInfo <v8 :: Value> const & info)
921
- #line 172 "./src/objects/statement.lzz"
928
+ #line 179 "./src/objects/statement.lzz"
922
929
{
923
930
Statement * stmt = node :: ObjectWrap :: Unwrap < Statement > ( info . This ( ) ) ; if ( ! stmt -> returns_data ) return ThrowTypeError ( "This statement does not return data. Use run() instead" ) ; sqlite3_stmt * handle = stmt -> handle ; Database * db = stmt -> db ; if ( ! db -> GetState ( ) -> open ) return ThrowTypeError ( "The database connection is not open" ) ; if ( db -> GetState ( ) -> busy ) return ThrowTypeError ( "This database connection is busy executing a query" ) ; if ( stmt -> locked ) return ThrowTypeError ( "This statement is busy executing a query" ) ; const bool bound = stmt -> bound ; if ( ! bound ) { Binder binder ( handle ) ; if ( ! binder . Bind ( info , info . Length ( ) , stmt ) ) { sqlite3_clear_bindings ( handle ) ; return ; } ( ( void ) 0 ) ; } else if ( info . Length ( ) > 0 ) { return ThrowTypeError ( "This statement already has bound parameters" ) ; } ( ( void ) 0 ) ; db -> GetState ( ) -> busy = true ; v8 :: Isolate * isolate = info . GetIsolate ( ) ; if ( db -> Log ( isolate , handle ) ) { db -> GetState ( ) -> busy = false ; db -> ThrowDatabaseError ( ) ; if ( ! bound ) { sqlite3_clear_bindings ( handle ) ; } return ; } ( ( void ) 0 ) ;
924
931
int status = sqlite3_step (handle);
@@ -933,9 +940,9 @@ void Statement::JS_get (v8::FunctionCallbackInfo <v8 :: Value> const & info)
933
940
sqlite3_reset (handle);
934
941
db -> GetState ( ) -> busy = false ; db -> ThrowDatabaseError ( ) ; if ( ! bound ) { sqlite3_clear_bindings ( handle ) ; } return ;
935
942
}
936
- #line 187 "./src/objects/statement.lzz"
943
+ #line 194 "./src/objects/statement.lzz"
937
944
void Statement::JS_all (v8::FunctionCallbackInfo <v8 :: Value> const & info)
938
- #line 187 "./src/objects/statement.lzz"
945
+ #line 194 "./src/objects/statement.lzz"
939
946
{
940
947
Statement * stmt = node :: ObjectWrap :: Unwrap < Statement > ( info . This ( ) ) ; if ( ! stmt -> returns_data ) return ThrowTypeError ( "This statement does not return data. Use run() instead" ) ; sqlite3_stmt * handle = stmt -> handle ; Database * db = stmt -> db ; if ( ! db -> GetState ( ) -> open ) return ThrowTypeError ( "The database connection is not open" ) ; if ( db -> GetState ( ) -> busy ) return ThrowTypeError ( "This database connection is busy executing a query" ) ; if ( stmt -> locked ) return ThrowTypeError ( "This statement is busy executing a query" ) ; const bool bound = stmt -> bound ; if ( ! bound ) { Binder binder ( handle ) ; if ( ! binder . Bind ( info , info . Length ( ) , stmt ) ) { sqlite3_clear_bindings ( handle ) ; return ; } ( ( void ) 0 ) ; } else if ( info . Length ( ) > 0 ) { return ThrowTypeError ( "This statement already has bound parameters" ) ; } ( ( void ) 0 ) ; db -> GetState ( ) -> busy = true ; v8 :: Isolate * isolate = info . GetIsolate ( ) ; if ( db -> Log ( isolate , handle ) ) { db -> GetState ( ) -> busy = false ; db -> ThrowDatabaseError ( ) ; if ( ! bound ) { sqlite3_clear_bindings ( handle ) ; } return ; } ( ( void ) 0 ) ;
941
948
v8 :: Local < v8 :: Context > ctx = isolate -> GetCurrentContext ( ) ;
@@ -956,9 +963,9 @@ void Statement::JS_all (v8::FunctionCallbackInfo <v8 :: Value> const & info)
956
963
if (js_error) db->GetState ()->was_js_error = true ;
957
964
db -> GetState ( ) -> busy = false ; db -> ThrowDatabaseError ( ) ; if ( ! bound ) { sqlite3_clear_bindings ( handle ) ; } return ;
958
965
}
959
- #line 208 "./src/objects/statement.lzz"
966
+ #line 215 "./src/objects/statement.lzz"
960
967
void Statement::JS_iterate (v8::FunctionCallbackInfo <v8 :: Value> const & info)
961
- #line 208 "./src/objects/statement.lzz"
968
+ #line 215 "./src/objects/statement.lzz"
962
969
{
963
970
Addon * addon = static_cast < Addon * > ( info . Data ( ) . As < v8 :: External > ( ) -> Value ( ) ) ;
964
971
v8 :: Isolate * isolate = info . GetIsolate ( ) ;
@@ -968,9 +975,9 @@ void Statement::JS_iterate (v8::FunctionCallbackInfo <v8 :: Value> const & info)
968
975
addon->privileged_info = NULL ;
969
976
if (!maybeIterator.IsEmpty ()) info.GetReturnValue ().Set (maybeIterator.ToLocalChecked ());
970
977
}
971
- #line 218 "./src/objects/statement.lzz"
978
+ #line 225 "./src/objects/statement.lzz"
972
979
void Statement::JS_bind (v8::FunctionCallbackInfo <v8 :: Value> const & info)
973
- #line 218 "./src/objects/statement.lzz"
980
+ #line 225 "./src/objects/statement.lzz"
974
981
{
975
982
Statement* stmt = node :: ObjectWrap :: Unwrap <Statement>(info.This ());
976
983
if (stmt->bound ) return ThrowTypeError (" The bind() method can only be invoked once per statement object" );
@@ -981,9 +988,9 @@ void Statement::JS_bind (v8::FunctionCallbackInfo <v8 :: Value> const & info)
981
988
stmt->bound = true ;
982
989
info.GetReturnValue ().Set (info.This ());
983
990
}
984
- #line 229 "./src/objects/statement.lzz"
991
+ #line 236 "./src/objects/statement.lzz"
985
992
void Statement::JS_pluck (v8::FunctionCallbackInfo <v8 :: Value> const & info)
986
- #line 229 "./src/objects/statement.lzz"
993
+ #line 236 "./src/objects/statement.lzz"
987
994
{
988
995
Statement* stmt = node :: ObjectWrap :: Unwrap <Statement>(info.This ());
989
996
if (!stmt->returns_data ) return ThrowTypeError (" The pluck() method is only for statements that return data" );
@@ -994,9 +1001,9 @@ void Statement::JS_pluck (v8::FunctionCallbackInfo <v8 :: Value> const & info)
994
1001
stmt->mode = use ? Data::PLUCK : stmt->mode == Data::PLUCK ? Data::FLAT : stmt->mode ;
995
1002
info.GetReturnValue ().Set (info.This ());
996
1003
}
997
- #line 240 "./src/objects/statement.lzz"
1004
+ #line 247 "./src/objects/statement.lzz"
998
1005
void Statement::JS_expand (v8::FunctionCallbackInfo <v8 :: Value> const & info)
999
- #line 240 "./src/objects/statement.lzz"
1006
+ #line 247 "./src/objects/statement.lzz"
1000
1007
{
1001
1008
Statement* stmt = node :: ObjectWrap :: Unwrap <Statement>(info.This ());
1002
1009
if (!stmt->returns_data ) return ThrowTypeError (" The expand() method is only for statements that return data" );
@@ -1007,9 +1014,9 @@ void Statement::JS_expand (v8::FunctionCallbackInfo <v8 :: Value> const & info)
1007
1014
stmt->mode = use ? Data::EXPAND : stmt->mode == Data::EXPAND ? Data::FLAT : stmt->mode ;
1008
1015
info.GetReturnValue ().Set (info.This ());
1009
1016
}
1010
- #line 251 "./src/objects/statement.lzz"
1017
+ #line 258 "./src/objects/statement.lzz"
1011
1018
void Statement::JS_raw (v8::FunctionCallbackInfo <v8 :: Value> const & info)
1012
- #line 251 "./src/objects/statement.lzz"
1019
+ #line 258 "./src/objects/statement.lzz"
1013
1020
{
1014
1021
Statement* stmt = node :: ObjectWrap :: Unwrap <Statement>(info.This ());
1015
1022
if (!stmt->returns_data ) return ThrowTypeError (" The raw() method is only for statements that return data" );
@@ -1020,9 +1027,9 @@ void Statement::JS_raw (v8::FunctionCallbackInfo <v8 :: Value> const & info)
1020
1027
stmt->mode = use ? Data::RAW : stmt->mode == Data::RAW ? Data::FLAT : stmt->mode ;
1021
1028
info.GetReturnValue ().Set (info.This ());
1022
1029
}
1023
- #line 262 "./src/objects/statement.lzz"
1030
+ #line 269 "./src/objects/statement.lzz"
1024
1031
void Statement::JS_safeIntegers (v8::FunctionCallbackInfo <v8 :: Value> const & info)
1025
- #line 262 "./src/objects/statement.lzz"
1032
+ #line 269 "./src/objects/statement.lzz"
1026
1033
{
1027
1034
Statement* stmt = node :: ObjectWrap :: Unwrap <Statement>(info.This ());
1028
1035
if ( stmt -> db -> GetState ( ) -> busy ) return ThrowTypeError ( " This database connection is busy executing a query" ) ;
@@ -1031,9 +1038,9 @@ void Statement::JS_safeIntegers (v8::FunctionCallbackInfo <v8 :: Value> const &
1031
1038
else { if ( info . Length ( ) <= ( 0 ) || ! info [ 0 ] -> IsBoolean ( ) ) return ThrowTypeError ( " Expected " " first" " argument to be " " a boolean" ) ; stmt -> safe_ints = ( info [ 0 ] . As < v8 :: Boolean > ( ) ) -> Value ( ) ; }
1032
1039
info.GetReturnValue ().Set (info.This ());
1033
1040
}
1034
- #line 271 "./src/objects/statement.lzz"
1041
+ #line 278 "./src/objects/statement.lzz"
1035
1042
void Statement::JS_columns (v8::FunctionCallbackInfo <v8 :: Value> const & info)
1036
- #line 271 "./src/objects/statement.lzz"
1043
+ #line 278 "./src/objects/statement.lzz"
1037
1044
{
1038
1045
Statement* stmt = node :: ObjectWrap :: Unwrap <Statement>(info.This ());
1039
1046
if (!stmt->returns_data ) return ThrowTypeError (" The columns() method is only for statements that return data" );
@@ -1076,9 +1083,9 @@ void Statement::JS_columns (v8::FunctionCallbackInfo <v8 :: Value> const & info)
1076
1083
1077
1084
info.GetReturnValue ().Set (columns);
1078
1085
}
1079
- #line 314 "./src/objects/statement.lzz"
1086
+ #line 321 "./src/objects/statement.lzz"
1080
1087
void Statement::JS_busy (v8::Local <v8 :: String> _, v8::PropertyCallbackInfo <v8 :: Value> const & info)
1081
- #line 314 "./src/objects/statement.lzz"
1088
+ #line 321 "./src/objects/statement.lzz"
1082
1089
{
1083
1090
Statement* stmt = node :: ObjectWrap :: Unwrap <Statement>(info.This ());
1084
1091
info.GetReturnValue ().Set (stmt->alive && stmt->locked );
0 commit comments