On Friday, May 13, 2011 6:30:50 am John Fabiani wrote:
> On Thursday, May 12, 2011 01:21:42 pm K Peters wrote:
> > On Thu, May 12, 2011 at 12:00 PM, John Fabiani <[email protected]> wrote:
> > > Hi,
> > > 
> > > If I do something like the following a datatype is changed from date to
> > > string depending on the first record of the dataset.
> > > 
> > > fields:
> > > mustenrollby = date
> > > referral = date
> > > 
> > > first record
> > > mustenrollby = Null
> > > referral = '2011-04-10'::date
> > > 
> > > second record
> > > mustenrollby = '2011-04-24'::date
> > > referral = '2011-04-10'::date
> > > 
> > > aliasDict = {"bd":dsBalanceDue} # contains only 3 fields not
> > > mustenrollby
> > > 
> > >    dsNew = ds.execute("""select dataset.*, bd.course_cost as
> > > 
> > > bd_course_cost, bd.paid_amt as bd_paid_amt
> > > 
> > >        from dataset join bd on dataset.enrollid = bd.enrolleeid order
> > >        by
> > > 
> > > dataset.lname""", cursorDict=aliasDict)
> > > 
> > > after executing the above the data type for the second record -
> > > mustenrollby is now a string.
> > > 
> > > or u'2011-04-24'
> > > 
> > > If the first record contains a real date the change does not happen???
> > > 
> > > Johnf
> > > _______________________________________________
> > > Post Messages to: [email protected]
> > > Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
> > > Searchable Archives: http://leafe.com/archives/search/dabo-users
> > > This message:
> > > http://leafe.com/archives/byMID/[email protected]
> > 
> > John,
> > 
> > SQLite is *very* different from other SQL databases in that it uses
> > manifest typing
> > (see http://sqlite.org/different.html) which can cause the effects you
> > have been observing;
> > I would assume that Dabo takes whatever SQLite reports as data type
> > for fields and it goes from there.
> > 
> > Cheers,
> > Kai
> 
> From what I have been reading I would agree.  However, in this case the
> datatype actually changes.  And the fact that it changes is dependent on
> the contents of the first record in the dataset I'm working with.  If the
> first record contains a Null the Dabo routine returns a text (string) - if
> it's a date it returns dates.

By default Sqlite treats all fields as strings. The presence of a Null seems to 
invoke the default behavior.  You might want to give it a hint.
So something like:

first record
mustenrollby = Null ::date
referral = '2011-04-10'::date


> 
> This was completely unexpected and I believe it's a Dabo bug.  I'm not sure
> how to fix it but it needs fixing.
> 
> Johnf



-- 
Adrian Klaver
[email protected]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to