Part of the EllisLab Network
   
2 of 4
2
ORM - Object Relational Mapper library | pending major updates
Posted: 08 May 2007 01:27 PM   [ Ignore ]   [ # 11 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1163
Joined  08-06-2006
Shadowhand - 08 May 2007 12:05 PM

It’s completely unfair to people that build commercial web applications to license under GPL, because we can never edit your code or write commercial applications based on it.

Shadowhand,

Please don’t flame me… I’m trying to learn by asking questions. I don’t have much experience in the free software area as I mostly work on personal stuff and don’t repurpose code for reselling.

Does GPL mean that a person working in any profit-making company literally cannot “edit” code?
Does GPL actually forbid a commercial programmer to edit, use, and include code?
I thought the point of GPL was that any changes to the code must also be released with the GPL license.

If I understand, the right to use the GPL software just means you have to keep your source open and your changes GPL’d as well. I guess it depends on the company policy how it wants to handle GPL. It sounds like the company you work for has an active policy forbidding the use of GPL’d software?

 Signature 

imap_pop get email | site_migrate port sites | OOCalendar | PhotoBox2 gallery | CI/EE 2 word_limiter, yep, wrote it

Profile
 
 
Posted: 08 May 2007 01:42 PM   [ Ignore ]   [ # 12 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  351
Joined  07-25-2006

Under true GPL, I cannot edit the ORM library *and* sell the website without releasing the whole website under GPL[1]. Under LGPL, I would have to release my changes back to the public, then I would be allowed to sell the website (I just can’t sell it before releasing those changes). Under a BSD or MIT license, I would be able to make whatever changes I want, and wouldn’t be required to release them to the public. GPL, LGPL, and BSD/MIT all require the copyrights to be retained.

In other words, I can’t write code based on, or edit code directly related to ORM without releasing said code under GPL. With LGPL (and BSD/MIT, etc), the ORM library would be treated a singular entity, allowing me to do whatever I want with ORM, so long as I release changes I make to ORM back to the public (BSD doesn’t require this step, (L)GPL does).

To lay it down simply:

GPL: every piece of code that is based off it[1], must be GPL licensed, and as such, I must release all of that code publicly.
LGPL: I only need to worry about Orm.php, and I must release my changes back to the public.
BSD/MIT: I must retain the copyright, but can do whatever I want with Orm.php, no changes have to be publicly released.

I really thing you should use LGPL. I know LGPL will keep Orm.php as public code, keep it protected, and won’t make me lose any sleep. smile

[1]: It’s possible my understanding of the GPL is flawed here. [3]
[2]: There is fine line between “implementation” and “derivative” work, especially in regards to libraries, modules, etc.
[3]: EDIT: It seems that my guess about the whole website being released as GPL was correct:

The GNU Project has two principal licenses to use for libraries. One is the GNU Library GPL; the other is the ordinary GNU GPL. The choice of license makes a big difference: using the Library GPL permits use of the library in proprietary programs; using the ordinary GPL for a library makes it available only for free programs.

Taken from the autotool manual.

Judging by that, it makes it impossible for me to use Orm.php for a proprietary, commercial project.

 Signature 

me and some random code, hosted by dh. and a blog too! ++ dead bugs

Profile
 
 
Posted: 08 May 2007 08:41 PM   [ Ignore ]   [ # 13 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  110
Joined  09-17-2004

Hi Shadowhand,

Great posts. smile

I’ve actually thought of releasing my library under the new BSD license, I went for GPL so that open source developers can have the advantage. smile I’ll think about this once again since you brought it up now, I will possibly release the code under dual license (GPL and new BSD, or even LGPL and new BSD).

Cheers

 Signature 

Fred Wu
Founder of Wuit.com | Web Developer at Envato
My blog: fredwu.me | Follow me @fredwu

Profile
 
 
Posted: 08 May 2007 08:52 PM   [ Ignore ]   [ # 14 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  351
Joined  07-25-2006

If you want to keep it under GPL, just switch to LGPL so that the people that want to use this for commercial purposes can. smile Thanks!

 Signature 

me and some random code, hosted by dh. and a blog too! ++ dead bugs

Profile
 
 
Posted: 09 May 2007 04:50 AM   [ Ignore ]   [ # 15 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  110
Joined  09-17-2004

UPDATE:

License changed to LGPL, hope that will benefit some people. smile

 Signature 

Fred Wu
Founder of Wuit.com | Web Developer at Envato
My blog: fredwu.me | Follow me @fredwu

Profile
 
 
Posted: 09 May 2007 05:52 PM   [ Ignore ]   [ # 16 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  351
Joined  07-25-2006

Many thanks Canglan!

 Signature 

me and some random code, hosted by dh. and a blog too! ++ dead bugs

Profile
 
 
Posted: 11 May 2007 05:03 AM   [ Ignore ]   [ # 17 ]  
Summer Student
Total Posts:  20
Joined  09-21-2006

Hi, Canglan,

Once again, thank you for this library, I use it a lot!

Can you tell me please how can I add some other stuff to orm requests? Like ORDER BY, ASC/DESC etc. It’s logic, it will be ordered by the field passed in request, but can I do smth like “select id,name,date order by date desc,null,1,$recursion”?

On the other hand, can I paginate the results or just send some vars to a pagination function?


Thank you and keep up.

Profile
 
 
Posted: 11 May 2007 05:21 AM   [ Ignore ]   [ # 18 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  110
Joined  09-17-2004
CI stefanm - 11 May 2007 05:03 AM

Once again, thank you for this library, I use it a lot!

My pleasure!

CI stefanm - 11 May 2007 05:03 AM

Can you tell me please how can I add some other stuff to orm requests? Like ORDER BY, ASC etc.

You can call CI’s active record methods before calling ORM methods. The only difference is instead of $this->db->methodname(), you use $this->orm->methodname(). smile

For example:

$this->orm->orderby('post_title', 'DESC');
$this->orm->findTitle('posts');

CI stefanm - 11 May 2007 05:03 AM

On the other hand, can I paginate the results or just send some vars to a pagination function?

Yes you can paginate the results.

The method definition of find is:

find($table, $limit = null, $page = 1, $recursion = null)

$table is the name of the table obviously.

$limit is the number of results you want to show per page.

$page is the page number.

$recursion is the level of recursion (how many child level of associations).

$limit and $page are the ones you want to set in this case.

Hope this helps.

P.S. Have you worked out the weird character issue you were having? If so what was the cause and how did you solve it?

 Signature 

Fred Wu
Founder of Wuit.com | Web Developer at Envato
My blog: fredwu.me | Follow me @fredwu

Profile
 
 
Posted: 11 May 2007 05:31 AM   [ Ignore ]   [ # 19 ]  
Summer Student
Total Posts:  20
Joined  09-21-2006

Thank you, Canglan,

Yes, I had a hell of a time playing with encodings.
On my production server, a FreeBSD, PHP was set with defaultcharset = iso-8859-2 and everything was OK for the main website using Postgresql with a latin1 database.

The other web app is using mySQL and, like the main app, is full of non standard characters (for Romanian language).

If I set Apache, PHP and mySQL to use UTF-8 encoding, the main website gets broken (I no longer see special chars).

In the end, I did like this:
- Apache and PHP with no default charset
- main app (with Postgresql latin1 charset db) and iso-8859-2 in page header
- second app (CI) (mySQL db, with default encoding UTF-8 in /etc/my.cnf, database, tables, fields all declared as UTF-8 and utf-8 in views (in page header).

Profile
 
 
Posted: 12 May 2007 12:12 PM   [ Ignore ]   [ # 20 ]  
Summer Student
Total Posts:  20
Joined  09-21-2006

Hello,

Another question about ORM smile

Can I select partial data? Example:

I have some products, I select one product with product_id = $this->uri->segment(2, 0) (simple as 1-2-3).
Each product has several pictures, some small, some large.

Can I select this (or several, or all) product/products and add to the array only large (or small) pictures?
The infos about pictures are stored in a separate table, called pictures, table that has a product_id field (as described in docs).

Or let me put it in another way:
I have a summary for a product and I have to show only first small picture from all pictures that are related to this product.

Thank you.


And some (much) later edit: Any clue on how can I generate pagination links? Is this related to ORM library or I have to take a closer look to CI pagination class?

Profile
 
 
   
2 of 4
2
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 819, on March 11, 2010 11:15 AM
Total Registered Members: 120514 Total Logged-in Users: 34
Total Topics: 126586 Total Anonymous Users: 5
Total Replies: 665479 Total Guests: 371
Total Posts: 792065    
Members ( View Memberlist )
Newest Members:  harry29512sarah123CasERispukgendaleOptimizaiofficeiEclipsekinkadebbbBenAbrams