Migrating to Harbour

User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: Migrating to Harbour

Post 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.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Migrating to Harbour

Post by Antonio Linares »

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
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Migrating to Harbour

Post 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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Migrating to Harbour

Post 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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
Rick Lipkin
Posts: 2397
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Migrating to Harbour

Post 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
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Migrating to Harbour

Post 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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
lucasdebeltran
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am
Contact:

Re: Migrating to Harbour

Post 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.
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.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Migrating to Harbour

Post by Antonio Linares »

+1 :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Migrating to Harbour

Post by Enrico Maria Giordano »

I just read the various replies here:

https://groups.google.com/forum/#!topic ... rZFS5ePSnc

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

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

EMG
User avatar
lucasdebeltran
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am
Contact:

Re: Migrating to Harbour

Post by lucasdebeltran »

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.
hua
Posts: 861
Joined: Fri Oct 28, 2005 2:27 am

Re: Migrating to Harbour

Post 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.
FWH 11.08/FWH 19.03
xHarbour 1.2.1 (Rev 6406) + BCC
Harbour 3.1 (Rev 17062) + BCC
Harbour 3.2.0dev (r1904111533) + BCC
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Migrating to Harbour

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Migrating to Harbour

Post by Antonio Linares »

regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply