• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Executing a raw SELECT and ignoring result
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Executing a raw SELECT and ignoring result


  • Subject: Executing a raw SELECT and ignoring result
  • From: Paul Hoadley <email@hidden>
  • Date: Mon, 07 Apr 2014 13:53:05 +0930

Hello,

I'm using PostgreSQL.  As part of a migration, I want to add a column to an existing table, create a sequence, populate the column from elsewhere, and then set the sequence to start at the maximum of the initial values just used to populate that column.  (The sequence will then be used to provide future values for that column.)  To set the sequence, I need to execute:

SELECT setval('job_our_ref_seq', (SELECT max(our_ref) FROM job));

ERXJDBCUtilities.executeUpdate() doesn't seem happy about executing a SELECT (and getting a result).  This is the best I could come up with:

ERXJDBCUtilities.executeQuery(database.adaptorChannel(),
"SELECT setval('" + Job.OUR_REF_SEQ_NAME
+ "', (SELECT max(our_ref) FROM job))",
new ERXJDBCUtilities.IResultSetDelegate() {
@Override
public void processResultSet(
EOAdaptorChannel adaptorChannel, ResultSet rs)
throws Exception {
return;
}
});

While that works, it seems unwieldy—I just want to discard the result.  Is there a better way?


-- 
Paul Hoadley
http://logicsquad.net/


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: MySQL connection problem
  • Next by Date: WOApplication cannot be cast to Application
  • Previous by thread: MySQL connection problem
  • Next by thread: Re: Executing a raw SELECT and ignoring result
  • Index(es):
    • Date
    • Thread