ADO RDD xHarbour

Re: ADO RDD xHarbour

Postby Antonio Linares » Fri Mar 27, 2015 10:18 pm

Antonio,

UR_FIELDINFO ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42117
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: ADO RDD xHarbour

Postby AHF » Sat Mar 28, 2015 7: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
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Postby AHF » Sat Mar 28, 2015 7: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: Select all  Expand view  RUN

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

Re: ADO RDD xHarbour

Postby Antonio Linares » Sat Mar 28, 2015 8: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42117
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: ADO RDD xHarbour

Postby AHF » Sat Mar 28, 2015 9: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
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

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

Re: ADO RDD xHarbour

Postby Enrico Maria Giordano » Sat Mar 28, 2015 11:40 am

Antonio,

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


Code: Select all  Expand view  RUN
SELECT * FROM table WHERE date = '20150328'


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: ADO RDD xHarbour

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

Re: ADO RDD xHarbour

Postby Antonio Linares » Sat Mar 28, 2015 1: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42117
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: ADO RDD xHarbour

Postby Enrico Maria Giordano » Sat Mar 28, 2015 1:11 pm

Antonio,

AHF wrote:DATAFACTUR LIKE '20140407'


Try with:

DATAFACTUR = '20140407'

If you are using MDB try this instead:

Code: Select all  Expand view  RUN
DATAFACTUR = #04072014#


(DD/MM/YYYY)

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: ADO RDD xHarbour

Postby AHF » Sat Mar 28, 2015 4: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: Select all  Expand view  RUN


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

Re: ADO RDD xHarbour

Postby AHF » Sat Mar 28, 2015 4:11 pm

Antonio,

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

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

Re: ADO RDD xHarbour

Postby AHF » Sat Mar 28, 2015 4:46 pm

Decided different approach. What do you think?

Code: Select all  Expand view  RUN

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

Re: ADO RDD xHarbour

Postby Antonio Linares » Sat Mar 28, 2015 9:40 pm

Antonio,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42117
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: ADO RDD xHarbour

Postby nageswaragunupudi » Sun Mar 29, 2015 8: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
User avatar
nageswaragunupudi
 
Posts: 10646
Joined: Sun Nov 19, 2006 5:22 am
Location: India

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 37 guests

cron