Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Block insert into mysql(5.0)

Reply
Thread Tools

Block insert into mysql(5.0)

 
 
Waruna
Guest
Posts: n/a
 
      11-01-2007
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.........

 
Reply With Quote
 
 
 
 
Keith Willis
Guest
Posts: n/a
 
      11-01-2007
On Thu, 01 Nov 2007 05:07:25 -0700, Waruna <>
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
 
Reply With Quote
 
 
 
 
Rolf Magnus
Guest
Posts: n/a
 
      11-01-2007
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

 
Reply With Quote
 
Gordon Burditt
Guest
Posts: n/a
 
      11-02-2007
>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.

 
Reply With Quote
 
Waruna
Guest
Posts: n/a
 
      11-02-2007
On Nov 1, 5:13 pm, Rolf Magnus <ramag...@t-online.de> wrote:
> 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...

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Block insert into mysql(5.0) Waruna C++ 3 11-02-2007 03:33 AM
Fo:Block can you check to see if a block contains any text by using the block id? morrell XML 1 10-10-2006 07:18 PM
How To Insert Code With Javascript, How to insert into a div an amountof code Sergio del Amo Javascript 4 05-29-2005 02:45 AM
Tools to extract data from SQL database and convert it into XML & insert XML data into SQL databases Harry Zoroc XML 1 07-12-2004 10:10 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57