Re: [SQL] INSERT query (using insert from a Java application, concerning String input)

Поиск
Список
Период
Сортировка
От Brett W. McCoy
Тема Re: [SQL] INSERT query (using insert from a Java application, concerning String input)
Дата
Msg-id Pine.BSI.3.91.990217191629.22885D-100000@access1.lan2wan.com
обсуждение исходный текст
Ответ на INSERT query (using insert from a Java application, concerning String input)  (Atika <agoswa@essex.ac.uk>)
Список pgsql-sql
On Wed, 17 Feb 1999, Atika wrote:

> String input = "This is a String";
>
> myConn.updateQuery("insert into myDB values(input)");
>
> but get an error when I  run it saying:
> ERROR:  attribute input not found
> java.sql.SQLException: ERROR:  attribute input not found
>
> I am also going to have to insert integer and other such values but am not
> going to know their values when I use the insert statement.

I don't know the details of the Java interface (perhaps you should pose
your question to the interfaces list?), but you still need the single
quotes else the term ends up in the SQL querytree as an attribute rather
than as data to insert into an attribute.  All of the language interfaces
I have used still require the single quotes, even if you are
interpolating string variables inside of the SQL statement.  Or is the
JDBC completely different in this?  Can you prepare your query string
beforehand and then pass the entire string as a varaible rather than as
a literal to the updateQuery method?

Brett W. McCoy
                                         http://www.lan2wan.com/~bmccoy
-----------------------------------------------------------------------
Labor, n.:
    One of the processes by which A acquires property for B.
        -- Ambrose Bierce, "The Devil's Dictionary"

----- BEGIN GEEK CODE BLOCK -----
Version: 3.12
GAT dpu s:-- a C++++ UL++++$ P+ L+++ E W++ N- o K- w--- O@ M-@ !V PS+++
PE Y+ PGP- t++ 5- X+ R+@ tv b+++ DI+++ D+ e>++ h+ r++ y++++
------ END GEEK CODE BLOCK ------


В списке pgsql-sql по дате отправления:

Предыдущее
От: Atika
Дата:
Сообщение: INSERT query (using insert from a Java application, concerning String input)
Следующее
От: Peter Garner
Дата:
Сообщение: Re: [SQL] INSERT query (using insert from a Java application, concerning String input)