5 messages in com.mysql.lists.javaRe: ResultSet into table| From | Sent On | Attachments |
|---|---|---|
| Frank Daly | 31 Jan 2002 07:25 | |
| Igor Fedulov | 31 Jan 2002 07:33 | |
| tra...@thinkvirtual.com | 31 Jan 2002 09:26 | |
| Anuerin G. Diaz | 01 Feb 2002 06:24 | |
| Frank Daly | 01 Feb 2002 08:33 |
| Subject: | Re: ResultSet into table![]() |
|---|---|
| From: | Anuerin G. Diaz (adi...@msi.net.ph) |
| Date: | 02/01/2002 06:24:11 AM |
| List: | com.mysql.lists.java |
quoted from the mysql manual
~/../manual_Introduction.html#Missing_SELECT_INTO_TABLE
1.4.4.2 SELECT INTO TABLE
MySQL doesn't yet support the Oracle SQL extension:
SELECT ... INTO TABLE .... MySQL supports instead the
ANSI SQL syntax INSERT INTO ... SELECT ..., which is basically
the same thing. See section 6.4.3.1 INSERT ... SELECT Syntax.
INSERT INTO tblTemp2 (fldID) SELECT tblTemp1.fldOrder_ID FROM tblTemp1 WHERE
tblTemp1.fldOrder_ID > 100; Alternatively, you can use SELECT INTO OUTFILE... or
CREATE
TABLE ... SELECT to solve your problem.
ciao!
On Thu, 31 Jan 2002 10:27:16 -0700 (MST) tra...@thinkvirtual.com revealed these words to me:
Read up on the SELECT INTO statement. Actually maybe mysql doesn't support
that?
Travis
---- Original Message ---- From: Igor Fedulov <ifed...@outlook.net> Sent: 2002-01-31 To: Frank Daly <fda...@cit.ie> Subject: Re: ResultSet into table
sql,query,database,odbc,java
I'm looking for the best way to get the contents of a ResultSet into a table. I can process each record one at a time in a while (rs.next()) loop and insert the contents of the record into the table. Is there a better way?
If we talking about 100 rows then the way you do it perfectly normal, taking into consideration that whole ResultSet is sitting in memory. I don't know other way to do what you need. In my applications I usually convert each row to a DBDataSet which basically a hash table where column name mapped to column value and then each instance if more then one row retreived I put into ArrayList. This way when I put my result into Velocity (jakarta.apache.org/velocity) context I can do for/each and then do $currentrow.<columname>. It has been working good for me so far.
Best regards,
--
"Programming, an artform that fights back."
============================= Anuerin G. Diaz Design Engineer Millennium Software, Incorporated 2305 B West Tower, Philippines Stocks Exchange Center, Exchange Road, Ortigas Center, Pasig City
Tel# 638-3070 loc. 72 Fax# 638-3079 =============================




