James:
Maybe it's an Access problem.
Why not use ADO only
Regards
/*
Purpose: Simple ADORDD test of indexes
Author : James Bott
Date : 6/30/2015 5:02:35 PM
*/
#include "fivewin.ch"
#include "adordd.ch"
REQUEST ADORDD, ADOVERSION
FUNCTION Main()
RddRegister("ADORDD",1)
RddSetDefault("ADORDD")
SET ADO TABLES INDEX LIST TO { {"CUSTOMERS",{"CUSTOMERID","CUSTOMERID"} },;
{"CUSTOMERS",{"COUNTRY","COUNTRY"} } }
//SET ADO TEMPORARY NAMES INDEX LIST TO {"TMP","TEMP", "TEMPORARY" }
//SET ADO DEFAULT RECNO FIELD TO "HBRECNO"
SET AUTOPEN ON
SET ADO FORCE LOCK OFF // required
SET ADO DEFAULT DATABASE TO "northwind.mdb" ;
SERVER TO "Microsoft.Jet.OLEDB.4.0" ;
ENGINE TO "ACCESS"
USE customers
//INDEX ON FIELD->CUSTOMERID TO CUSTOMERID TAG CUSTID
//index on field->country to country TAG COUNTRY
//set index to country
set order to "country"
go top
msgInfo(country)
//BROWSE()
xbrowser fastedit
Return nil
// EOF
USE customers
INDEX ON CUSTOMERID TO temp1
index on country to temp2
ordsetfocus("temp2")
browse()
ordsetfocus("temp1")
browse()
ordsetfocus("CUSTOMERID")
browse()
James Bott wrote:Kleyber,
That may be an option. I downloaded it and will take a look.
I did see this in another message thread, "It imports DBFs into MySQL or PostgreSQL databases" and since for testing I am using ACCESS right now it won't be helpful.
I do think the ADORDD issue can be solved. I expect maybe it is doing a COMMIT after adding each record. From my previous experience, this will REALLY slow things down.
Regards,
James
/*
Purpose: Simple ADORDD test of indexes
Author : James Bott
Date : 6/30/2015 5:02:35 PM
*/
#include "fivewin.ch"
#include "adordd.ch"
REQUEST ADORDD, ADOVERSION
FUNCTION Main()
RddRegister("ADORDD",1)
RddSetDefault("ADORDD")
/*
SET ADO TABLES INDEX LIST TO = expressions used to build queries with ORDER BY clause. Here you can even use sql expressions like ASC DESC CONVERT etc
SET ADODBF TABLES INDEX LIST TO = standard clipper like expressions to enable functions like Indexkey() to work. These are the actual indexes you re using in your app
*/
SET ADO TABLES INDEX LIST TO { {"CUSTOMERS",{"CUSTOMERID","CUSTOMERID"} },;
{"CUSTOMERS",{"COUNTRY","COUNTRY"} } }
SET ADODBF TABLES INDEX LIST TO { {"CUSTOMERS",{"CUSTOMERID","CUSTOMERID"} },;
{"CUSTOMERS",{"COUNTRY","COUNTRY"} } }
//SET ADO TEMPORARY NAMES INDEX LIST TO {"TMP","TEMP", "TEMPORARY" }
//SET ADO DEFAULT RECNO FIELD TO "HBRECNO"
SET AUTOPEN ON
SET ADO FORCE LOCK OFF // required
SET ADO DEFAULT DATABASE TO "northwind.mdb" ;
SERVER TO "Microsoft.Jet.OLEDB.4.0" ;
ENGINE TO "ACCESS"
//USE customers
//INDEX ON FIELD->CUSTOMERID TO CUSTOMERID TAG CUSTID
//index on field->country to country TAG COUNTRY
//set index to country
USE customers
INDEX ON CUSTOMERID TO temp1
index on country to temp2
ordsetfocus("temp2")
browse()
ordsetfocus("temp1")
browse()
ordsetfocus("CUSTOMERID")
browse()
/*
set order to "country"
go top
msgInfo(country)
//BROWSE()
xbrowser fastedit
*/
Return nil
// EOF
#include "fivewin.ch"
#include "adordd.ch"
REQUEST ADORDD, ADOVERSION
FUNCTION Main()
RddRegister("ADORDD",1)
RddSetDefault("ADORDD")
/*
SET ADO TABLES INDEX LIST TO = expressions used to build queries with ORDER BY clause. Here you can even use sql expressions like ASC DESC CONVERT etc
SET ADODBF TABLES INDEX LIST TO = standard clipper like expressions to enable functions like Indexkey() to work. These are the actual indexes you re using in your app
array spec :
{ {"Table Name", {"tag name","index expression"},;
{"2nd tag name","index expression"} },;
next table... }
*/
//change tag name to custid as your previous post
// as in clipper you cannot have repeated index (tag) names.
// you can try {"COUNTRY","COUNTRY DESC"} to check behaviour
SET ADO TABLES INDEX LIST TO { {"CUSTOMERS", {"CUSTID","CUSTOMERID"},;
{"COUNTRY","COUNTRY"} } }
SET ADODBF TABLES INDEX LIST TO { {"CUSTOMERS", {"CUSTID","CUSTOMERID"},;
{"COUNTRY","COUNTRY"} } }
SET ADO TEMPORARY NAMES INDEX LIST TO {"TMP","TEMP", "TEMPORARY" }
SET ADO DEFAULT RECNO FIELD TO "HBRECNO" //needed always to be indicated and exist on the tables!
SET AUTOPEN ON //your choice!
SET ADO FORCE LOCK OFF // required ahf why?
//isnt the path to mdb needed?
SET ADO DEFAULT DATABASE TO "northwind.mdb" ;
SERVER TO "ACCESS" ;
ENGINE TO "ACCESS"
USE customers
dbgotop()
SET ORDER TO 1
xbrowser fastedit
SET ORDER TO 2
dbgotop()
xbrowser fastedit
INDEX ON SOMEFIELD.... TO temp1
SET INDEX TO TEMP1
xbrowser fastedit
//try also this
sele 0
USE "INFORMATION_SCHEMA.TABLES"
xbrowser fastedit
Return nil
It seems we have to make lots of changes with indexes to use SQL.
I didnt test this myself because I dot have ACCESS right now
// This is not working
// data is natural order
INDEX ON FIELD->CITY TO temp1
SET INDEX TO TEMP1
dbgotop()
xbrowser fastedit
FUNCTION areainfo()
LOCAL cerrorlog := "",n,j,ntarget,x
for n = 1 to 255
if ! Empty( Alias( n ) )
cErrorLog += CRLF + Str( n, 3 ) + ": " + If( Select() == n,"=> ", " " ) + ;
PadR( Alias( n ), 15 ) + Space( 20 ) + "NomeRDD: " + ;
( Alias( n ) )->( RddName() ) + CRLF
cErrorLog += " ==============================" + CRLF
cErrorLog += " RecNo RecCount BOF EOF" + CRLF
cErrorLog += " " + Transform( ( Alias( n ) )->( RecNo() ), "99999" ) + ;
" " + Transform( ( Alias( n ) )->( RecCount() ), "99999" ) + ;
" " + cValToChar( ( Alias( n ) )->( BoF() ) ) + ;
" " + cValToChar( ( Alias( n ) )->( EoF() ) ) + CRLF + CRLF
cErrorLog += " Índices em uso " + Space( 23 ) + "TagName" + CRLF
for j = 1 to 15
if ! Empty( ( Alias( n ) )->( IndexKey( j ) ) )
cErrorLog += Space( 8 ) + ;
If( ( Alias( n ) )->( IndexOrd() ) == j, "=> ", " " ) + ;
PadR( ( Alias( n ) )->( IndexKey( j ) ), 35 ) + ;
( Alias( n ) )->( OrdName( j ) ) + ;
CRLF
endif
next
cErrorLog += CRLF + " Relations " + CRLF
for j = 1 to 8
if ! Empty( ( nTarget := ( Alias( n ) )->( DbRSelect( j ) ) ) )
cErrorLog += Space( 8 ) + Str( j ) + ": " + ;
"TO " + ( Alias( n ) )->( DbRelation( j ) ) + ;
" INTO " + Alias( nTarget ) + CRLF
// uValue = ( Alias( n ) )->( DbRelation( j ) )
// cErrorLog += cValToChar( &( uValue ) ) + CRLF
endif
next
x := (alias(n))->(dbrlocklist())
cErrorLog += Space( 8 ) +"Records locked "+CRLF
for j = 1 to len(x)
cErrorLog += Space( 8 ) + "Recno nr "+str(x[j])+CRLF
next
endif
next
SHOWMEMO(cerrorlog)
RETURN .t.
// This is not working
// data is natural order
INDEX ON FIELD->CITY TO temp1
SET INDEX TO TEMP1
dbgotop()
Browse()
/*
Purpose : Test ADORDD indexing
Author : James Bott
Date : 8/4/2015
Company : Intellitech
Language : Fivewin/xHarbour
Updated :
Notes :
*/
#include "fivewin.ch"
#include "adordd.ch"
REQUEST ADORDD, ADOVERSION, DBFCDX
FUNCTION Main()
RddRegister("ADORDD",1)
RddSetDefault("ADORDD")
/*
SET ADO TABLES INDEX LIST TO = expressions used to build queries with ORDER BY clause. Here you can even use sql expressions like ASC DESC CONVERT etc
SET ADODBF TABLES INDEX LIST TO = standard clipper like expressions to enable functions like Indexkey() to work. These are the actual indexes you re using in your app
array spec :
{ {"Table Name", {"tag name","index expression"},;
{"2nd tag name","index expression"} },;
next table... }
*/
msgInfo( ADOVERSION(), "ADO Version" )
//change tag name to custid as your previous post
// as in clipper you cannot have repeated index (tag) names.
// you can try {"COUNTRY","COUNTRY DESC"} to check behaviour
SET ADO TABLES INDEX LIST TO { {"CUSTOMERS", {"CUSTID","CUSTOMERID"},;
{"COUNTRY","COUNTRY DESC"} } }
SET ADODBF TABLES INDEX LIST TO { {"CUSTOMERS", {"CUSTID","CUSTOMERID"},;
{"COUNTRY","COUNTRY DESC"} } }
SET ADO TEMPORAY NAMES INDEX LIST TO {"TMP","TEMP", "TEMPORARY" }
SET ADO DEFAULT RECNO FIELD TO "HBRECNO" //needed always to be indicated and exist on the tables!
SET AUTOPEN ON //your choice!
SET ADO FORCE LOCK OFF // required ahf why?
//isnt the path to mdb needed?
SET ADO DEFAULT DATABASE TO "northwind.mdb" ;
SERVER TO "Microsoft.Jet.OLEDB.4.0" ;
ENGINE TO "ACCESS"
USE customers
dbgotop()
SET ORDER TO 1
xbrowser fastedit
SET ORDER TO 2
dbgotop()
xbrowser fastedit
// This is not working
// data is natural order
INDEX ON FIELD->CITY TO temp1
SET INDEX TO TEMP1
dbgotop()
xbrowser fastedit
//try also this
//select 0
//USE "INFORMATION_SCHEMA.TABLES" //MySQL only?
//xbrowser fastedit
Return nil
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 55 guests