Lafcadio: An object-relational mapping layer for Ruby

Ask a Question related to Ruby, Design and Development.

  1. #1

    Default Lafcadio: An object-relational mapping layer for Ruby

    Hi everybody,

    I've just released Lafcadio, an object-relational mapping layer for
    Ruby and MySQL, as an alpha release. So far this code hasn't been used
    by anybody else, but it's currently in use on three live sites --
    including one pretty high-traffic site -- not to mention that I've
    used it over the past year on a number of personal projects.

    Again, it's in alpha, so I don't expect anybody to put their payroll
    system on it right now. But if there's anybody out there who's
    interested in this sort of thing, and would like to help me out with
    it -- either just testing it or coding or just telling me where my
    docs could be clearer -- I'd appreciate your input.

    [url]http://lafcadio.sourceforge.net[/url]

    Francis
    Francis Hwang Guest

  2. Similar Questions and Discussions

    1. Object Layer Comp Options
      Can I turn on and off picture layers if the photo has not had layers applied or built in Photoshop?
    2. Object Relational, Foreign Keys and Triggers
      I am facing the classic pgsql ORDBMS problem: create sequence entity_id_seq; create table entity ( entity_id int not null default...
    3. Mapping artwork to a 3D object!!!
      When mapping artwork to a 3D object like type with a couple of outlined strokes and you click ok, When viewing it the strokes don't line up with the...
    4. Move and resize object in layer
      I have a round ball on a layer by itself and I want to make the ball smaller and then move it in relation to an object in another layer. I must be...
    5. Guidelines for using Oracle 9i Object Relational Features
      "S.T.Arun" wrote: I would stay as far away from OO in the database as you can. OO databases, as can be clearly seen by their...
  3. #2

    Default Re: Lafcadio: An object-relational mapping layer for Ruby

    Database independence, to my mind, is a useful goal but not the main
    point of an object-relational mapping layer. For me, the main point is
    reducing the need to keep small database-details in mind, and treat
    domain entities like they're first-class Ruby objects, with as little
    thinking about the underlying DB as possible.

    Example 1: You have a Invoice class (or table) with an invoiceDate
    field. Lafcadio code to manipulate this date might look like:

    myInvoice = objectStore.getInvoice invoiceNum
    myInvoice = Date.today
    objectStore.commit myInvoice

    .... so you don't have to think about SQL date formatting. Similarly,
    string fields don't have to be quote-escaped for commits.

    Example 2: Your Invoice table has two boolean fields: "shipped" stores
    values in MySQL as 0 and 1, while "viewed" stores values as "Y" and
    "N". This is far from ideal, of course, but unfortunately I've seen
    far worse code in my career. And let's say you can't change these
    fields easily because they're accessed in an indeterminate number of
    PHP scripts. (Also common, unfortunately.) Committing straight through
    DBI would require you to always remember which field uses which
    enumeration, but by setting your field definitions in Lafcadio code
    you'd never have to think about it again. You could simply set them to
    be true or false:

    myInvoice.viewed = true
    myInvoice.shipped = false
    objectStore.commit myInvoice

    .... and when the objectStore does the committing it will figure out
    what values to enter into what fields.

    Francis

    Brian McCallister <mccallister@forthillcompany.com> wrote in message news:<8B2BF50C-C5CE-11D7-86DC-000A95782782@forthillcompany.com>...
    > I have noticed this, and Vapor (for PostgreSQL) being advertised. Is
    > there difficulty in building against the DBI module to allow some
    > degree of database independence?
    >
    > -Brian
    >
    > On Sunday, August 3, 2003, at 08:45 AM, Francis Hwang wrote:
    >
    > > Hi everybody,
    > >
    > > I've just released Lafcadio, an object-relational mapping layer for
    > > Ruby and MySQL, as an alpha release. So far this code hasn't been used
    > > by anybody else, but it's currently in use on three live sites --
    > > including one pretty high-traffic site -- not to mention that I've
    > > used it over the past year on a number of personal projects.
    > >
    > > Again, it's in alpha, so I don't expect anybody to put their payroll
    > > system on it right now. But if there's anybody out there who's
    > > interested in this sort of thing, and would like to help me out with
    > > it -- either just testing it or coding or just telling me where my
    > > docs could be clearer -- I'd appreciate your input.
    > >
    > > [url]http://lafcadio.sourceforge.net[/url]
    > >
    > > Francis
    > >
    Francis Hwang Guest

  4. #3

    Default Re: Lafcadio: An object-relational mapping layer for Ruby

    Andreas:

    If this is to become reusable across a number of different DBs (like
    PostgresSQL) then I suppose that's a necessary step. That step should
    be fairly easy, since the database calls are limited to just a few
    methods.

    The main difficulty in such an adaptation would be differences in SQL;
    without having used PostgresSQL a lot I'd imagine there would be a few
    key differences that would require adaptation.

    Or is there another reason you're bringing up DBI?

    Francis

    Andreas Schwarz <usenet@andreas-s.net> wrote in message news:<slrnbirak2.bim.usenet@home.andreas-s.net>...
    > Francis Hwang wrote:
    > > I've just released Lafcadio, an object-relational mapping layer for
    > > Ruby and MySQL, as an alpha release. So far this code hasn't been used
    > > by anybody else, but it's currently in use on three live sites --
    > > including one pretty high-traffic site -- not to mention that I've
    > > used it over the past year on a number of personal projects.
    >
    > This looks interesting, but IMO it would be far more useful if you would
    > use DBI instead of direct mysql access.
    >
    > Andreas
    Francis Hwang Guest

  5. #4

    Default Re: Lafcadio: An object-relational mapping layer for Ruby

    Hi!

    ATM i'm making project that will help one to quickly have site with news
    system, forum, guestbook, etc. May i include your code into the package?
    I want to use it widely through all of my code. It will be released as LGPL.

    P.S. I'm now trying to make test-suites run without errors on 1.8, it have a
    lot of "meth (bla)" code, that sometimes raises syntax errors.
    --
    sdmitry -=- Dmitry V. Sabanin
    MuraveyLabs.


    Dmitry V. Sabanin Guest

  6. #5

    Default Re: Lafcadio: An object-relational mapping layer for Ruby

    "Dmitry V. Sabanin" <sdmitry@lrn.ru> wrote in message news:<200308041940.23854.sdmitry@lrn.ru>...
    > Hi!
    >
    > ATM i'm making project that will help one to quickly have site with news
    > system, forum, guestbook, etc. May i include your code into the package?
    > I want to use it widely through all of my code. It will be released as LGPL.
    Perhaps things would be clearer for people using your package if you
    simply listed Lafcadio as a requirement, and pointed them to where it
    can be downloaded. Being in alpha, Lafcadio might be a bit of a moving
    target in the short term, so it might be a bit of a hassle for you to
    constantly incorporate new changes.
    >
    > P.S. I'm now trying to make test-suites run without errors on 1.8, it have a
    > lot of "meth (bla)" code, that sometimes raises syntax errors.
    Oop! Been doing a lot more testing in 1.6.8 than in 1.8. I'll get on
    that right away, thanks.

    Francis
    Francis Hwang Guest

  7. #6

    Default Re: Lafcadio: An object-relational mapping layer for Ruby

    On Tuesday 05 August 2003 10:18, Francis Hwang wrote:
    > "Dmitry V. Sabanin" <sdmitry@lrn.ru> wrote in message
    > news:<200308041940.23854.sdmitry@lrn.ru>...
    >
    > > Hi!
    > >
    > > ATM i'm making project that will help one to quickly have site with news
    > > system, forum, guestbook, etc. May i include your code into the package?
    > > I want to use it widely through all of my code. It will be released as
    > > LGPL.
    >
    > Perhaps things would be clearer for people using your package if you
    > simply listed Lafcadio as a requirement, and pointed them to where it
    > can be downloaded. Being in alpha, Lafcadio might be a bit of a moving
    > target in the short term, so it might be a bit of a hassle for you to
    > constantly incorporate new changes.
    I placed it in the redist directory, and probably, i'll write it in my INSTALL
    file, that user will be able to use another version of lafcadio. I just want
    to have as little dependencies, as it is possible, to make everything working
    out of box. But maybe i'm wrong, i have to think about this some time.
    > > P.S. I'm now trying to make test-suites run without errors on 1.8, it
    > > have a lot of "meth (bla)" code, that sometimes raises syntax errors.
    >
    > Oop! Been doing a lot more testing in 1.6.8 than in 1.8. I'll get on
    > that right away, thanks.
    No problems, if you want i could mail you (or give you data for accessing CVS)
    that have a lots of code fixed already.
    Btw, big thank you for a good library! :)
    > Francis
    --
    sdmitry -=- Dmitry V. Sabanin
    MuraveyLabs.


    Dmitry V. Sabanin Guest

  8. #7

    Default Re: Lafcadio: An object-relational mapping layer for Ruby

    "Dmitry V. Sabanin" <sdmitry@lrn.ru> wrote in message news:<200308052158.01542.sdmitry@lrn.ru>...
    > On Tuesday 05 August 2003 10:18, Francis Hwang wrote:
    > > Perhaps things would be clearer for people using your package if you
    > > simply listed Lafcadio as a requirement, and pointed them to where it
    > > can be downloaded. Being in alpha, Lafcadio might be a bit of a moving
    > > target in the short term, so it might be a bit of a hassle for you to
    > > constantly incorporate new changes.
    >
    > I placed it in the redist directory, and probably, i'll write it in my INSTALL
    > file, that user will be able to use another version of lafcadio. I just want
    > to have as little dependencies, as it is possible, to make everything working
    > out of box. But maybe i'm wrong, i have to think about this some time.
    That might work, too. Feel free to try out whatever you think will
    work for your project. BTW, Lafcadio is LGPL, too.
    > > > P.S. I'm now trying to make test-suites run without errors on 1.8, it
    > > > have a lot of "meth (bla)" code, that sometimes raises syntax errors.
    > >
    > > Oop! Been doing a lot more testing in 1.6.8 than in 1.8. I'll get on
    > > that right away, thanks.
    >
    > No problems, if you want i could mail you (or give you data for accessing CVS)
    > that have a lots of code fixed already.
    I went ahead and fixed all the syntax errors (mostly adding a lot of
    parenthesis) and all the tests run fine as of the last CVS checkin,
    but you have to suppress warnings or else the output's pretty messy.
    I'm planning on fixing all the warnings in the next day or so.

    If you want to email me code that fixes warnings, that'd be great.
    Otherwise I can just handle it on my own, too.
    > Btw, big thank you for a good library! :)
    You're welcome!
    Francis Hwang Guest

  9. #8

    Default Re: Lafcadio: An object-relational mapping layer for Ruby

    Today's release (0.1.2) runs fine in Ruby 1.8.0 without any warnings.

    Francis
    Francis Hwang Guest

  10. #9

    Default Re: Lafcadio: An object-relational mapping layer for Ruby

    "Dmitry V. Sabanin" <sdmitry@lrn.ru> wrote in message news:<200308072315.45074.sdmitry@lrn.ru>...
    > On Thursday 07 August 2003 23:05, Francis Hwang wrote:
    > > Today's release (0.1.2) runs fine in Ruby 1.8.0 without any warnings.
    > Thanx, sorry for being idle for a while..
    > Question, do you make changes to CVS often? Or i can just get the tar-ball?
    > > Francis
    At this moment I'm not making a lot of drastic changes, so you can
    probably just get the tar-ball.
    Francis Hwang Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139