[flexcoders] Re: Have a question about Weborb

2008-09-29 Thread timgerr
Do I have to set that or does that come from the script generated weborb?

timgerr

--- In flexcoders@yahoogroups.com, Igor Costa [EMAIL PROTECTED] wrote:

 You do as same as you do to add, but the only diffrent is on the
server-side
 instead of INSERT INTO you should do UPDATE
 
 
 Regards
 
 
 On Sun, Sep 28, 2008 at 11:59 PM, timgerr [EMAIL PROTECTED] wrote:
 
Hello all,
  I am trying to learn Weborb and need some help on how to update a
  database record.
 
  Here is my question, I have a database table named test and the
  construction of one row is:
  id = 1
  name = Tim
  email = [EMAIL PROTECTED] tim%40tim.com
 
  Now if I wanted to return all the rows it would be
  ActiveRecord.test.findall().
 
  If I wanted to add a record it would be:
  private var t:Test = new Test();
  t.Name = 'bob';
  t.Email = '[EMAIL PROTECTED] %27bob%40bob.com';
  var asyncToken:AsyncToken = null;
  asyncToken = t.save();
 
  The problem that I have is I dont understand how to update a record,
  take my row 1
  id = 1
  name = Tim
  email = [EMAIL PROTECTED] tim%40tim.com
 
  How can I change that row to somting like this
  id = 1
  name = Timmy
  email = [EMAIL PROTECTED] timmy%40timmy.com
 
  Can some one show me the code?
 
  Thanks for the help,
  timgerr
 
   
 
 
 
 
 -- 
 
 Igor Costa
 www.igorcosta.com
 www.igorcosta.org





Re: [flexcoders] Re: Have a question about Weborb

2008-09-29 Thread Igor Costa
I guess there's something on the code. take look at the sql instrict methods
to see if there's something like UPDATE

Regards
Igor

On Mon, Sep 29, 2008 at 11:33 AM, timgerr [EMAIL PROTECTED] wrote:

   Do I have to set that or does that come from the script generated
 weborb?

 timgerr


 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Igor
 Costa [EMAIL PROTECTED] wrote:
 
  You do as same as you do to add, but the only diffrent is on the
 server-side
  instead of INSERT INTO you should do UPDATE
 
 
  Regards
 
 
  On Sun, Sep 28, 2008 at 11:59 PM, timgerr [EMAIL PROTECTED] wrote:
 
   Hello all,
   I am trying to learn Weborb and need some help on how to update a
   database record.
  
   Here is my question, I have a database table named test and the
   construction of one row is:
   id = 1
   name = Tim
   email = [EMAIL PROTECTED] tim%40tim.com
  
   Now if I wanted to return all the rows it would be
   ActiveRecord.test.findall().
  
   If I wanted to add a record it would be:
   private var t:Test = new Test();
   t.Name = 'bob';
   t.Email = '[EMAIL PROTECTED] %27bob%40bob.com';
   var asyncToken:AsyncToken = null;
   asyncToken = t.save();
  
   The problem that I have is I dont understand how to update a record,
   take my row 1
   id = 1
   name = Tim
   email = [EMAIL PROTECTED] tim%40tim.com
  
   How can I change that row to somting like this
   id = 1
   name = Timmy
   email = [EMAIL PROTECTED] timmy%40timmy.com
  
   Can some one show me the code?
  
   Thanks for the help,
   timgerr
  
  
  
 
 
 
  --
  
  Igor Costa
  www.igorcosta.com
  www.igorcosta.org
 

  




-- 

Igor Costa
www.igorcosta.com
www.igorcosta.org


[flexcoders] Re: Have a question about Weborb

2008-09-29 Thread timgerr
Thanks for the help Igor.  I am not sure what you mean.  I see in the
documentation that save is insert or update information:

save()  method   
public function save(cascade:Boolean = true, responder:Responder =
null):AsyncToken

Saves new or updates existing ActiveRecord. The method sends a request
to the remote data source. New ActiveRecord instance is added to the
data store, existing record is updated with all the new values in the
record properties. Calling save() on an instance of ActiveRecord is
equivalent to calling save() on the data mapper associated with this
ActiveRecord.
Parameters
cascade:Boolean (default = true) — indicates if the save operation
should do deep traversal over all related records. If true, save
performs deep traversal, otherwise, only direct properties of the
ActiveRecord are saved in the data store.
 
responder:Responder (default = null) — a responder object to receive
success/failure callbacks when the save operation is complete.

Returns
AsyncToken — AsyncToken returned from the underlying remote invocation 

I am not sure how to set this up for an update.  When doing a SQL
update I do somting like:
Update some_table 
set This = That 
where id = #

How do I specify what table to update when invoking the save() method
in flex?

Thanks for the help, 
timgerr

--- In flexcoders@yahoogroups.com, Igor Costa [EMAIL PROTECTED] wrote:

 I guess there's something on the code. take look at the sql instrict
methods
 to see if there's something like UPDATE
 
 Regards
 Igor
 




[flexcoders] Re: Have a question about Weborb

2008-09-29 Thread Mark Piller
Hi Tim,

For any instance of Active Record on the client side you can change
the properties and then call save() on that instance. It will update
the record in the database and also issue client synchronization event
so other clients that have the same record would be updated. Instances
of active record are loaded with any of the findXXX methods.

Hope this helps.

