List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:July 16 2001 9:57pm
Subject:Re: FW: What commands to "insert" to the table from data in
process memory, not a file?
View as plain text  
At 5:39 PM -0400 7/16/01, Simon Lee wrote:
>Hi:
>
>I have a process that will be receiving a bulk of data, say, every 5
>minutes.
>
>In the program, I can:
>
>1. Use the "Insert into" command to put the data into the table one at a
>time,
>    (Drawback: it would be very slow for each query to put in the data). Or
>
>2. Save the whole data into a file, then use "load data infile".
>    (Drawback: put the data in a file, then "load", is one step extra too.)
>
>Is there a way (or a command) that I can just put the data into the table,
>from the process memory?

You have to use a SQL statement of some kind.  You might want to use approach
1, but write a single INSERT statement that loads multiple rows.

INSERT INTO tbl_name (col_names
	VALUES
		(values for row 1),
		(values for row 2),
		(values for row 3),
	etc.

This is much more efficient than a set of single-row INSERTs.

More information:
http://www.mysql.com/doc/I/N/INSERT.html

>
>You help is appreciated.
>
>Simon Lee
>Wide Area Network Design Lab
>732-868-0100 ext 267


-- 
Paul DuBois, paul@stripped
Thread
FW: What commands to "insert" to the table from data in process memory, not a file?Simon Lee16 Jul
  • Re: FW: What commands to "insert" to the table from data inprocess memory, not a file?Paul DuBois16 Jul