Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!Xl.tags.giganews.com!border2.nntp.ams2.giganews.com!nntp.giganews.com!backlog4.nntp.ams3.giganews.com!backlog4.nntp.ams.giganews.com!local2.nntp.ams.giganews.com!nntp.bt.com!news.bt.com.POSTED!not-for-mail NNTP-Posting-Date: Wed, 05 Mar 2014 14:34:45 -0600 Date: Wed, 05 Mar 2014 20:34:44 +0000 From: lipska the kat Organization: Trollbusters 3 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4 MIME-Version: 1.0 Newsgroups: comp.lang.java.programmer Subject: Re: JDBC: getMoreResults() versus rs.next() & autoGeneratedKeys References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Message-ID: <4rydnYA7tur4F4rOnZ2dnUVZ8m2dnZ2d@bt.com> Lines: 37 X-Usenet-Provider: http://www.giganews.com X-AuthenticatedUsername: NoAuthUser X-Trace: sv3-stttyRFO9P2UzBbYpEZOCUBhyMFEVZR9D7JoHarQPKWbh2sOD/scawUE4MlIFZhpO3+j/qj+BvSwKXO!lyw7hMcC+0VauO+QeA2t6qsEPlXjufTXVBp/nz+dc3aZQX0I2mXPsWHauCLjC9yvV0V14Eseh50= X-Complaints-To: abuse@btinternet.com X-DMCA-Complaints-To: abuse@btinternet.com X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2802 Xref: csiph.com comp.lang.java.programmer:27689 On 05/03/14 14:10, Andreas Leitgeb wrote: > Sorry for lateness of answer... >>> How would I tell the JDBC engine, that if it is a select then it >>> should pass certain flags, and if it is an insert, then I would be >>> interested in the generated keys? prepareStatement() doesn't seem to >>> have an overload to accept both variants. >> You would do this in Java, surely. Use some abstract factory type >> mechanism to generate a suitable class depending on the type of query. > > This "depending on the type of query" is the very problem. Well sooner or later something has to know what you want doesn't it? You have to make a decision sometime don't you? What is it that determines the type of query? Someone must make a decision, like press a button or type a command or press a key or something ... unless you have a mind reading application ;-) even then, there will be a particular electrical impulse that tells something "I want a select" or "I want an insert". If it is a machine interface then there may be a bit field or something, *something* has to tell *something else* what is wanted. This is the point when you can generate the SQL ... or am I missing something? Where is the decision first made and by what or who? -- Lipska the Kat©: Troll hunter, sandbox destroyer, treacherous feline and farscape dreamer of Aeryn Sun GNU/Linux user #560883 - http://www.linuxcounter.net