Mark

--- In flexcoders@yahoogroups.com, timgerr [EMAIL PROTECTED] wrote:

 Hello all,
 I am trying to learn Weborb and need some help on how to update a
 database record.
 
 Here is my question, I have a database table named test and the
 construction of one row is:
 id = 1
 name = Tim
 email = [EMAIL PROTECTED]
 
 Now if I wanted to return all the rows it would be
 ActiveRecord.test.findall().
 
 If I wanted to add a record it would be:
 private var t:Test = new Test();
 t.Name = 'bob';
 t.Email = '[EMAIL PROTECTED]';
 var asyncToken:AsyncToken = null;
 asyncToken = t.save();
 
 The problem that I have is I dont understand how to update a record,
 take my row 1
 id = 1
 name = Tim
 email = [EMAIL PROTECTED]
 
 How can I change that row to somting like this
 id = 1
 name = Timmy
 email = [EMAIL PROTECTED]
 
 Can some one show me the code?
 
 Thanks for the help,
 timgerr





[flexcoders] Re: Have a question about Weborb

2008-09-29 Thread timgerr
Mark, Thanks for the reply, I am getting closer to learning how to do
an update.

I am good at looking at code so here is what I am doing.  I want to
call a database row using findby and ad that information into an array
collection:
private var _master:ArrayCollection = new ArrayCollection(); 
_master = ActiveRecords.Test.findByIdAndName('6','tessa').isLoaded;

so now master[0] has Id, Email, Name
so if I wanted to change the email from [EMAIL PROTECTED] to
[EMAIL PROTECTED], I do this?

private var uDate:Test = new Test();
uDate.Name = 'tessa';
uDate.Id   = '6';
udate.Email = '[EMAIL PROTECTED]';

var asyncToken:AsyncToken = null;
asyncToken = uDate.save();

How does webord know the difference between an updated and new record?

Thanks for the help,
timgerr



--- In flexcoders@yahoogroups.com, Mark Piller [EMAIL PROTECTED] wrote:

 Hi Tim,
 
 For any instance of Active Record on the client side you can change
 the properties and then call save() on that instance. It will update
 the record in the database and also issue client synchronization event
 so other clients that have the same record would be updated. Instances
 of active record are loaded with any of the findXXX methods.
 
 Hope this helps.
 
 Mark
 




[flexcoders] Re: Have a question about Weborb

2008-09-29 Thread timgerr
Let me make this a little more clear:
I am good at looking at code so here is what I am doing.  I want to
call a database row using findby and ad that information into an array
collection:
private var _master:ArrayCollection = new ArrayCollection(); 
_master = ActiveRecords.Test.findByIdAndName('6','tessa');

so now master[0] has Id, Email, Name
 so if I wanted to change the name from tessa to
tess, not sure what to do.

Thanks for the read.
timgerr


--- In flexcoders@yahoogroups.com, timgerr [EMAIL PROTECTED] wrote:

 Mark, Thanks for the reply, I am getting closer to learning how to do
 an update.
 
 I am good at looking at code so here is what I am doing.  I want to
 call a database row using findby and ad that information into an array
 collection:
 private var _master:ArrayCollection = new ArrayCollection(); 
 _master = ActiveRecords.Test.findByIdAndName('6','tessa');
 
 so now master[0] has Id, Email, Name
 so if I wanted to change the email from [EMAIL PROTECTED] to
 [EMAIL PROTECTED], I do this?
 
 private var uDate:Test = new Test();
 uDate.Name = 'tessa';
 uDate.Id   = '6';
 udate.Email = '[EMAIL PROTECTED]';
 
 var asyncToken:AsyncToken = null;
 asyncToken = uDate.save();
 
 How does webord know the difference between an updated and new record?
 
 Thanks for the help,
 timgerr
 
 
 
 --- In flexcoders@yahoogroups.com, Mark Piller mark@ wrote:
 
  Hi Tim,
  
  For any instance of Active Record on the client side you can change
  the properties and then call save() on that instance. It will update
  the record in the database and also issue client synchronization event
  so other clients that have the same record would be updated. Instances
  of active record are loaded with any of the findXXX methods.
  
  Hope this helps.
  
  Mark
 





[flexcoders] Re: Have a question about Weborb

2008-09-28 Thread timgerr
Can changes to the active record only be done on the datastore?

Thanks,
timgerr

--- In flexcoders@yahoogroups.com, timgerr [EMAIL PROTECTED] wrote:

 Hello all,
 I am trying to learn Weborb and need some help on how to update a
 database record.
 
 Here is my question, I have a database table named test and the
 construction of one row is:
 id = 1
 name = Tim
 email = [EMAIL PROTECTED]
 
 Now if I wanted to return all the rows it would be
 ActiveRecord.test.findall().
 
 If I wanted to add a record it would be:
 private var t:Test = new Test();
 t.Name = 'bob';
 t.Email = '[EMAIL PROTECTED]';
 var asyncToken:AsyncToken = null;
 asyncToken = t.save();
 
 The problem that I have is I dont understand how to update a record,
 take my row 1
 id = 1
 name = Tim
 email = [EMAIL PROTECTED]
 
 How can I change that row to somting like this
 id = 1
 name = Timmy
 email = [EMAIL PROTECTED]
 
 Can some one show me the code?
 
 Thanks for the help,
 timgerr