RE: How to migrate to a new db structure.

2003-11-11 Thread Sven Haiges
thank you. regarding the frist question: yes,it is an mysql. i basically began developing on a local winXP system and then uploaded the application. i used phpMyAdmin to get a database-dump and created the exact same state on the server. but on the server, i could only delete and change records

RE: How to update multiple rows

2003-11-11 Thread Ramesh Sabeti
Seems to work perfectly. Thanks. > -Original Message- > From: Amit Rana [mailto:[EMAIL PROTECTED] > Sent: Monday, November 10, 2003 10:18 PM > To: 'Apache Torque Users List' > Subject: RE: How to update multiple rows > > Peer classes have doUpdate methods check the javadocs for more deta

RE: How to update multiple rows

2003-11-11 Thread Cloves Carneiro Jr.
k So, you mean there's no way a bulk update can happen if the primary key is not included using doUpdate(Criteria) ? -Original Message- From: Bill Leng [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 11, 2003 4:05 PM To: Apache Torque Users List Subject: Re: How to update multiple rows

RE: How to update multiple rows

2003-11-11 Thread Ramesh Sabeti
To add more to the confusion, JavaDocs for BasePeer.doUpdate(Criteria updateValues) says: "Convenience method used to update rows in the DB. Checks if a single int primary key is specified in the Criteria object and uses it to perform the udpate. If no primary key is specified an Exception will be

RE: How to update multiple rows

2003-11-11 Thread Ramesh Sabeti
I like the version of doUpdate(Criteria, Criteria) that Amit suggested. I've tested it and it works. But I'd really like to understand Bill's suggestion. I still don't understand why BasePeer.doUpdate is called and not BookPeer.doUpdate... > -Original Message- > From: Tulsi Das [mailto:[

RE: How to update multiple rows

2003-11-11 Thread Ramesh Sabeti
I use Amit's suggestion and it works fine. Bill's suggestion seem work if the WHERE criteria refers to primary key... right Bill? > -Original Message- > From: Cloves Carneiro Jr. [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 11, 2003 12:59 PM > To: Apache Torque Users List > Subject

Re: How to update multiple rows

2003-11-11 Thread Bill Leng
Without a primary key, I guess, you can not use the example to update. If the primary key contains multiple columns, you need to specify all of them. Hope this helps. Ramesh Sabeti wrote: I understand that. I can't explain how the example works. Looking at it, I'd say that both c.add(...) cal

RE: How to update multiple rows

2003-11-11 Thread Tulsi Das
If I´m not mistaken (haven´t used update much), the clauses that go in the WHERE part are those that take a SqlEnum argument so in your example, the code generates: UPDATE PRICE = 0, AUTHOR = 'ME' WHERE ID>100 please correct me if I´m wrong Tulsi --- "Cloves Carneiro Jr." <[EMAIL PROTECTED]>

RE: How to update multiple rows

2003-11-11 Thread Ramesh Sabeti
Ah, I see... what if the the selection criteria is not by book_id? E.g. Update book set book_price = 10 where book_price < 10 > -Original Message- > From: Bill Leng [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 11, 2003 12:55 PM > To: Apache Torque Users List > Subject: Re: How to

RE: How to update multiple rows

2003-11-11 Thread Ramesh Sabeti
I understand that. I can't explain how the example works. Looking at it, I'd say that both c.add(...) calls add the criteria to the WHERE clause. How do you interpret it? Criteria c = new Criteria(); c.add(BookPeer.BOOK_PRICE, 0); c.add(BookPeer.BOOK_ID, 100, Criteria.LESS_THAN); BasePeer.doUp

RE: How to update multiple rows

2003-11-11 Thread Cloves Carneiro Jr.
Hey I am also new to Torque and have a simple question. From what you described, using the book example, would the criteria objects for those two UPDATE statements be the same? UPDATE PRICE = 0, AUTHOR = 'ME' WHERE ID>100 and UPDATE PRICE = 0 WHERE AUTHOR = 'ME' AND ID > 100 Criteria c = new Cr

Re: How to update multiple rows

2003-11-11 Thread Bill Leng
that example assumes BOOK_ID is the primary key. Ramesh Sabeti wrote: I meant in the example provided by Bill. If you set the criteria as suggested, Torque would use it in the WHERE clause and not in the SET clause, right? -Original Message- From: Tulsi Das [mailto:[EMAIL PROTECTED] S

RE: How to update multiple rows

2003-11-11 Thread Tulsi Das
The criteria is just a hashtable extension to store all the mappings, later on, when calling the methods, the SQL generator knows where to insert them ( if you are lucky ;) ) tulsi --- Ramesh Sabeti <[EMAIL PROTECTED]> escribió: > I meant in the example provided by Bill. If you set the criteri

RE: How to update multiple rows

2003-11-11 Thread Ramesh Sabeti
I meant in the example provided by Bill. If you set the criteria as suggested, Torque would use it in the WHERE clause and not in the SET clause, right? > -Original Message- > From: Tulsi Das [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 11, 2003 12:45 PM > To: Apache Torque Users L

RE: How to update multiple rows

2003-11-11 Thread Tulsi Das
It doesn´t know untill you call doSelect() or doUpdate() or even doDelete() methods that´s why it´s only called "Criteria" regards Tulsi --- Ramesh Sabeti <[EMAIL PROTECTED]> escribió: > How does torque know that c.add(BookPeer.BOOK_PRICE, 0) is to SET a > value and not for comparison purpos

RE: How to update multiple rows

2003-11-11 Thread Ramesh Sabeti
How does torque know that c.add(BookPeer.BOOK_PRICE, 0) is to SET a value and not for comparison purposes? > -Original Message- > From: Bill Leng [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 11, 2003 6:18 AM > To: Apache Torque Users List > Subject: Re: How to update multiple rows >

RE: doSelect vs. doPSSelect

2003-11-11 Thread Ramesh Sabeti
Nice... I ended up doing a search/replace (which is not a good way of doing it). You solution is much cleaner... Thanks > -Original Message- > From: Howard Lin [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 11, 2003 8:36 AM > To: Apache Torque Users List > Subject: RE: doSelect vs.

RE: doSelect vs. doPSSelect

2003-11-11 Thread Howard Lin
What I did is: This seems working. Howard Lin > -Original Message- > From: Ramesh Sabeti [mailto:[EMAIL PROTECTED] > Sent: Sunday, November 09, 2003 10:02 PM > To: 'Apache Torque Users List' > Subject: doSelect vs. doPSSelect > > > I've been having a problem with Oracl

RE: How to update multiple rows

2003-11-11 Thread Ramesh Sabeti
Thanks. Torque's Java docs is rather brief... it defenitly has room for improvement. > -Original Message- > From: Amit Rana [mailto:[EMAIL PROTECTED] > Sent: Monday, November 10, 2003 10:18 PM > To: 'Apache Torque Users List' > Subject: RE: How to update multiple rows > > Peer classes

RE: How to update multiple rows

2003-11-11 Thread Ramesh Sabeti
That does it. Thanks a lot... > -Original Message- > From: Bill Leng [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 11, 2003 6:18 AM > To: Apache Torque Users List > Subject: Re: How to update multiple rows > > You can do something like this > Criteria c = new Criteria(); > c.add(

Re: How to update multiple rows

2003-11-11 Thread Bill Leng
You can do something like this Criteria c = new Criteria(); c.add(BookPeer.BOOK_PRICE, 0); c.add(BookPeer.BOOK_ID, 100, Criteria.LESS_THAN); BasePeer.doUpdate(c); Ramesh Sabeti wrote: I have a very simple question: How do you do something like this with Torque? Update book set book_price = 0 wher