Ed,
My 2 cents. What about a bizobj attribute that does something like...?
bizobj.backendDefaultFieldsIfEmpty = (fieldlist) where fieldlist is a list
of fields that if empty (i.e. None or blank) then the fields are excluded
from the insert statement.
for field in bizobj.backendDefaultFieldsIfEmpty:
if not bizobj.getFieldVal(field):
excude from insert statement
Larry
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of John
> Sent: Monday, November 30, 2009 11:57 AM
> To: [email protected]
> Subject: [dabo-dev] suggested change to new()
>
> moved from dabo-user - from a request by Jacek Kalucki who
> would like a way to prevent Dabo of passing a field value
> when inserting or updating a row. Not passing a field will
> allow the DB to apply the a default value.
>
> >Ed Wrote:
> I think that the way it should work for new, unsaved
> records is as
> follows:
>
> modified: used to determine isChanged(), and included in INSERT.
> default: not used to determine isChanged(), but included in INSERT.
> blanks: not used to determine isChanged(), and not included in INSERT
>
> Paul wrote:
> +1, but we need a better way to flag blanks. I propose
> defining a string
> +or
> class in dabo.db called DaboBlankField or
> "^^^DaboBlankField^^^". The cursor fills in the blanks with
> this value. The UI controls display the proper rendition of
> blank in the context of how the control works ("" for
> textbox, 0 for spinner, etc.)
>
>
>
> John wrote:
> What about list values - is it possible to have a
> "^^^DaboBlankField^^^"
> value for a list? I use lists for DB values all the time. I
> see this being very difficult to work with - the list has to
> have the value in the list that is in the DB.
>
> Ed's reply to John
>
> > To be blunt, you don't need to worry about it at all, just the way
> >that I'm sure you don't worry about the new record flag
> value. This is
> >why I said that the conversation should be on dabo-dev, not
> dabo-users.
>
> Ed please always be blunt - I may not be the brightest
> programmer but I'll work until the job is done. BTW it's
> only others that have said to lighten up on me - not me.
> Also I believe I can speak for Larry (who is gun shy these
> days) who wants your honest opinion too.
>
> Back to the question - but I do account for the new record.
> I always include , 0, and None in my list. If I don't the
> list control complains.
> What would be the value of the new key in the list using your
> suggestion.
>
> Johnf
>
>
>
>
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message:
http://leafe.com/archives/byMID/!~!uenerkvcmdkaaqacaaaaaaaaaaaaaaaaabgaaaaaaaaaafa2fnyupuomnfpiynbeqckaaaaqaaaafugpemkssu+e02brhcmt3geaa...@charter.net