Page 1 of 2

ADORDD Error : ADODEFAULT(5256)

PostPosted: Tue Jun 16, 2015 4:49 am
by dutch
I'm just new with ADORDD, I try the ADORDD.PRG but it has got an error below

This is my example, what I do wrong?
Code: Select all  Expand view
#include 'adordd.ch'
#include 'fivewin.ch'

REQUEST ADORDD

Function main
LOCAL cSql :=""
 
    RddRegister("ADORDD",1)
    RddSetDefault("ADORDD")
   
   USE easyfo TABLE "ccrtbl" VIA "ADORDD" ALIAS "tbl" MYSQL ;
      FROM "localhost" USER "root" PASSWORD "nimda"

msginfo( tbl->tbl_intno )

CLOSE tbl

return nil

Code: Select all  Expand view
  Error description: Error BASE/1132  Bound error: array access
   Args:
     [   1] = A   { ... } length: 0
     [   2] = N   1

Stack Calls
===========
   Called from: D:\FTDN\adordd\AdoRdd\adordd.prg => ADODEFAULTS( 5256 )
   Called from: D:\FTDN\adordd\AdoRdd\adordd.prg => ADOCONNECT( 413 )
   Called from: D:\FTDN\adordd\AdoRdd\adordd.prg => ADO_OPEN( 255 )
   Called from:  => DBUSEAREA( 0 )
   Called from: D:\V6\TADORDD\test.prg => MAIN( 17 )

Re: ADORDD Error : ADODEFAULT(5256)

PostPosted: Tue Jun 16, 2015 6:52 am
by AHF
Dutch,

You need to set ado before:

Code: Select all  Expand view

//all your tables and index files used by your app without any clipper expressions
// if you need to use indexes you need this set otherwise you have t create them
// every time app run
SET ADO TABLES INDEX LIST TO { {"TABLE1",{"FIRST","FIRST"} }, {"TABLE2" ,{"CODID","CODID"}} }

//all your tables and index files used by your app with clipper expressions
// if you need to use indexes you need this set otherwise you have t create them
// every time app run
SET ADODBF TABLES INDEX LIST TO {  {"TABLE1",{"FIRST","FIRST"} }, {"TABLE2" ,"CODID","CODID"}} }

//temporay index file names must star with tmp or temp
SET ADO TEMPORAY NAMES INDEX LIST TO {"TMP","TEMP"}

//this is a must you have to indicate whats the autoinc field used as recno()
//without it will not navigate correctly
// you can indicate by table
SET ADO FIELDRECNO TABLES LIST TO {{"TABLE1","FIRST"},{"TABLE2","CODID"}}
//or by default
SET ADO DEFAULT RECNO FIELD TO "HBRECNO"

//This is the same as for other rdds
SET AUTOPEN ON //might be OFF if you wish
SET AUTORDER TO 1 // first index opened can be other
   
//default connection if for ACCESS YOU NEED TO INCLUDE FULL PATH
SET ADO DEFAULT DATABASE TO "testadordd" SERVER TO "localhost"  ENGINE TO "MYSQL" USER TO "adordd" PASSWORD TO ""   

//control locking in adordd for both table and record dont puT final \
 SET ADO LOCK CONTROL SHAREPATH TO  "D:\WHATEVER" RDD TO "DBFCDX"

//dont need lock control
SET ADO FORCE LOCK OFF

//AFTER SETTINGS DONE
//we can just use table
use TABLE1 alias "whatever"

//or we can open another con
use "TABLE1@"Driver={mySQL ODBC 5.3 ANSI Driver};" + ;
                "
server=localhost" + ;
                "
;Port=3306;Option=32"+;
                "
;database=otherdatabase"   + ;
                "
;uid=adordd" + ;
                "
;pwd=''" +";" ALIAS "whatever"




For you trial:

SET ADO DEFAULT DATABASE TO "ccrtbl" SERVER TO "localhost" ENGINE TO "MYSQL" USER TO "root" PASSWORD TO "nimda"

//if you want to try locks
//control locking in adordd for both table and record dont puT final \
SET ADO LOCK CONTROL SHAREPATH TO "your Drive:\WHATEVER" RDD TO "DBFCDX"
//dont need lock control
SET ADO FORCE LOCK OFF

SET ADO DEFAULT RECNO FIELD TO "my autoinc field" //indicate your autoinc filed in the table (default for all)

USE easyinfo ALIAS "tbl"

//THIS IS THECORRECT SYNTAX
// DONT USE IT IM GOING TO TAKE THIS OUT
//AS IT WILL NOT BE NEEDED WITH ALTERNATIVES ABOVE.
USE easyfo VIA "ADORDD" ALIAS "tbl" FROM DATABASE "ccrtbl" MYSQL ;
FROM SERVER "localhost" USER "root" PASSWORD "nimda"

Please try it and let me know.

Re: ADORDD Error : ADODEFAULT(5256)

PostPosted: Tue Jun 16, 2015 7:45 am
by dutch
I need to use MySql and how to set this following line. I'm not quite clear.
Code: Select all  Expand view
    SET ADO LOCK CONTROL SHAREPATH TO "E:\TEMP" RDD TO "DBFCDX"

