FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour ADO RDD xHarbour
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: ADO RDD xHarbour
Posted: Fri Mar 27, 2015 10:18 PM

Antonio,

UR_FIELDINFO ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Re: ADO RDD xHarbour
Posted: Sat Mar 28, 2015 07:48 AM

Antonio,

Thanks its solved.

I need this hb_SToD() What does it do and were can I find it?

Can you post the source?

Regards

Antonio H Ferreira
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Re: ADO RDD xHarbour
Posted: Sat Mar 28, 2015 07:53 AM
Antonio,

Antonio Linares wrote:Antonio,

Yes, you can only return the types that Harbour supports.


Are these all the types supported by (x)Harbour?

Code (fw): Select all Collapse
/* FIELD types */
#ifndef HB_FT_NONE
#define HB_FT_NONE            0
#define HB_FT_STRING          1     /* "C" */
#define HB_FT_LOGICAL         2     /* "L" */
#define HB_FT_DATE            3     /* "D" */
#define HB_FT_LONG            4     /* "N" */
#define HB_FT_FLOAT           5     /* "F" */
#define HB_FT_INTEGER         6     /* "I" */
#define HB_FT_DOUBLE          7     /* "B" */
#define HB_FT_TIME            8     /* "T" */
#define HB_FT_TIMESTAMP       9     /* "@" */
#define HB_FT_MODTIME         10    /* "=" */
#define HB_FT_ROWVER          11    /* "^" */
#define HB_FT_AUTOINC         12    /* "+" */
#define HB_FT_CURRENCY        13    /* "Y" */
#define HB_FT_CURDOUBLE       14    /* "Z" */
#define HB_FT_VARLENGTH       15    /* "Q" */
#define HB_FT_MEMO            16    /* "M" */
#define HB_FT_ANY             17    /* "V" */
#define HB_FT_IMAGE           18    /* "P" */
#define HB_FT_BLOB            19    /* "W" */
#define HB_FT_OLE             20    /* "G" */
#endif
Regards

Antonio H Ferreira
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: ADO RDD xHarbour
Posted: Sat Mar 28, 2015 08:16 AM

Those types are in Harbour hbusrrdd.ch so I guess yes, not sure if xHarbour is exactly the same

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Re: ADO RDD xHarbour
Posted: Sat Mar 28, 2015 09:27 AM

Antonio,

Ok Im using those. Cross my fingers!

How to use SQL CONVERT to convert expressions like dtos(ddate)+val(ndays) ?

Does anyone has a CH file with all defs for CONVERT ?

Regards

Antonio H Ferreira
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Re: ADO RDD xHarbour
Posted: Sat Mar 28, 2015 11:17 AM

Antonio,Enrico,

Do you know What is the corresponding SQL SELECT ... CONVERT to dtos()?

Regards

Antonio H Ferreira
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: ADO RDD xHarbour
Posted: Sat Mar 28, 2015 11:40 AM
Antonio,

AHF wrote:Do you know What is the corresponding SQL SELECT ... CONVERT to dtos()?


Code (fw): Select all Collapse
SELECT * FROM table WHERE date = '20150328'


EMG
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Re: ADO RDD xHarbour
Posted: Sat Mar 28, 2015 12:51 PM

Enrico,

Thanks but my question was not clear

This is to be used in :find expression and I get this error.

Args:
[ 1] = C DATAFACTUR LIKE '20140407'
argumentos { DATAFACTUR LIKE '20140407' }
descrição DISP_E_UNKNOWNNAME
ficheiro <nenhuma>
genCode 41: Unknown or reserved
operação FIND
osCode (Não é erro do sistema operativo)
severity 2
subCode 6
subSystem ADODB.Recordset
tries 0

Can :find look for date like that ?

Regards

Antonio H Ferreira
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: ADO RDD xHarbour
Posted: Sat Mar 28, 2015 01:03 PM
Antonio,

https://msdn.microsoft.com/en-us/library/windows/desktop/ms676117%28v=vs.85%29.aspx

It seems that this format is needed:

DATAFACTUR = #7/22/97#
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: ADO RDD xHarbour
Posted: Sat Mar 28, 2015 01:11 PM
Antonio,

AHF wrote:DATAFACTUR LIKE '20140407'


Try with:

DATAFACTUR = '20140407'

If you are using MDB try this instead:

Code (fw): Select all Collapse
DATAFACTUR = #04072014#


(DD/MM/YYYY)

EMG
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Re: ADO RDD xHarbour
Posted: Sat Mar 28, 2015 04:06 PM
Antonio, Enrico,

:Find with '20150327' or "20150327" and #20150327# doesnt work always same error.

:Find with 27/03/15 works in all above cases.

I could make a function

Code (fw): Select all Collapse
FUNCTION ADODTOS(dDate)

  IF RDDSETDEFAULT() = "ADORDD"

      RETURN DTOC(dDate)

  ENDIF

  RETURN DTOS(dDate)


and replace in code dtos with adodtos.

But a more clean approach was to redesign the original DTOS to cover this.

What is your opinion?
Regards

Antonio H Ferreira
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Re: ADO RDD xHarbour
Posted: Sat Mar 28, 2015 04:11 PM

Antonio,

In ADO_GETVALUE there is a function hb_stod I dont know why!

Should I use stod

Regards

Antonio H Ferreira
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Re: ADO RDD xHarbour
Posted: Sat Mar 28, 2015 04:46 PM
Decided different approach. What do you think?

Code (fw): Select all Collapse
STATIC FUNCTION ADODTOS(xDate)
 LOCAL dDate ,cYear,cMonth,cDay

   IF "." IN xDate .OR. "-" IN xDate .OR. "/" IN xDate
       dDate := xDate
   ELSE
        cYear  := SUBSTR(xDate,1,4)
    cMonth := SUBSTR(xDate,5,2)
    cDay   := SUBSTR(xDate,7,2) 
    dDate  := CTOD(cDay+"/"+cMonth+"/"+cYear) 
   ENDIF
   
   RETURN DTOC(dDate)
Regards

Antonio H Ferreira
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: ADO RDD xHarbour
Posted: Sat Mar 28, 2015 09:40 PM

Antonio,

If it works then keep going, later on we can always modify it :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: ADO RDD xHarbour
Posted: Sun Mar 29, 2015 08:29 AM

Different date literal formats work with different SQL databases and also depending on settings.

Interestingly American dateformats work with many, because all the software is written by programmers (whatever be their nationality) sitting in USA. But we better stick to international formats.

But the following formats always work irrespective of locale, wherever in the world, and irrespective of locale settings:

Oracle:
WHERE DATEFLD = DATE 'YYYY-MM-DD'

MsSql, MySql and many others

WHERE DATEFLD = 'YYYY-MM-DD'

MSAccess

WHERE DATEFLD = #YYYY-MM-DD#

For ADO FILTERS, irrespective of the datasource.

oRs:Filter = "DATEFLD = #YYYY-MM-DD#"

Note:
1) I know may alternative formats which work with different databases. But here I gave those that work for sure and simple to make.
2) FW_DateToADO() and FW_DateToSQL() may be referred to in the adofuncs.prg

Regards



G. N. Rao.

Hyderabad, India