X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6E1899DCA48 for ; Mon, 9 Jan 2006 23:30:26 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 88349-03 for ; Mon, 9 Jan 2006 23:30:29 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 192BB9DCA1C for ; Mon, 9 Jan 2006 23:30:23 -0400 (AST) Received: from mail2.yozons.com (mail2.yozons.com [63.251.168.97]) by svr4.postgresql.org (Postfix) with ESMTP id 7072B5AF046 for ; Tue, 10 Jan 2006 03:30:25 +0000 (GMT) Received: from [192.168.1.46] (pool-71-112-83-89.sttlwa.dsl-w.verizon.net [71.112.83.89]) (authenticated bits=0) by mail2.yozons.com (8.12.10/8.12.10) with ESMTP id k0A3UI5B030914 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Mon, 9 Jan 2006 19:30:19 -0800 Message-ID: <43C32A5D.8020807@computer.org> Date: Mon, 09 Jan 2006 19:30:37 -0800 From: David Wall User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: Re: Prepared statements and default values References: <4bd3e1480601091924q54cfee5cs1c6744638e650fff@mail.gmail.com> In-Reply-To: <4bd3e1480601091924q54cfee5cs1c6744638e650fff@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.479 required=5 tests=[DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.479 X-Spam-Level: X-Archive-Number: 200601/35 X-Sequence-Number: 14486 You'll probably need to use two statements, so that when you want to use the default, you don't specify anything, and when you want a special value, you use the command you gave. If you want the default, use: UPDATE usersettings SET serverurl = ? where username = ? If you want to specify, then use: UPDATE usersettings SET gpsfrequency = ? , serverurl = ? where username = ? David Assad Jarrahian wrote: >I have a preparedStatement with the following query > "UPDATE usersettings SET gpsfrequency = ? , serverurl = ? where >username = ? ;"; > >In the db, the table userSettings has a default value specified for >gps_frequency . > >So when I write code >if (client.getSettings().getField(Settings.GPS_FREQUENCY).compareTo(""))==0) > //pick up the default value from the db. >else > setUserSettings.setInt(++i, >Integer.parseInt(client.getSettings().getField(Settings.GPS_FREQUENCY))); > > > .. I basically want to send something that lets the >db know to use the DEFAULT value. (its of type int0) > >So what does go here? > >any help would be much appreciated. > >-a > >---------------------------(end of broadcast)--------------------------- >TIP 2: Don't 'kill -9' the postmaster > > >