Block insert into mysql(5.0)

W

Waruna

Is there a way to block insert into mysql(5.0) using c api of mysql
db..

i.e.

say there is a table with 2 columns, one contains char other int
then i want to insert 500 records at once,, as i explained below.

here i declare 2 arrays of char and int to store the values i want,

char *pzCol1[500*50];
int *piCol2[500];

then i fil abov 2 arrays wit values and then the PROBLEM...
Is there a way to above 500 records using below insert query usin' c
api of mysql db..

INSERT INTO table VALUES (?, ?)


PLS HLP me.........
 
K

Keith Willis

Is there a way to block insert into mysql(5.0) using c api of mysql
db..
i.e.

INSERT INTO table VALUES (?, ?)

What you are looking for is called "Embedded SQL", and is off topic in
this group. Try perhaps comp.databases.mysql...
 
R

Rolf Magnus

Waruna said:
Is there a way to block insert into mysql(5.0) using c api of mysql
db..

mysql(5.0) is neither part of C++, nor of C, so you are off-topic in both
newsgroups you posted to. Try a newsgroup about sql. A quick look gives
comp.databases.mysql
 
G

Gordon Burditt

Is there a way to block insert into mysql(5.0) using c api of mysql

It is possible to use C to build up a query string and, using the
non-standard-C C MySQL API, get the query executed. That string
can be very long. sprintf() or repeated application of strcat()
might be appropriate here.
then i fil abov 2 arrays wit values and then the PROBLEM...
Is there a way to above 500 records using below insert query usin' c
api of mysql db..

Yes, you can insert 500 records with one INSERT query, assuming the
values aren't so long that you exceed the maximum query length.
INSERT INTO table VALUES (?, ?)

INSERT INTO table values
(55, 'spamming'),
(86, 'scamming'),
(137, 'Nigerian bank fraud'),
(872, 'Murder'),
....
(999, 'Income Tax Evasion');

You don't have to format the query with embedded newlines, but it's allowed.
 
W

Waruna

mysql(5.0) is neither part of C++, nor of C, so you are off-topic in both
newsgroups you posted to. Try a newsgroup about sql. A quick look gives
comp.databases.mysql

srry guys for the inconvenience...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top