By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,394 Members | 1,443 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,394 IT Pros & Developers. It's quick & easy.

Block insert into mysql(5.0)

P: n/a
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.........

Nov 1 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Thu, 01 Nov 2007 05:07:25 -0700, Waruna <wa*******@gmail.com>
wrote:
>Is there a way to block insert into mysql(5.0) using c api of mysql
db..
<snip>
>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...

--
PGP key ID 0xEB7180EC
Nov 1 '07 #2

P: n/a
Waruna wrote:
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

Nov 1 '07 #3

P: n/a
>Is there a way to block insert into mysql(5.0) using c api of mysql
>db..
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.

Nov 2 '07 #4

P: n/a
On Nov 1, 5:13 pm, Rolf Magnus <ramag...@t-online.dewrote:
Waruna wrote:
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
srry guys for the inconvenience...

Nov 2 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.