This line is used for index expression. If I have 12 tag (DBFCDX) in 1 table, I have to define at the begining of the program every time the program start.
Code: Select all  Expand view
SET ADODBF TABLES INDEX LIST TO {  {"TABLE1",{"FIRST","FIRST"} ,{"LAST","LAST"},{"MEMNO","MEMNO"},{"TYPE+LAST","TYPE+LAST"},{"BIRTHDATE","DTOS(BIRTHDATE)"},etc.}, {"TABLE2" ,"CODID","CODID"}} }

Re: ADORDD Error : ADODEFAULT(5256)

PostPosted: Tue Jun 16, 2015 9:20 am
by Horizon
dutch wrote:I need to use MySql and how to set this following line. I'm not quite clear.
Code: Select all  Expand view
    SET ADO LOCK CONTROL SHAREPATH TO "E:\TEMP" RDD TO "DBFCDX"


+1

Re: ADORDD Error : ADODEFAULT(5256)

PostPosted: Tue Jun 16, 2015 10:12 am
by dutch
This line does return incorrect. Because it cannot find the "TLOCKS" table in MySql Database. It is warning everytime when open the program.

It will effect, if turn LOCK CONTROL ON. I think it will be find, If use "DBFCDX" but still got problem with "MySql".
SET ADO LOCK CONTROL SHAREPATH TO "E:\TEMP" RDD TO "ADORDD" // DBFCDX"
Code: Select all  Expand view
cTable := cPath+"\TLOCKS"+RDDINFO(RDDI_TABLEEXT,,rRdd)

Re: ADORDD Error : ADODEFAULT(5256)

PostPosted: Tue Jun 16, 2015 10:36 am
by lucasdebeltran
Hello,

Please set SET ADO FORCE LOCK OFF.

So MySQL will do the locking.

This feature was a special situation for Antonio´s customer.

So, the settings will be:

Code: Select all  Expand view


  SET ADO DEFAULT RECNO FIELD TO "HBRECNO"

  SET AUTOPEN OFF //ON //might be OFF if you wish

  //SET AUTORDER TO 1 // first index opened can be other

  SET ADO FORCE LOCK OFF

  SET ADO DEFAULT DATABASE TO cDataBase SERVER TO cServer  ENGINE TO "MYSQL" USER TO cUser PASSWORD TO cPassWord


 

Re: ADORDD Error : ADODEFAULT(5256)

PostPosted: Tue Jun 16, 2015 10:45 am
by AHF
Dutch,
dutch wrote:This line does return incorrect. Because it cannot find the "TLOCKS" table in MySql Database. It is warning everytime when open the program.

It will effect, if turn LOCK CONTROL ON. I think it will be find, If use "DBFCDX" but still got problem with "MySql".
SET ADO LOCK CONTROL SHAREPATH TO "E:\TEMP" RDD TO "ADORDD" // DBFCDX"
Code: Select all  Expand view
cTable := cPath+"\TLOCKS"+RDDINFO(RDDI_TABLEEXT,,rRdd)


Can you post here all ado sets?

The TLOCKS table isn't SQL but dbfcdx or other Harbour rdd that allow true lock.

SET ADO LOCK CONTROL SHAREPATH TO "E:\TEMP" RDD TO "DBFCDX"

You have to supply to the sharepath and the rddname. Thats it.

Of course that rdd must be linked with your app because it will be used.

Code: Select all  Expand view
SET ADODBF TABLES INDEX LIST TO {  {"TABLE1",{"FIRST","FIRST"} ,{"LAST","LAST"},{"MEMNO","MEMNO"},{"TYPE+LAST","TYPE+LAST"},{"BIRTHDATE","DTOS(BIRTHDATE)"},etc.}, {"TABLE2" ,"CODID","CODID"}} }


Concerning indexes this has to be placed before trying to open any file.

But you will need also the
Code: Select all  Expand view
SET ADO TABLES INDEX LIST TO {  {"TABLE1",{"FIRST","FIRST"} ,{"LAST","LAST"},{"MEMNO","MEMNO"},{"TYPE+LAST","TYPE,LAST"},{"BIRTHDATE","BIRTHDATE"},etc.}, {"TABLE2" ,"CODID","CODID"}} }


Please check the changes + with , The first "TYPE+LAST" I assume is the index name you want.

You can see these two sets has:

SET ADO TABLES all index expressions without any clipper function and the fields separated by ,.
These are used to build SQL SELECT expression ORDER BY

SET ADODBF TABLES are the same but with clipper fuctions and fields with +.
These are used to evaluate clipper expression ex:
&(indexkey(0))
ordkey()
ordfor()
etc.

I hope to have answer you question.

Re: ADORDD Error : ADODEFAULT(5256)

PostPosted: Tue Jun 16, 2015 7:42 pm
by vilian
Hi Antonio,

We have a bigger ERP (more 400 prg) with many of 300 dbf files, and want try use ADORDD with MySql.

I´m not understand how to use SET ADODBF commands.

Re: ADORDD Error : ADODEFAULT(5256)

