Hello, I looked for a while at you code. I can't see why it fails but I have a few remarks:
1. Why do you use get_table and parse the result instead of simply doing a query like select Title from movies where Title = 'NewTitle' and check if you get an empty result set? 2. Did you try to check the result error-codes from the various sqlite functions? 3. The strcpy (movie, result1[i]); might overwrite your stack in case the result string exceeds your max_len. Maybe an error entry in the DB? 4. Are you sure to run the loop including the ncols: ? for (int i=0; i<nrows+1; i++) hope this helps Marcus > > Ok, this problem has me both very puzzled and frustrated. I'm running > sqlite3 version 3.6.10 under SUSE 10.3. The file contains executable code > that both works and fails depending upon the number of records in the > database. > > The movie database currently has 525 DVDs in it. Most of the movies were > manually added directly into sqlite3 ("insert into movies (Title, > Category, > TV) values ("","","")" as I was still working on the program. For the > program, I was using the same database but with only a few test records. > > Once I got the program working (or so I thought), I copied the complete > database from my Nokia N810 to my development directory. I then added > another movie just to make sure everything was operating correctly. Well, > it didn't work and I was stumped. Here's what the program does and what > occurs with a large database: > > First, the program displays all the categories that a movie can be in. I > enter a category, such as SciFi. I then enter the title of the movie, > such > as "X-Men". The program then goes through all the titles in the database > looking to see if there's a match. If there is, I'm told the movie > already > exists and it exits. If the movie doesn't exist, I'm asked if the movie > was > recorded from TV. After that, all is written to the database. That's > what > happens with a small number of records and what SHOULD happen, but > doesn't, > when there are a large number of records. > > As you can see from the code, I enter the movie title into a variable > called > "movie_title". Each title (stored under variable "movie") in the database > is compared to "movie_title". In a small database, e.g. with less than > 200 > records (I don't know exactly how many) all works as it should. However, > at > some point, the CONTENTS of movie_title changes. At some point, the > contents of movie_title starts changing almost as quickly as "result1[i]" > changes. What gets input into the database is whatever is in movie_title > at > the time. In checking all three variables (movie_title, category, tv), > only > movie_title changes. The other two remain correct. > > I've removed the rest of the program as well as anything that doesn't > pertain specifically to this problem to make it easier to review. > > Any ideas or help will be greatly appreciated! As I stated in the > beginning, I'm puzzled and frustrated... > And thanks, in advance! > > Nick. > > > http://www.nabble.com/file/p22137080/test.cpp test.cpp > -- > View this message in context: > http://www.nabble.com/Problem-with-Inserting-Records-into-Large-Database-tp22137080p22137080.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