JDBC - escaping quotes?

Поиск
Список
Период
Сортировка
От lloyd
Тема JDBC - escaping quotes?
Дата
Msg-id 1020806474.4189.16.camel@twilight
обсуждение исходный текст
Список pgsql-general
Using a PreparedStatement under pgjdbc2.jar, shouldn't the driver escape
quotes in Strings?

If I try something like this:

  String sql = "insert into book_list (name) values ? ";
  PreparedStatement stmt = cn.prepareStatement(sql);

  String name = "\"Media Unlimited\", by Todd Gitlin";
  stmt.setString(1, name);
  stmt.addBatch();
  stmt.execute();

I would expect a row in the db with a name column of:

   "Media Unlimited", by Todd Gitlin

Instead, though the row is added, the column is blank.




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

Предыдущее
От: "Booth, Robert"
Дата:
Сообщение: NOT IN query issues
Следующее
От: Randall Perry
Дата:
Сообщение: Can this be done in one query?