FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Migrating to Harbour
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Migrating to Harbour
Posted: Fri Jan 09, 2015 06:30 PM

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.

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Migrating to Harbour
Posted: Fri Jan 09, 2015 06:35 PM

Thanks to all, my friends.

EMG

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Migrating to Harbour
Posted: Fri Jan 09, 2015 06:44 PM

James,

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

Enrico,

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

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Migrating to Harbour
Posted: Sat Jan 10, 2015 12:50 AM

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.

Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Migrating to Harbour
Posted: Sat Jan 10, 2015 01:02 AM

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.

Regards



G. N. Rao.

Hyderabad, India
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: Migrating to Harbour
Posted: Sat Jan 10, 2015 04:43 PM

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

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Migrating to Harbour
Posted: Sat Jan 10, 2015 08:23 PM
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.
Regards



G. N. Rao.

Hyderabad, India
Posts: 1303
Joined: Tue Jul 21, 2009 08:12 AM
Re: Migrating to Harbour
Posted: Sat Jan 10, 2015 08:46 PM

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.

Muchas gracias. Many thanks.



Un saludo, Best regards,



Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]



Implementando MSVC 2010, FWH64 y ADO.



Abandonando uso xHarbour y SQLRDD.
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Migrating to Harbour
Posted: Sun Jan 11, 2015 08:58 AM

+1 :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Migrating to Harbour
Posted: Sun Jan 11, 2015 02:37 PM
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
Posts: 1303
Joined: Tue Jul 21, 2009 08:12 AM
Re: Migrating to Harbour
Posted: Sun Jan 11, 2015 04:59 PM

I think posts also should be done in Harbour developers group. Otherwise they wont see this messages.

Thanks

Muchas gracias. Many thanks.



Un saludo, Best regards,



Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]



Implementando MSVC 2010, FWH64 y ADO.



Abandonando uso xHarbour y SQLRDD.
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: Migrating to Harbour
Posted: Wed Jan 14, 2015 12:27 PM
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.
FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Migrating to Harbour
Posted: Wed Jan 14, 2015 01:45 PM

Great! Antonio, can you give me the link to the new Harbour build so I can go on with my tests? :-)

EMG

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Migrating to Harbour
Posted: Thu Feb 05, 2015 05:33 AM
regards, saludos

Antonio Linares
www.fivetechsoft.com