incendio Well-Known Member Licensed User Longtime User Aug 6, 2020 #1 Hi guys, I have this code B4X: Main.SQLMem.ExecNonQuery2("insert into MEM_CSH_BNK_IN_OT values(?,?,?,?,?,?,?)", Array As Object(RowId,Main.PUB_ID_PYMNT_TYP,IdAcN,txtCB.Text,Amnt,DscP)) It runs OK in B4A 10 without any errors even though the array size is different with the number of parameters. The MEM_CSH_BNK_IN_OT is a sqlite in memory table.
Hi guys, I have this code B4X: Main.SQLMem.ExecNonQuery2("insert into MEM_CSH_BNK_IN_OT values(?,?,?,?,?,?,?)", Array As Object(RowId,Main.PUB_ID_PYMNT_TYP,IdAcN,txtCB.Text,Amnt,DscP)) It runs OK in B4A 10 without any errors even though the array size is different with the number of parameters. The MEM_CSH_BNK_IN_OT is a sqlite in memory table.
drgottjr Expert Licensed User Longtime User Aug 7, 2020 #3 the problem is that there is no error message. there should be. the bound parameters are a miscount. Upvote 0
M Mahares Expert Licensed User Longtime User Aug 7, 2020 #5 Michael2150 said: Try taking away a ? from the SQL statement or you are meant to add one more argument to the array that you forgot maybe Click to expand... The OP is telling you that there is no error. That is what is strange. She should be getting an error. Maybe the OP needs to make his post clearer and post some more code and maybe his table structure, etc. He is not giving enough information. Please read his first post again. Upvote 0
Michael2150 said: Try taking away a ? from the SQL statement or you are meant to add one more argument to the array that you forgot maybe Click to expand... The OP is telling you that there is no error. That is what is strange. She should be getting an error. Maybe the OP needs to make his post clearer and post some more code and maybe his table structure, etc. He is not giving enough information. Please read his first post again.
drgottjr Expert Licensed User Longtime User Aug 7, 2020 #6 the miscount is supposed to have thrown an error. it didn't. that's why he says it strange. he knows there is a difference between the number of placeholders and the actual number of parameters passed. sqlite's documentation says it throws an error, but we don't know exactly how our sql.jar handles things. Upvote 0
the miscount is supposed to have thrown an error. it didn't. that's why he says it strange. he knows there is a difference between the number of placeholders and the actual number of parameters passed. sqlite's documentation says it throws an error, but we don't know exactly how our sql.jar handles things.
mc73 Well-Known Member Licensed User Longtime User Aug 7, 2020 #7 Missing parameter values are set to null. On the other hand a miscount of ? will throw an error. I have to guess it's an error catch somewhere. Upvote 0
Missing parameter values are set to null. On the other hand a miscount of ? will throw an error. I have to guess it's an error catch somewhere.
drgottjr Expert Licensed User Longtime User Aug 8, 2020 #8 in the interest of full disclosure, these queries behave the same way on b4j and b4a: when the parameters passed are fewer than the number of placeholders, no error. (*see below) when the parameters passed are greater in number than the number of placeholder, crash. *in the case of fewer parameters, and where the missing parameters was of type int, a 0 was conveniently filled in. so, in my tests, the missing parm was not set to null. Upvote 0
in the interest of full disclosure, these queries behave the same way on b4j and b4a: when the parameters passed are fewer than the number of placeholders, no error. (*see below) when the parameters passed are greater in number than the number of placeholder, crash. *in the case of fewer parameters, and where the missing parameters was of type int, a 0 was conveniently filled in. so, in my tests, the missing parm was not set to null.
incendio Well-Known Member Licensed User Longtime User Aug 8, 2020 #9 In my opinion, if number of place holders are not the same with the number of parameters, error should be raised. Upvote 0
In my opinion, if number of place holders are not the same with the number of parameters, error should be raised.
M Mahares Expert Licensed User Longtime User Aug 8, 2020 #10 incendio said: In my opinion, if number of place holders are not the same with the number of parameters, error should be raised. Click to expand... SQL Language Expressions That is the way SQLite works. Please see this link where it states under PARAMETERS: Parameters that are not assigned values using sqlite3_bind() are treated as NULL. It has nothing to do with B4A version 10 or version 9.9 Upvote 0
incendio said: In my opinion, if number of place holders are not the same with the number of parameters, error should be raised. Click to expand... SQL Language Expressions That is the way SQLite works. Please see this link where it states under PARAMETERS: Parameters that are not assigned values using sqlite3_bind() are treated as NULL. It has nothing to do with B4A version 10 or version 9.9
incendio Well-Known Member Licensed User Longtime User Aug 8, 2020 #11 I didn't say it has something to do with B4A. Upvote 0