Re: [sqlite] Insertion and Updation using sqlite3_prepare()
On Feb 8, 2009, at 2:55 AM, Tom Longbotham wrote: > Hello, > > I have just worked through a similar situation. SQLITE would work > correctly for selects but would return SQLITE_DONE when selecting > but the > record would not get updated when doing an update. To confuse > matters more > I could update the record with no problems when using Firefox SQLITE > manager > and if I then selected the record I would see the update which made me > believe that I was referencing the same db file in all cases. I am > doing > iphone development and was working with the simulator and xcode. > Xcode was > actually taking my original database file and burying it in the sand > box > every time I ran the application so I saw the updates that the > management > interface was making but the updates that I was making > programmatically were > failing without a whimper from SQLITE. I found that the reason for > the > failure was because of file permisions on the db file in the sandbox > which > had only read access. I finally wrote the commrands necessary to > create the > database programmatically and set the permissions on the file to > allow write > access. This did resolve my problem. Could be a bug. Operating system? Exactly how do we set the permissions on the database file to cause the problem? Dan. > Regards, > -Tom > > On Thu, Feb 5, 2009 at 4:42 AM, hussainfarzana >wrote: > >> >> Dear All, >> >> We are using SQLite version 3.6.10. >> >> We are using the sqlite3_prepare() and sqlite3_bind() methods for >> insertion >> and updation of the records in the database.Everything works fine and >> sqlite3_step() returns 101 which is SQLITE_DONE.When we check the >> DB, the >> records are not inserted. >> >> Please help us in this regard. >> >> Thanks and Regards, >> Farzana. >> -- >> View this message in context: >> http://www.nabble.com/Insertion-and-Updation-using-sqlite3_prepare%28%29-tp21849799p21849799.html >> Sent from the SQLite mailing list archive at Nabble.com. >> >> ___ >> sqlite-users mailing list >> sqlite-users@sqlite.org >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users >> > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Insertion and Updation using sqlite3_prepare()
Hello, I have just worked through a similar situation. SQLITE would work correctly for selects but would return SQLITE_DONE when selecting but the record would not get updated when doing an update. To confuse matters more I could update the record with no problems when using Firefox SQLITE manager and if I then selected the record I would see the update which made me believe that I was referencing the same db file in all cases. I am doing iphone development and was working with the simulator and xcode. Xcode was actually taking my original database file and burying it in the sand box every time I ran the application so I saw the updates that the management interface was making but the updates that I was making programmatically were failing without a whimper from SQLITE. I found that the reason for the failure was because of file permisions on the db file in the sandbox which had only read access. I finally wrote the commrands necessary to create the database programmatically and set the permissions on the file to allow write access. This did resolve my problem. Regards, -Tom On Thu, Feb 5, 2009 at 4:42 AM, hussainfarzana wrote: > > Dear All, > > We are using SQLite version 3.6.10. > > We are using the sqlite3_prepare() and sqlite3_bind() methods for insertion > and updation of the records in the database.Everything works fine and > sqlite3_step() returns 101 which is SQLITE_DONE.When we check the DB, the > records are not inserted. > > Please help us in this regard. > > Thanks and Regards, > Farzana. > -- > View this message in context: > http://www.nabble.com/Insertion-and-Updation-using-sqlite3_prepare%28%29-tp21849799p21849799.html > Sent from the SQLite mailing list archive at Nabble.com. > > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Insertion and Updation using sqlite3_prepare()
I second that motion, there's a possibility here that you might be mixing up integers and strings either when you bind for the insert or when you bind for the select later to check if the insert worked! On Fri, Feb 6, 2009 at 12:22 AM, Igor Tandetnik wrote: > "hussainfarzana" > wrote in > message > news:21866676.p...@talk.nabble.com > > Below is the query we used where all the fields are numeric and it is > > prepared once: > > > > INSERT INTO ShopDataNum values(?,?,?,?,?,?,?,?,?,?,?) > > > > When we bind the values the steps were returning the correct value > > but the record is not found in the DB. > > > > Then we tried by passing the static value for the first field in > > sqlite3_prepare and we bind the values. > > INSERT INTO ShopDataNum values(960002,?,?,?,?,?,?,?,?,?,?) > > The steps were executed correctly and the record is inserted > > correctly in the DB. > > > > Again we tried the first query and assigned the static value for the > > first field while binding the values, the steps were executed > > correctly but the record is not found in the DB. > > Can you show a small complete code sample that reproduces the problem? > > Igor Tandetnik > > > > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- Billy Gray wg...@zetetic.net ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Insertion and Updation using sqlite3_prepare()
"hussainfarzana" wrote in message news:21866676.p...@talk.nabble.com > Below is the query we used where all the fields are numeric and it is > prepared once: > > INSERT INTO ShopDataNum values(?,?,?,?,?,?,?,?,?,?,?) > > When we bind the values the steps were returning the correct value > but the record is not found in the DB. > > Then we tried by passing the static value for the first field in > sqlite3_prepare and we bind the values. > INSERT INTO ShopDataNum values(960002,?,?,?,?,?,?,?,?,?,?) > The steps were executed correctly and the record is inserted > correctly in the DB. > > Again we tried the first query and assigned the static value for the > first field while binding the values, the steps were executed > correctly but the record is not found in the DB. Can you show a small complete code sample that reproduces the problem? Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Insertion and Updation using sqlite3_prepare()
Thanks for your reply Igor. We checked and we have commited the transaction. Below is the query we used where all the fields are numeric and it is prepared once: INSERT INTO ShopDataNum values(?,?,?,?,?,?,?,?,?,?,?) When we bind the values the steps were returning the correct value but the record is not found in the DB. Then we tried by passing the static value for the first field in sqlite3_prepare and we bind the values. INSERT INTO ShopDataNum values(960002,?,?,?,?,?,?,?,?,?,?) The steps were executed correctly and the record is inserted correctly in the DB. Again we tried the first query and assigned the static value for the first field while binding the values, the steps were executed correctly but the record is not found in the DB. Please guide us how to proceed further. Thanks and Regards, Farzana. Igor Tandetnik wrote: > > "hussainfarzana" > wrote in > message news:21849799.p...@talk.nabble.com >> We are using the sqlite3_prepare() and sqlite3_bind() methods for >> insertion and updation of the records in the database.Everything >> works fine and sqlite3_step() returns 101 which is SQLITE_DONE.When >> we check the DB, the records are not inserted. > > Do you, by any chance, start a transaction and then forget to commit it? > > Igor Tandetnik > > > > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > -- View this message in context: http://www.nabble.com/Insertion-and-Updation-using-sqlite3_prepare%28%29-tp21849799p21866676.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Insertion and Updation using sqlite3_prepare()
"hussainfarzana" wrote in message news:21849799.p...@talk.nabble.com > We are using the sqlite3_prepare() and sqlite3_bind() methods for > insertion and updation of the records in the database.Everything > works fine and sqlite3_step() returns 101 which is SQLITE_DONE.When > we check the DB, the records are not inserted. Do you, by any chance, start a transaction and then forget to commit it? Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users