You might do better to structure your program like this:

   get a file of data records

   prepare SQL statement using sqlite3_prepare

   execute SQL BEGIN

   loop
     read a data record
   until EOF
     bind data to SQL statement using sqlite3_bind functions
     execute SQL using sqlite3_step
     sqlite3_reset
   repeat
   sqlite3_finalize

   execute SQL COMMIT


Sreedhar.a wrote:
Hi,

I am working in Sqlite 3.3.6

I want to insert more records[like 20,000.] at a single stretch.

I did the following in shell.c,

Static void process_input (struct callback_data *p)

{

  char *zLine;

  int nLine;

  nLine = 2000000;

  zLine = malloc( nLine );

Strcpy (&zLine[n],"create table MUSIC (Id integer primary key, Album text
not null collate nocase);"

                                                  "Insert into MUSIC (Album)
values ('Deshamuduru');"

......);

While (zLine[n])

{ n++;
            }

            ZLine = realloc (zLine, n+1 );

}

Inside process_input I am doing strcpy where I will insert all my records.

But my means of this I can able to insert only some 200 records. even if
increase the nLine value I can not able to insert more than that at a single
stretch.

I want 40000 records to be in my database, for that each time I can only
insert 200.

Can any one help me to solve this problem by some other way?

I read in this forum like we can insert 20,000 . at a single stretch. How it
can be done. Where we have to change in the code?
Best Regards,

Sreedhar.



-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to