• 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: exec sp_password using rawRowsForSQL
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: exec sp_password using rawRowsForSQL


  • Subject: Re: exec sp_password using rawRowsForSQL
  • From: Patrick Middleton <email@hidden>
  • Date: Tue, 18 Apr 2006 10:56:37 +0100


On 13 Apr 2006, at 21:21, Jerry Haynes wrote:

Has anyone successfully called sp_password on a Sybase database? Nothing is being returned back to theArray so I have no clue what the problem might be.

private NSArray setSybasePassword(String eoModel, String masterPassword, String newPassword, String userName) {
EOEditingContext context = session().defaultEditingContext();

String sqlString = "exec sp_password '" + masterPassword + "', '" + newPassword + "', '" + userName + "'";

NSArray theArray = EOUtilities.rawRowsForSQL(context, eoModel, sqlString, null);
//NSLog.out.appendln("*********** " + eoModel + " -- " + sqlString + " -- " + theArray + " ************");
return theArray;
}



Thanks, Jerry

Speaking from experience, Sybase stored procedures often return multiple rowsets. You can confirm this is the case for sp_password using sp_helptext when in the sybsystemprocs database. The problem is not EOAdaptorChannel.evaluateExpression() vs EOAdaptorChannel.executeStoredProcedure(), it's in having to write your own code to fetch multiple rowsets. There was once some very useful example code in the API reference documentation for how to do this, but it's long since been pruned out.


Broadly (I have abstracted this from some ObjC code),

channel.executeStoredProcedure(...);
while (channel.isFetchInProgress()) {
   channel setAttributesToFetch(channel.describeResults());
   while ((row=channel.fetchRow())!=null) {
     ...
   }
} // in my code this loop was do{}while(); instead of while(){}

I've never tried this in Java. The row dictionaries returned use EOAttribute names as keys. The OPENSTEP adaptor I was using created EOAttributes (in the array returned by describeResults()) having names of EOAttribute[n] , but external names which were the Sybase column names in the result set.

Hope this helps!

-- 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: 
 >exec sp_password using rawRowsForSQL (From: Jerry Haynes <email@hidden>)

  • Prev by Date: Re: Back Button Issues
  • Next by Date: binding a form value to a NSTimestamp field
  • Previous by thread: Re: exec sp_password using rawRowsForSQL
  • Next by thread: Re: exec sp_password using rawRowsForSQL
  • Index(es):
    • Date
    • Thread