Christian:

Change your readme and hostname columns to BLOB and use the
LOAD_FILE() function to add your record.
INSERT INTO test NULL, LOAD_FILE( '/path/to/readme/file' ), LOAD_FILE(
'/path/to/hostname/file');

More on the LOAD_FILE() function:
http://dev.mysql.com/doc/mysql/en/String_functions.html

Wes


On Wed, 8 Sep 2004 16:59:55 +0200 (CEST), Christian Gielstrup
<[EMAIL PROTECTED]> wrote:
> Hi gurus,
> 
> can you pls. help a mysql newbee?
> 
> I need to load data into the following table
> 
> mysql> describe test;
> +----------+------------+------+-----+---------+----------------+
> | Field    | Type       | Null | Key | Default | Extra          |
> +----------+------------+------+-----+---------+----------------+
> | id       | tinyint(4) |      | PRI | NULL    | auto_increment |
> | readme   | text       | YES  |     | NULL    |                |
> | hostname | text       | YES  |     | NULL    |                |
> +----------+------------+------+-----+---------+----------------+
> 3 rows in set (0.00 sec)
> 
> The fields "readme" and "hostname" are to contain text from two local
> files with no fixed format.
> They could look like this:
> 
> README start
> ---------------------------------------------------------------
> This directory contains system configuration information.
> Information was gathered on Wed Jan 21 08:54:16 MET 2004.
> 
> Synopsis
> ========
> 
>        Customer Name:
>          Contract ID:
>     Email results to:
>     Modules selected: default
> ---------------------------------------------------------------
> README end
> 
> HOSTNAME start
> ---------------------------------------------------------------
> hostname: legolas
> location: the moon
> owner: gandalf
> desc: this is system legolas,running X and Y service for Z customer
> 
> HOSTNAME stop
> ---------------------------------------------------------------
> 
> Do I have to create a row first only containing the auto incremented id
> field, and then do two updates to the table, controlled by matching the
> id.
> Or can this be done in one statement, with out changing the format of the
> text files?
> 
> Thank you for your time!
> 
> /Christian
> 
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
> 
>

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to