• 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
Re: EOAdaptorChannel's evaluateExpression()
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EOAdaptorChannel's evaluateExpression()


  • Subject: Re: EOAdaptorChannel's evaluateExpression()
  • From: Patrick Middleton <email@hidden>
  • Date: Wed, 13 Jul 2005 10:39:04 +0100


On 13 Jul 2005, at 02:03, Ricardo Parada wrote:


Hi,

I created an instance of EOSQLExpression that contains a SQL statement similar to this:

INSERT INTO ...
SELECT ...
FROM ...
WHERE ...

I then use the EOAdaptorChannel's evaluateExpression() to execute the expression. The SQL statement executes great and I'm able to insert a ton of records with a single SQL statement. (I love EOF :-) )

However, I'm wondering if I can get the number of records inserted. I tried using EOAdaptorChannel's fetchRow() but I get nothing back. Right now the work around is to build and execute a separate EOSQLExpression that counts the records inserted, e.g. something like this:

SELECT COUNT(*)
FROM ...
WHERE ...

It works great but it would be nicer if I could get the number of records inserted when I execute the insert-select statement. Then I wouldn't need to create and execute the counting expression.

Thanks,
Ricardo Parada
Medical Present Value, Inc.

Using Sybase, you can obtain the count of rows affected:
select @@rowcount
and I would expect other RDBMSs to offer comparable facilities.
This approach would mean that your app uses RDBMS-specific SQL, but you appear to be doing that already. You would also need to working at the adaptor level to fetch the results from 'select @@rowcount' or whatever, but you're doing that already too.


Failing that... you could go hacking. A while back I had a problem with JDBCChannel.cancelFetch() not invoking java.sql.Statement.cancel(), which I fixed by making my own JDBC Adaptor -- I subclassed JDBCAdaptor, JDBCContext and JDBCChannel in order to be able to get at a protected ivar _statement in JDBCChannel, so that I could call JDBC API.

See also "EOFetchSpecification.setFetchLimit(), EOAdaptorChannel.cancelFetch(), etc" which I posted to email@hidden on 17 Jul 2003, which included source code.

-- Patrick

_______________________________________________
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


References: 
 >EOAdaptorChannel's evaluateExpression() (From: Ricardo Parada <email@hidden>)

  • Prev by Date: Re: WO 5.3 + XCode 2.1
  • Next by Date: Keep an InputStream alive and reload a page
  • Previous by thread: EOAdaptorChannel's evaluateExpression()
  • Next by thread: Re: EOAdaptorChannel's evaluateExpression()
  • Index(es):
    • Date
    • Thread