[GRLUG] Client/Server Database app question

Chris Lamrock clamrock at nmtdie.com
Thu Jan 19 08:55:32 EST 2006


That *does* look easy...

I'm googling PHP now :-)

Thanks Zach!


----- Original Message ----- 
From: "zdennis" <zdennis at mktec.com>
To: "GRLUG general mailing list" <grlug at grandrapids-lug.org>
Sent: Thursday, January 19, 2006 8:52 AM
Subject: Re: [GRLUG] Client/Server Database app question


> Chris Lamrock wrote:
>> Right now the program is made up of 4 or 5 live databases.  One with 
>> quotes,
>> one with customers, notes, signatures and companies - all running in 
>> Foxpro
>> (since 1995!) :-)
>>
>> So the databases would be created new in Mysql or what have you...
>>
>> Is that what you were asking?
>>
>
> Yeah, I am thinking that I'd like to show you a neat database trick. Here 
> is what sample code looks
> like. I am a big fan of simplifying database access:
>
> Say you have a customers table in the databse and it has a relationship to 
> the signatures table.
>
> class Customer < ActiveRecord::Base
>   has_many :signatures
> end
>
> class Signature < ActiveRecord::Base
>   has_one :customer
> end
>
>
> That right there handles our relationship between Customer and Signature. 
> Do save data to the
> databse you'd write:
>
> customer = Customer.new
> customer.name = "Jon Doe'
> customer.company = 'ABC Corp.'
>
> signature = Signature.new
> customer.signature = signature
>
> customer.save
> signature.save
>
>
> And that's pretty much it. Of course it gets more advanced and you can get 
> crazy with complex joins
> and conditions on queries, but it makes accessing the databse 1000% nicer, 
> then using Perl::DBI or
> something similar.
>
> This may/may-not fix what you're going for, but I thought I'd throw it out 
> as a suggestion. The
> sample code above is from the ActiveRecord portion of Ruby On Rails. 
> Although you can use
> ActiveRecord by itself without Rails, I use it alot.
>
> Whatever you choose, good luck!
>
> Zach
>
> _______________________________________________
> grlug mailing list
> grlug at grandrapids-lug.org
> http://grlug.org/mailman/listinfo/grlug
>
> !DSPAM:43cfa62b58788274788315!
>
>
>
> 




More information about the grlug mailing list