ADO RDD xHarbour

User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: ADO RDD xHarbour

Post by Antonio Linares »

Antonio,

UR_FIELDINFO ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Post by AHF »

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
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Post by AHF »

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: Select all

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

Re: ADO RDD xHarbour

Post by Antonio Linares »

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
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Post by AHF »

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
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Post by AHF »

Antonio,Enrico,

Do you know What is the corresponding SQL SELECT ... CONVERT to dtos()?
Regards
Antonio H Ferreira
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: ADO RDD xHarbour

Post by Enrico Maria Giordano »

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

Code: Select all

SELECT * FROM table WHERE date = '20150328'
EMG
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Post by AHF »

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

Re: ADO RDD xHarbour

Post by Antonio Linares »

Antonio,

https://msdn.microsoft.com/en-us/librar ... 85%29.aspx

It seems that this format is needed:

DATAFACTUR = #7/22/97#
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: ADO RDD xHarbour

Post by Enrico Maria Giordano »

Antonio,
AHF wrote:DATAFACTUR LIKE '20140407'
Try with:

DATAFACTUR = '20140407'

If you are using MDB try this instead:

Code: Select all

DATAFACTUR = #04072014#
(DD/MM/YYYY)

EMG
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Post by AHF »

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: Select all


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
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Post by AHF »

Antonio,

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

Should I use stod
Regards
Antonio H Ferreira
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Post by AHF »

Decided different approach. What do you think?

Code: Select all

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

Re: ADO RDD xHarbour

Post by Antonio Linares »

Antonio,

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

Antonio Linares
www.fivetechsoft.com
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: ADO RDD xHarbour

Post by nageswaragunupudi »

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
Post Reply