Help with libdbi code
Geert Janssens
geert.gnucash at kobaltwit.be
Sat May 7 06:57:37 EDT 2016
On Saturday 07 May 2016 11:22:05 Colin Law wrote:
> On 7 May 2016 at 10:09, Geert Janssens <geert.gnucash at kobaltwit.be> wrote:
> > ...
> > I'm not sure you need to do this when connecting to the mysql
> > database (not table) and before creating the new database. At that
> > point there is no data in the new database so there can't be any
> > NULL in a date field either.
> >
> > On the other hand it may be that you do have to do this if MySQL
> > already complains when writing the DB schema which I consider
> > unlikely (yet not impossible).
>
> I believe that it is necessary as the initial problem is encountered
> when creating the database as one of the date fields has a default
> value of zero. In fact I have not found a case where the no_zero_date
> option causes a problem other than when creating a new database, but
> I have not tried very hard.
I admit I wrote my previous suggestion without actually verifying it myself. You are right our
database sets 0 as default value for dates.
> I had wondered whether an alternative
> strategy of not providing a default value, but allowing the date to
> be null in the database instead was possible, but I gather that would
> involve significant work. In addition it would cause problems when
> upgrading gnucash as old databases would no longer be compatible.
>
After briefly looking into the code I agree with you. There doesn't seem to be a way to define
the default value when creating tables in our implementation (or I missed it in my cursory look).
So to avoid a big mess please go ahead with your plan and we can defer handling this properly
to 2.8 as part of the C++ rewrite (as John already suggested).
Thanks for looking into this by the way !
Geert
More information about the gnucash-devel
mailing list