473,396 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Block insert into mysql(5.0)

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
4 3922
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
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
>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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Jack | last post by:
I have a text file of data in a file (add2db.txt) where the entries are already entered on separate lines in the following form: INSERT INTO `reviews` VALUES("", "Tony's", "Lunch", "Great...
11
by: grumfish | last post by:
I'm trying to add a row to a MySQL table using insert. Here is the code: connection = MySQLdb.connect(host="localhost", user="root", passwd="pw", db="japanese") cursor = connection.cursor()...
0
by: David Bordas | last post by:
Hi list, I've got a little bug with MySQL. I can insert a row into my table but this row will not appear in the table :( Server is under linux redhat, MySQL is 3.23.56 installed from binary...
0
by: Lars Rasmussen | last post by:
I tried that, but i dont work either. I need to insert a way that mysql doese'nt complain when i copy some records that have the same id (or that it just gives it an id according to the...
0
by: Rajesh Kapur | last post by:
I have a master slave configuration on linux machines running MySQL 4.0.21. Once every hour, a process deletes about 9000 rows and re-inserts fresh data on the master. The master process completes...
10
by: Python_it | last post by:
Python 2.4 MySQL-python.exe-1.2.0.win32-py2.4.zip How can I insert a NULL value in a table (MySQL-database). I can't set a var to NULL? Or is there a other possibility? My var must be variable...
2
by: bballr | last post by:
I have a problem that I'm not sure if it can be done. I'm trying to use the MySQL C API to be able to use a normal sql insert statement that will send the data or file to a directory and NOT the...
2
josie23
by: josie23 | last post by:
Egad, I'm not a coder/programmer by nature or occupation but understand things like html and css and a small amount of perl. So, basically, I'm a perl/mysql imbecile. But, I've been trying to...
4
by: dirk | last post by:
Hey, I'm new to php and I'm trying to write some php code so that I can insert data into a mysql database using html forms. I've got two text forms and a submit button. When entering data and...
3
by: Waruna | last post by:
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.