Re: BIT vs boolean

Поиск
Список
Период
Сортировка
От Fernando Nasser
Тема Re: BIT vs boolean
Дата
Msg-id 3EFCAA23.6090103@redhat.com
обсуждение исходный текст
Ответ на BIT vs boolean  (Darin Ohashi <DOhashi@maplesoft.com>)
Ответы Re: BIT vs boolean  (Kim Ho <kho@redhat.com>)
Список pgsql-jdbc
I think there is a patch posted for this already.
Kim can confirm if that is so.

Fernando

Darin Ohashi wrote:
> According to the jdbc doc's one should set a BIT value in a prepared statement
> using the setBoolean function.  So I think the following should work:
>
>         stat = con.createStatement();
>
>         stat.execute( "CREATE TABLE bitTable( b BIT )" );
>
>         pstat = con.prepareStatement( "INSERT INTO bitTable( b ) VALUES( ? )" );
>
>         pstat.setBoolean( 1, true );
>
>         pstat.execute();
>
> However with pgsql-jdbc 7.3.3 build 110, I get the following error:
>
> Exception in thread "main" java.sql.SQLException: ERROR:  Cannot parse 't' as a
> binary digit
>
>         at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:131)
>         at
> org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.jav
> a:505)
>         at
> org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:
> 320)
>         at
> org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:
> 48)
>         at SQLBug.main(SQLBug.java:34)
>
> Is setBoolean is just printing true or false into a string and expecting the
> database side to parse it?  Maybe it should check the type of the column to
> determine if the boolean value should be printed as true/false or 0/1 (or
> whatever BIT is expecting to see).
>
> Darin
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
>       joining column's datatypes do not match
>


--
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9


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

Предыдущее
От: Fernando Nasser
Дата:
Сообщение: Re: Multiple Out params in stored procs
Следующее
От: "scott.marlowe"
Дата:
Сообщение: Re: executeQuery and busy waiting