PostPosted: Tue Jun 16, 2015 7:57 pm
by AHF
Vilian,

Did you get the last version posted a couple of hours ago and read the readme thats now more like a small manual?

Re: ADORDD Error : ADODEFAULT(5256)

PostPosted: Tue Jun 16, 2015 8:04 pm
by vilian
Antônio,

Thanks, I will get now.

Re: ADORDD Error : ADODEFAULT(5256)

PostPosted: Tue Jun 16, 2015 8:49 pm
by vilian
Antônio,

We have 287 DBF files and 472 CDX files.
We need to use SET ADODBF and SET ADO Tables only in main program or anyway open files ?

Re: ADORDD Error : ADODEFAULT(5256)

PostPosted: Tue Jun 16, 2015 9:51 pm
by dutch
Thanks Lucas,
I have set LOCK OFF as your recommendation. It works now.
lucasdebeltran wrote:Hello,
Please set SET ADO FORCE LOCK OFF.

So MySQL will do the locking.
Code: Select all  Expand view


  SET ADO DEFAULT RECNO FIELD TO "HBRECNO"

  SET AUTOPEN OFF //ON //might be OFF if you wish

  //SET AUTORDER TO 1 // first index opened can be other

  SET ADO FORCE LOCK OFF

  SET ADO DEFAULT DATABASE TO cDataBase SERVER TO cServer  ENGINE TO "MYSQL" USER TO cUser PASSWORD TO cPassWord
 

Dear Antonio F.,
I try to find in ADORDD.PRG, because I got an error message for existing table TLOCKS in MySql. You have checked the existing TLOCKS.DBF from SET ADO LOCK CONTROL SHAREPATH TO .... setting but it got an error message when I use MySql DB.

If I use Clipper Expression in INDEX file, I need only SET ADODBF TABLE INDEX LIST TO. Is it correct?

Thanks in advance.
AHF wrote:Dutch,

Can you post here all ado sets?

The TLOCKS table isn't SQL but dbfcdx or other Harbour rdd that allow true lock.

SET ADO LOCK CONTROL SHAREPATH TO "E:\TEMP" RDD TO "DBFCDX"

You have to supply to the sharepath and the rddname. Thats it.

Of course that rdd must be linked with your app because it will be used.

Code: Select all  Expand view
SET ADODBF TABLES INDEX LIST TO {  {"TABLE1",{"FIRST","FIRST"} ,{"LAST","LAST"},{"MEMNO","MEMNO"},{"TYPE+LAST","TYPE+LAST"},{"BIRTHDATE","DTOS(BIRTHDATE)"},etc.}, {"TABLE2" ,"CODID","CODID"}} }


Concerning indexes this has to be placed before trying to open any file.

But you will need also the
Code: Select all  Expand view
SET ADO TABLES INDEX LIST TO {  {"TABLE1",{"FIRST","FIRST"} ,{"LAST","LAST"},{"MEMNO","MEMNO"},{"TYPE+LAST","TYPE,LAST"},{"BIRTHDATE","BIRTHDATE"},etc.}, {"TABLE2" ,"CODID","CODID"}} }


Please check the changes + with , The first "TYPE+LAST" I assume is the index name you want.

You can see these two sets has:

SET ADO TABLES all index expressions without any clipper function and the fields separated by ,.
These are used to build SQL SELECT expression ORDER BY

SET ADODBF TABLES are the same but with clipper fuctions and fields with +.
These are used to evaluate clipper expression ex:
&(indexkey(0))
ordkey()
ordfor()
etc.

I hope to have answer you question.

Re: ADORDD Error : ADODEFAULT(5256)

PostPosted: Tue Jun 16, 2015 9:52 pm
by AHF
Vilian,

All the sets only need to set once at top of main or some init program.
You only need to set ADO TABLE and ADODBF TABLE the tables with indexes.
Tables without indexes dont have to be set.

Re: ADORDD Error : ADODEFAULT(5256)

PostPosted: Tue Jun 16, 2015 10:06 pm
by AHF
Code: Select all  Expand view
Dear Antonio F.,
I try to find in ADORDD.PRG, because I got an error message for existing table TLOCKS in MySql. You have checked the existing TLOCKS.DBF from SET ADO LOCK CONTROL SHAREPATH TO .... setting but it got an error message when I use MySql DB.

If I use Clipper Expression in INDEX file, I need only SET ADODBF TABLE INDEX LIST TO. Is it correct?

Thanks in advance.


I dont understand very well you question.
Please read last readme posted in Github.

You need always to set both ADODBF TABLES and ADO TABLES
How do you have a tLocks in MySql ?
Do you have such a table already in your app?

Re: ADORDD Error : ADODEFAULT(5256)

PostPosted: Wed Jun 17, 2015 2:37 am
by dutch
Dear Antonio F.,

If I use MySql, I have to set ADODBF TABLES with Clipper Expression Index.
Do I need to set ADO TABLES also?
AHF wrote:You need always to set both ADODBF TABLES and ADO TABLES


Yes, It has created in my MySql Db.
No, It just create from your code (LOCK CONTROL)
AHF wrote:How do you have a tLocks in MySql ?
Do you have such a table already in your app?