Page 15 of 16

Re: Migrating to Harbour

PostPosted: Fri Jan 09, 2015 6:30 pm
by James Bott
Thanks Antonio.

I just posted my suggestion of using a flag to solve the problem on the Developer's forum. It seems to be the only practical solution.

Re: Migrating to Harbour

PostPosted: Fri Jan 09, 2015 6:35 pm
by Enrico Maria Giordano
Thanks to all, my friends.

EMG

Re: Migrating to Harbour

PostPosted: Fri Jan 09, 2015 6:44 pm
by Antonio Linares
James,

Yes, I saw your new post, thanks :-)

Enrico,

My pleasure to help you and all Harbour users :-)

Re: Migrating to Harbour

PostPosted: Sat Jan 10, 2015 12:50 am
by nageswaragunupudi
I just saw the discussions there. They think the change is requested only for Excel.
No.
All SQL databases expect assignment of NULL for empty dates, whether we use ADO or not,
So we need to convert empty dates as NULLs while assigning through ADO. In other words our OLE library has to convert empty dates as NULLs while assigning.

There was also mention about the limitation of excel about the lowest being 1900-01-01. This is the limitation of other Microsoft SQL databases also. Other SQL DBMS like Oracle, MySql all accept all dates.

Our request is not purely Excel centric as they are discussing.
Issue of dates lower than 1900-01-01 has to be handed by the programmer ( even using pure SQL ), We wanted only empty dates to be assigned as NULLs.

It appears to me that really serious ADO programmers are not still using Harbour.

Re: Migrating to Harbour

PostPosted: Sat Jan 10, 2015 1:02 am
by nageswaragunupudi
Mr EMG

Even assuming that Harbour provides the same functionality as that of xHarbour, we still may have to adopt some kind of conditional coding for assignment of Dates if we want our code to be generic ( not targeted to single DBMS only)

Example:
oRs:Fields( "SomeDate" ):Value := STOD( "17000101" )
This works for Oracle, MYSql and all non-Microsoft products.
But errors our for Microsoft products like Excel, MSSQL.

Out generic code needs to be something like this:

<ole/adoref>:Value := If( lMicrosoft .and. ValType( v ) $ "DT" .and Year( v ) < 1900, AdoNull(), v )
( and lMicrosoft is set to .t. for Excel, Access, MSSQL, etc)

There is a reason why I used AdoNull() but not NIL.
In case of MSSQL, assigning "nil" results in assigning 1899-12-30 ( numeric 0 in OLE dates)
So it is safer to use AdoNull() in all cases rather than NIL.

Re: Migrating to Harbour

PostPosted: Sat Jan 10, 2015 4:43 pm
by Rick Lipkin
Here is the thread from the xHarbour group that I raised several years ago and the ADO fix for ctod("") writing null to Sql Server .. the same modifications may be able to be ported to Harbour.

https://groups.google.com/forum/?fromgr ... NneK8sbdgJ

Rick Lipkin

Re: Migrating to Harbour

PostPosted: Sat Jan 10, 2015 8:23 pm
by nageswaragunupudi
Rick Lipkin wrote:Here is the thread from the xHarbour group that I raised several years ago and the ADO fix for ctod("") writing null to Sql Server .. the same modifications may be able to be ported to Harbour.

https://groups.google.com/forum/?fromgr ... NneK8sbdgJ

Rick Lipkin

If at all the Harbour team agrees to modify.

Re: Migrating to Harbour

PostPosted: Sat Jan 10, 2015 8:46 pm
by lucasdebeltran
Dear Mr. Nages,

In my opinion, it is very important that you post your previous responses to the Harbour DeveloperĀ“s Group.

They will have another very qualified experience from your high profile.

Thank you.

Re: Migrating to Harbour

PostPosted: Sun Jan 11, 2015 8:58 am
by Antonio Linares
+1 :-)

Re: Migrating to Harbour

PostPosted: Sun Jan 11, 2015 2:37 pm
by Enrico Maria Giordano
I just read the various replies here:

https://groups.google.com/forum/#!topic/harbour-devel/IrZFS5ePSnc

I wonder how can we use a compiler managed by such developers...

For the sake of truth, Przemek at least offered a solution...

EMG

Re: Migrating to Harbour

PostPosted: Sun Jan 11, 2015 4:59 pm
by lucasdebeltran
I think posts also should be done in Harbour developers group. Otherwise they wont see this messages.

Thanks

Re: Migrating to Harbour

PostPosted: Wed Jan 14, 2015 12:27 pm
by hua
https://github.com/harbour/core/commit/ ... 0c94607f8f

2015-01-14 13:00 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* contrib/hbwin/olecore.c
+ added new PRG function to control empty date conversion to OLE variant:
__oleVariantNullDate( [<lNewNullFlag>] ) -> <lPrevNullFlag>
This is per thread switch and by default initialized to .F. for each
new thread. When set to .T. Harbour empty dates are translated to
VT_NULL.
Warning: it's possible that this function will be removed or replaced
by other solution in the future.

Re: Migrating to Harbour

PostPosted: Wed Jan 14, 2015 1:45 pm
by Enrico Maria Giordano
Great! Antonio, can you give me the link to the new Harbour build so I can go on with my tests? :-)

EMG

Re: Migrating to Harbour

PostPosted: Wed Feb 04, 2015 9:07 pm
by Enrico Maria Giordano
Up! :-)

EMG

Re: Migrating to Harbour

PostPosted: Thu Feb 05, 2015 5:33 am
by Antonio Linares