topic
stringlengths
1
63
text
stringlengths
1
577k
ADO RDD xHarbour
Welcome back AHF. I am excited to have your expertise available again. I like the COPY TO example. One concern I have is the HBRECNO field. I presume you need to first create the SQL table with the added HBRECNO field before running your code? James
ADO RDD xHarbour
James, No thats done by adordd. In ado_create the field defined as recno is taken care automatically so you dont need to care about it. The field will be always created with the name defined as default or to that table in adordd sets. If the field is defined already in the dbf structure and not as autoinc field it will be changed accordingly in sql. I notice that maromano added a new field to be used a deleted record control and I dont know if he added support for it in ado_create. Ill get into it. Resuming every time you create a new sql structure adordd enforces that the recno field its always present you dont need to defined it yourself in the new structure. This is done in: Copy to Append from Dbcreate etc. ado_create code [code=fw:1mqr3l4m]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">/*<br />&nbsp; &nbsp;fix to add HBRECNO if it´s not present &nbsp;// Lucas De Beltran 23.05.2015<br />&nbsp; &nbsp;cannot be first otherwise copy to changes all fields order and values ahf 23.5.2015<br />&nbsp; &nbsp;*/</span><br />&nbsp; &nbsp;n := ASCAN<span style="color: #000000;">&#40;</span> aWAData<span style="color: #000000;">&#91;</span> WA_SQLSTRUCT <span style="color: #000000;">&#93;</span>,<span style="color: #000000;">&#123;</span> |x| x<span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span> = ADO_GET_FIELD_RECNO<span style="color: #000000;">&#40;</span> &nbsp;aWAData<span style="color: #000000;">&#91;</span> WA_TABLENAME <span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> &nbsp;<span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">IF</span> n == <span style="color: #000000;">0</span><br />&nbsp; &nbsp; &nbsp; AADD<span style="color: #000000;">&#40;</span> aWAData<span style="color: #000000;">&#91;</span> WA_SQLSTRUCT <span style="color: #000000;">&#93;</span>, <span style="color: #000000;">&#123;</span> &nbsp;ADO_GET_FIELD_RECNO<span style="color: #000000;">&#40;</span> &nbsp;aWAData<span style="color: #000000;">&#91;</span> WA_TABLENAME <span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#41;</span>, <span style="color: #ff0000;">'+'</span>, <span style="color: #000000;">10</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">ELSE</span> &nbsp;<span style="color: #B900B9;">//FIX AHF CAN ALREADY EXIST AND NOT TRUE INC FIELD</span><br />&nbsp; &nbsp; &nbsp; aWAData<span style="color: #000000;">&#91;</span> WA_SQLSTRUCT <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>n,<span style="color: #000000;">2</span><span style="color: #000000;">&#93;</span> := <span style="color: #ff0000;">"+"</span><br />&nbsp; &nbsp; &nbsp; aWAData<span style="color: #000000;">&#91;</span> WA_SQLSTRUCT <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>n,<span style="color: #000000;">3</span><span style="color: #000000;">&#93;</span> := &nbsp;<span style="color: #000000;">11</span><br />&nbsp; &nbsp; &nbsp; aWAData<span style="color: #000000;">&#91;</span> WA_SQLSTRUCT <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>n,<span style="color: #000000;">4</span><span style="color: #000000;">&#93;</span> := <span style="color: #000000;">0</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">ENDIF</span><br />&nbsp;</div>[/code:1mqr3l4m]
ADO RDD xHarbour
AHF, Thanks for that explanation. I tried your COPY TO method but it still took 16 minutes and 42 seconds. So, it is not significantly faster that APPEND FROM. I think the speed issue has to do with locking. One reason is that I found that you have to force locking on or the APPEND FROM will crash at some point (unless maybe there are only a very few records). SET ADO FORCE LOCK ON // must be ON to do APPEND FROM... Maybe you have some ideas about this? James
ADO RDD xHarbour
To put this APPEND FROM speed issue in perspective, if you need to import 1 million records it will take: 1000000/26000 = 38 X 18 minutes = 692 minutes/million or 692/60 minutes = 11.5 hours. If you rarely need to import records, then this is probably not a big issue. I do know some people on this forum have mentioned having 2 million records in a single DBF, so just to convert the data to SQL could take days. James
ADO RDD xHarbour
James, [quote="James Bott":129lf2cw]Speed Test Results Using the new ADORDD and a local drive. Success at last. I have been able to import a large number of records from a DBF into a SQL table in an ACCESS database using the APPEND FROM command. Appending 26,191 records with 31 fields from a DBF into an ACCESS table: 18 minutes. Appending the same records from a DBF into a DBF: 1 second Hmm, are all SQL databases that slow? James[/quote:129lf2cw] To make a comparison, try using mu DBF2SQL and export one or many DBF tables into your SQL tables and see the speed. Of course, DBF2SQL is not using ADORDD, but SQLLIB, but the SQL database can be the same.
ADO RDD xHarbour
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
ADO RDD xHarbour
James: Maybe it's an Access problem. Why not use ADO only Regards
ADO RDD xHarbour
Armando, Thanks. I am using both ADO and ADORDD. I am posting the problems I come across so hopefully we can fix them in the ADORDD. If the ADORDD is going to be a drop-in replacement like other RDDs, then everything needs to be working. Otherwise, we need a bunch of IF/THENs in our source code so we can use DBFs or SQL. And yes, getting the DBF data in the SQL database is a separate issue from using existing apps with an SQL database. So we can use whatever means necessary to get the data into the SQL database. James
ADO RDD xHarbour
I am trying to figure out how to use indexes. Can someone post a simple working example preferably using the Northwind.mdb? This would be very helpful, since I have had no luck getting an index to work. Below is what I have been trying to get working. I am trying to index on COUNTRY, but it is not working. James [code=fw:1x2tgmsj]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #B900B9;">/*<br />Purpose: Simple ADORDD test of indexes<br />Author : James Bott<br />Date   : 6/30/2015 5:02:35 PM<br /><br />*/</span><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"adordd.ch"</span><br /><br />REQUEST ADORDD, ADOVERSION<br /><br /><span style="color: #00C800;">FUNCTION</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />   RddRegister<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"ADORDD"</span>,<span style="color: #000000;">1</span><span style="color: #000000;">&#41;</span><br />   RddSetDefault<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"ADORDD"</span><span style="color: #000000;">&#41;</span><br />   <br />   SET ADO TABLES <span style="color: #0000ff;">INDEX</span> LIST <span style="color: #0000ff;">TO</span> <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"CUSTOMERS"</span>,<span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"CUSTOMERID"</span>,<span style="color: #ff0000;">"CUSTOMERID"</span><span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span>,;<br />      <span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"CUSTOMERS"</span>,<span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"COUNTRY"</span>,<span style="color: #ff0000;">"COUNTRY"</span><span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span><br />   <br />   <span style="color: #B900B9;">//SET ADO TEMPORARY NAMES INDEX LIST TO {"TMP","TEMP", "TEMPORARY" }</span><br /><br />   <span style="color: #B900B9;">//SET ADO DEFAULT RECNO FIELD TO "HBRECNO"</span><br /><br />   SET AUTOPEN <span style="color: #0000ff;">ON</span><br /><br />   SET ADO FORCE LOCK OFF   <span style="color: #B900B9;">// required</span><br /><br />   SET ADO <span style="color: #00C800;">DEFAULT</span> DATABASE <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"northwind.mdb"</span> ;<br />       <span style="color: #00C800;">SERVER</span> <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"Microsoft.Jet.OLEDB.4.0"</span>       ;<br />       ENGINE <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"ACCESS"</span><br /><br />   USE customers<br />   <span style="color: #B900B9;">//INDEX ON FIELD->CUSTOMERID TO CUSTOMERID TAG CUSTID</span><br />   <span style="color: #B900B9;">//index on field->country to country TAG COUNTRY</span><br />   <span style="color: #B900B9;">//set index to country</span><br />   <br />   set order <span style="color: #0000ff;">to</span> <span style="color: #ff0000;">"country"</span><br />   go top<br />   <span style="color: #0000ff;">msgInfo</span><span style="color: #000000;">&#40;</span>country<span style="color: #000000;">&#41;</span><br />   <span style="color: #B900B9;">//BROWSE()</span><br />   xbrowser fastedit<br /><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">nil</span> <br /><br /><span style="color: #B900B9;">// EOF</span></div>[/code:1x2tgmsj]
ADO RDD xHarbour
James, 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. You need to have both defined and in the same order. Indexes defined in these array do not need to be created! Just use SET INDEX TO or ORDLISTADD to "open" them and then SET ORDER TO or ORDSETFOCUS to activate them. Please remember that indexes files dont really exist they are only expressions to be used by adordd in SELECT.. ORDER BY clause. Please check the readme.pdf file Indexes created with INDEX ON are temporary in the sense that when the app is closed they need to be created again as they arent in the SET .. INDEX array. Try take out the TAG I never tried because I dont use it. TAGs are not needed as files dont really exist. [code=fw:1xe8dqhx]<div class="fw" id="{CB}" style="font-family: monospace;"><br />USE customers<br /><span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">ON</span> CUSTOMERID <span style="color: #0000ff;">TO</span> temp1<br /><span style="color: #0000ff;">index</span> <span style="color: #0000ff;">on</span> country <span style="color: #0000ff;">to</span> temp2<br />ordsetfocus<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"temp2"</span><span style="color: #000000;">&#41;</span><br />browse<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />ordsetfocus<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"temp1"</span><span style="color: #000000;">&#41;</span><br />browse<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />ordsetfocus<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"CUSTOMERID"</span><span style="color: #000000;">&#41;</span><br />browse<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp;</div>[/code:1xe8dqhx] Did it work?
ADO RDD xHarbour
[quote="James Bott":20p6wzbs]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[/quote:20p6wzbs] That's right. DBF2SQL has the option of how many records must be sent before a commit. The default is 250 but it can be changed. The best way to export data from dbf to an sql database is (IMHO) using transactions with a commit after them.
ADO RDD xHarbour
AHF, OK I tried what I thought you were saying and it still doesn't work. That's why I was asking for a working example, because obviously I still have something wrong. It seems we have to make lots of changes with indexes to use SQL. Below is my modified code that is not working. James [code=fw:28hmd29c]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #B900B9;">/*<br />Purpose: Simple ADORDD test of indexes<br />Author : James Bott<br />Date   : 6/30/2015 5:02:35 PM<br /><br />*/</span><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"adordd.ch"</span><br /><br />REQUEST ADORDD, ADOVERSION<br /><br /><span style="color: #00C800;">FUNCTION</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />   RddRegister<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"ADORDD"</span>,<span style="color: #000000;">1</span><span style="color: #000000;">&#41;</span><br />   RddSetDefault<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"ADORDD"</span><span style="color: #000000;">&#41;</span><br /><span style="color: #B900B9;">/*   <br />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<br /><br />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   <br />*/</span>   <br />   SET ADO TABLES <span style="color: #0000ff;">INDEX</span> LIST <span style="color: #0000ff;">TO</span> <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"CUSTOMERS"</span>,<span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"CUSTOMERID"</span>,<span style="color: #ff0000;">"CUSTOMERID"</span><span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span>,;<br />      <span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"CUSTOMERS"</span>,<span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"COUNTRY"</span>,<span style="color: #ff0000;">"COUNTRY"</span><span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span><br />   SET ADODBF TABLES <span style="color: #0000ff;">INDEX</span> LIST <span style="color: #0000ff;">TO</span>  <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"CUSTOMERS"</span>,<span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"CUSTOMERID"</span>,<span style="color: #ff0000;">"CUSTOMERID"</span><span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span>,;<br />      <span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"CUSTOMERS"</span>,<span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"COUNTRY"</span>,<span style="color: #ff0000;">"COUNTRY"</span><span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span>      <br />   <br />   <span style="color: #B900B9;">//SET ADO TEMPORARY NAMES INDEX LIST TO {"TMP","TEMP", "TEMPORARY" }</span><br /><br />   <span style="color: #B900B9;">//SET ADO DEFAULT RECNO FIELD TO "HBRECNO"</span><br /><br />   SET AUTOPEN <span style="color: #0000ff;">ON</span><br /><br />   SET ADO FORCE LOCK OFF   <span style="color: #B900B9;">// required</span><br /><br />   SET ADO <span style="color: #00C800;">DEFAULT</span> DATABASE <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"northwind.mdb"</span> ;<br />       <span style="color: #00C800;">SERVER</span> <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"Microsoft.Jet.OLEDB.4.0"</span>       ;<br />       ENGINE <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"ACCESS"</span><br /><br />   <span style="color: #B900B9;">//USE customers</span><br />   <span style="color: #B900B9;">//INDEX ON FIELD->CUSTOMERID TO CUSTOMERID TAG CUSTID</span><br />   <span style="color: #B900B9;">//index on field->country to country TAG COUNTRY</span><br />   <span style="color: #B900B9;">//set index to country</span><br />   <br />USE customers<br /><span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">ON</span> CUSTOMERID <span style="color: #0000ff;">TO</span> temp1<br /><span style="color: #0000ff;">index</span> <span style="color: #0000ff;">on</span> country <span style="color: #0000ff;">to</span> temp2<br />ordsetfocus<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"temp2"</span><span style="color: #000000;">&#41;</span><br />browse<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />ordsetfocus<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"temp1"</span><span style="color: #000000;">&#41;</span><br />browse<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />ordsetfocus<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"CUSTOMERID"</span><span style="color: #000000;">&#41;</span><br />browse<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>   <br /><span style="color: #B900B9;">/*   <br />   set order to "country"<br />   go top<br />   msgInfo(country)<br />   //BROWSE()<br />   xbrowser fastedit<br />*/</span><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">nil</span> <br /><br /><span style="color: #B900B9;">// EOF</span></div>[/code:28hmd29c]
ADO RDD xHarbour
James, Try this: [code=fw:14kaz9kq]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"adordd.ch"</span><br /><br />REQUEST ADORDD, ADOVERSION<br /><br /><span style="color: #00C800;">FUNCTION</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;RddRegister<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"ADORDD"</span>,<span style="color: #000000;">1</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;RddSetDefault<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"ADORDD"</span><span style="color: #000000;">&#41;</span><br /><span style="color: #B900B9;">/*<br />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<br /><br />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<br /><br />array spec :<br /><br />{ {"Table Name", {"tag name","index expression"},;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{"2nd tag name","index expression"} },;<br />&nbsp; next table... &nbsp; &nbsp; &nbsp; }<br />*/</span><br />&nbsp; &nbsp;<span style="color: #B900B9;">//change tag name to custid as your previous post </span><br />&nbsp; <span style="color: #B900B9;">// as in clipper you cannot have repeated index (tag) names.</span><br />&nbsp; <span style="color: #B900B9;">// you can try {"COUNTRY","COUNTRY DESC"} to check behaviour</span><br />&nbsp; &nbsp;SET ADO TABLES <span style="color: #0000ff;">INDEX</span> LIST <span style="color: #0000ff;">TO</span> <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"CUSTOMERS"</span>, <span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"CUSTID"</span>,<span style="color: #ff0000;">"CUSTOMERID"</span><span style="color: #000000;">&#125;</span>,;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"COUNTRY"</span>,<span style="color: #ff0000;">"COUNTRY"</span><span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span><br /><br />&nbsp; &nbsp;SET ADODBF TABLES <span style="color: #0000ff;">INDEX</span> LIST <span style="color: #0000ff;">TO</span> <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"CUSTOMERS"</span>, <span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"CUSTID"</span>,<span style="color: #ff0000;">"CUSTOMERID"</span><span style="color: #000000;">&#125;</span>,;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"COUNTRY"</span>,<span style="color: #ff0000;">"COUNTRY"</span><span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span><br /><br />&nbsp; &nbsp;SET ADO TEMPORARY NAMES <span style="color: #0000ff;">INDEX</span> LIST <span style="color: #0000ff;">TO</span> <span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"TMP"</span>,<span style="color: #ff0000;">"TEMP"</span>, <span style="color: #ff0000;">"TEMPORARY"</span> <span style="color: #000000;">&#125;</span><br /><br />&nbsp; &nbsp;SET ADO <span style="color: #00C800;">DEFAULT</span> RECNO FIELD <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"HBRECNO"</span> <span style="color: #B900B9;">//needed always to be indicated and exist on the tables!</span><br /><br />&nbsp; &nbsp;SET AUTOPEN <span style="color: #0000ff;">ON</span> <span style="color: #B900B9;">//your choice!</span><br /><br />&nbsp; &nbsp;SET ADO FORCE LOCK OFF &nbsp; <span style="color: #B900B9;">// required ahf why?</span><br /><br />&nbsp; &nbsp;<span style="color: #B900B9;">//isnt the path to mdb needed?</span><br />&nbsp; &nbsp;SET ADO <span style="color: #00C800;">DEFAULT</span> DATABASE <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"northwind.mdb"</span> ;<br />&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">SERVER</span> <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"ACCESS"</span> &nbsp; &nbsp; &nbsp; ;<br />&nbsp; &nbsp; &nbsp; &nbsp;ENGINE <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"ACCESS"</span><br /><br /><br />USE customers<br />dbgotop<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />SET ORDER <span style="color: #0000ff;">TO</span> <span style="color: #000000;">1</span><br />xbrowser fastedit<br /><br />SET ORDER <span style="color: #0000ff;">TO</span> <span style="color: #000000;">2</span><br />dbgotop<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />xbrowser fastedit<br /><br /><span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">ON</span> SOMEFIELD.... <span style="color: #0000ff;">TO</span> temp1<br />SET <span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">TO</span> TEMP1<br /><br />xbrowser fastedit<br /><br /><span style="color: #B900B9;">//try also this</span><br />sele <span style="color: #000000;">0</span><br />USE <span style="color: #ff0000;">"INFORMATION_SCHEMA.TABLES"</span><br />xbrowser fastedit<br /><br /><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">nil</span><br /><br />&nbsp;</div>[/code:14kaz9kq] [quote:14kaz9kq]It seems we have to make lots of changes with indexes to use SQL.[/quote:14kaz9kq] No James the beauty of it is that is very easy to work with indexes maintaining exactly the same way of working as with any other rdd. The only thing we need to do is to indicate these SETs to ADORDD we dont change anything else in the app code. I didnt test this myself because I dot have ACCESS right now. Im only working with MySql. Once more please note that the indexes are not being physically built in SQL engine these are only used to build ORDER BY clauses when opening the tables (recordsets) with SELECT.... We should not interfere in the database logic that is for DB ADMIN to do. If later the DB ADMIN gets to the conclusion that many selects are using a certain ORDER BY clause may be it would be worth to build a true index at the server to serve faster those requests but this should never be done at the app level. Please let me know if its ok now.
ADO RDD xHarbour
AHF, Thanks for the reply. [quote:su66z4bs]I didnt test this myself because I dot have ACCESS right now[/quote:su66z4bs] Hmm, you don't need the ACCESS program as the ADO drivers are part of Windows. You can just use the Northwind.mdb (commonly available) or you can use the ADO functions to create an empty ACCESS database. I don't have the ACCESS program either. I will try your example. James
ADO RDD xHarbour
AHF, I tried your example and with a few changes got it working except for the temp index. Any ideas? James [code=fw:2uozvntb]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #B900B9;">// This is not working</span><br /><span style="color: #B900B9;">// data is natural order</span><br /><span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">ON</span> FIELD->CITY <span style="color: #0000ff;">TO</span> temp1<br />SET <span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">TO</span> TEMP1<br />dbgotop<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />xbrowser fastedit</div>[/code:2uozvntb]
ADO RDD xHarbour
James, Glad to know thats working. Place this in your code and call it after open indexes to check area status. [code=fw:1novahpv]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">FUNCTION</span> areainfo<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">LOCAL</span> cerrorlog := <span style="color: #ff0000;">""</span>,n,j,ntarget,x<br /><br />&nbsp; &nbsp;<span style="color: #00C800;">for</span> n = <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> <span style="color: #000000;">255</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">if</span> ! Empty<span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">Alias</span><span style="color: #000000;">&#40;</span> n <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cErrorLog += CRLF + Str<span style="color: #000000;">&#40;</span> n, <span style="color: #000000;">3</span> <span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">": "</span> + <span style="color: #00C800;">If</span><span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">Select</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> == n,<span style="color: #ff0000;">"=> "</span>, <span style="color: #ff0000;">" &nbsp; "</span> <span style="color: #000000;">&#41;</span> + ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PadR<span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">Alias</span><span style="color: #000000;">&#40;</span> n <span style="color: #000000;">&#41;</span>, <span style="color: #000000;">15</span> <span style="color: #000000;">&#41;</span> + Space<span style="color: #000000;">&#40;</span> <span style="color: #000000;">20</span> <span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">"NomeRDD: "</span> + ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">Alias</span><span style="color: #000000;">&#40;</span> n <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span> RddName<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> + CRLF<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cErrorLog += <span style="color: #ff0000;">" &nbsp; &nbsp; =============================="</span> + CRLF<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cErrorLog += <span style="color: #ff0000;">" &nbsp; &nbsp; RecNo &nbsp; &nbsp;RecCount &nbsp; &nbsp;BOF &nbsp; EOF"</span> + CRLF<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cErrorLog += <span style="color: #ff0000;">" &nbsp; &nbsp;"</span> + Transform<span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">Alias</span><span style="color: #000000;">&#40;</span> n <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span> RecNo<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>, <span style="color: #ff0000;">"99999"</span> <span style="color: #000000;">&#41;</span> + ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">" &nbsp; &nbsp; &nbsp;"</span> + Transform<span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">Alias</span><span style="color: #000000;">&#40;</span> n <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span> RecCount<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>, <span style="color: #ff0000;">"99999"</span> <span style="color: #000000;">&#41;</span> + ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">" &nbsp; &nbsp; &nbsp;"</span> + cValToChar<span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">Alias</span><span style="color: #000000;">&#40;</span> n <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span> BoF<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> + ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">" &nbsp; "</span> + cValToChar<span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">Alias</span><span style="color: #000000;">&#40;</span> n <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span> EoF<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> + CRLF + CRLF<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cErrorLog += <span style="color: #ff0000;">" &nbsp; &nbsp; Índices em uso "</span> + Space<span style="color: #000000;">&#40;</span> <span style="color: #000000;">23</span> <span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">"TagName"</span> + CRLF<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">for</span> j = <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> <span style="color: #000000;">15</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">if</span> ! Empty<span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">Alias</span><span style="color: #000000;">&#40;</span> n <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span> IndexKey<span style="color: #000000;">&#40;</span> j <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cErrorLog += Space<span style="color: #000000;">&#40;</span> <span style="color: #000000;">8</span> <span style="color: #000000;">&#41;</span> + ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">If</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">Alias</span><span style="color: #000000;">&#40;</span> n <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span> IndexOrd<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> == j, <span style="color: #ff0000;">"=> "</span>, <span style="color: #ff0000;">" &nbsp; "</span> <span style="color: #000000;">&#41;</span> + ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PadR<span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">Alias</span><span style="color: #000000;">&#40;</span> n <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span> IndexKey<span style="color: #000000;">&#40;</span> j <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>, <span style="color: #000000;">35</span> <span style="color: #000000;">&#41;</span> + ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">Alias</span><span style="color: #000000;">&#40;</span> n <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span> OrdName<span style="color: #000000;">&#40;</span> j <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> + ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CRLF<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">endif</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">next</span><br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cErrorLog += CRLF + <span style="color: #ff0000;">" &nbsp; &nbsp; Relations "</span> + CRLF<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">for</span> j = <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> <span style="color: #000000;">8</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">if</span> ! Empty<span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#40;</span> nTarget := <span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">Alias</span><span style="color: #000000;">&#40;</span> n <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span> DbRSelect<span style="color: #000000;">&#40;</span> j <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cErrorLog += Space<span style="color: #000000;">&#40;</span> <span style="color: #000000;">8</span> <span style="color: #000000;">&#41;</span> + Str<span style="color: #000000;">&#40;</span> j <span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">": "</span> + ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">"TO "</span> + <span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">Alias</span><span style="color: #000000;">&#40;</span> n <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span> DbRelation<span style="color: #000000;">&#40;</span> j <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> + ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">" INTO "</span> + <span style="color: #0000ff;">Alias</span><span style="color: #000000;">&#40;</span> nTarget <span style="color: #000000;">&#41;</span> + CRLF<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #B900B9;">// uValue = ( Alias( n ) )->( DbRelation( j ) )</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #B900B9;">// cErrorLog += cValToChar( &( uValue ) ) + CRLF</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">endif</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">next</span><br />&nbsp; &nbsp; &nbsp; x := &nbsp;<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">alias</span><span style="color: #000000;">&#40;</span>n<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span>dbrlocklist<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; cErrorLog += Space<span style="color: #000000;">&#40;</span> <span style="color: #000000;">8</span> <span style="color: #000000;">&#41;</span> +<span style="color: #ff0000;">"Records locked "</span>+CRLF<br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">for</span> j = <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> len<span style="color: #000000;">&#40;</span>x<span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cErrorLog += Space<span style="color: #000000;">&#40;</span> <span style="color: #000000;">8</span> <span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">"Recno nr "</span>+str<span style="color: #000000;">&#40;</span>x<span style="color: #000000;">&#91;</span>j<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>+CRLF<br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">next</span><br /><br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">endif</span><br />&nbsp; &nbsp;<span style="color: #00C800;">next</span><br />&nbsp; &nbsp;SHOWMEMO<span style="color: #000000;">&#40;</span>cerrorlog<span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">RETURN</span> .t.<br />&nbsp;</div>[/code:1novahpv] What do you have after set index ?
ADO RDD xHarbour
James, [code=fw:11imh2vn]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">// This is not working</span><br /><span style="color: #B900B9;">// data is natural order</span><br /><span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">ON</span> FIELD->CITY <span style="color: #0000ff;">TO</span> temp1<br />SET <span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">TO</span> TEMP1<br />dbgotop<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />Browse<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp;</div>[/code:11imh2vn] This is working here with ACCESS adordd version 1/250615
ADO RDD xHarbour
AHF, Below is the code I am using where the temp index isn't working. James [code=fw:homsp4lm]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #B900B9;">/*<br />Purpose &nbsp;: Test ADORDD indexing<br />Author &nbsp; : James Bott<br />Date &nbsp; &nbsp; : 8/4/2015<br />Company &nbsp;: Intellitech<br />Language : Fivewin/xHarbour<br />Updated &nbsp;: <br />Notes &nbsp; &nbsp;:<br /><br />*/</span><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"adordd.ch"</span><br /><br />REQUEST ADORDD, ADOVERSION, DBFCDX<br /><br /><span style="color: #00C800;">FUNCTION</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;RddRegister<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"ADORDD"</span>,<span style="color: #000000;">1</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;RddSetDefault<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"ADORDD"</span><span style="color: #000000;">&#41;</span><br /><span style="color: #B900B9;">/*<br />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<br /><br />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<br /><br />array spec :<br /><br />{ {"Table Name", {"tag name","index expression"},;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{"2nd tag name","index expression"} },;<br />&nbsp; next table... &nbsp; &nbsp; &nbsp; }<br />*/</span><br />&nbsp;<br /><span style="color: #0000ff;">msgInfo</span><span style="color: #000000;">&#40;</span> ADOVERSION<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, <span style="color: #ff0000;">"ADO Version"</span> <span style="color: #000000;">&#41;</span><br />&nbsp;<br />&nbsp; &nbsp;<span style="color: #B900B9;">//change tag name to custid as your previous post </span><br />&nbsp; <span style="color: #B900B9;">// as in clipper you cannot have repeated index (tag) names.</span><br />&nbsp; <span style="color: #B900B9;">// you can try {"COUNTRY","COUNTRY DESC"} to check behaviour</span><br />&nbsp; &nbsp;SET ADO TABLES <span style="color: #0000ff;">INDEX</span> LIST <span style="color: #0000ff;">TO</span> <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"CUSTOMERS"</span>, <span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"CUSTID"</span>,<span style="color: #ff0000;">"CUSTOMERID"</span><span style="color: #000000;">&#125;</span>,;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"COUNTRY"</span>,<span style="color: #ff0000;">"COUNTRY DESC"</span><span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span><br /><br />&nbsp; &nbsp;SET ADODBF TABLES <span style="color: #0000ff;">INDEX</span> LIST <span style="color: #0000ff;">TO</span> <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"CUSTOMERS"</span>, <span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"CUSTID"</span>,<span style="color: #ff0000;">"CUSTOMERID"</span><span style="color: #000000;">&#125;</span>,;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"COUNTRY"</span>,<span style="color: #ff0000;">"COUNTRY DESC"</span><span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span><br /><br />&nbsp; &nbsp;SET ADO TEMPORAY NAMES <span style="color: #0000ff;">INDEX</span> LIST <span style="color: #0000ff;">TO</span> <span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"TMP"</span>,<span style="color: #ff0000;">"TEMP"</span>, <span style="color: #ff0000;">"TEMPORARY"</span> <span style="color: #000000;">&#125;</span><br /><br />&nbsp; &nbsp;SET ADO <span style="color: #00C800;">DEFAULT</span> RECNO FIELD <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"HBRECNO"</span> <span style="color: #B900B9;">//needed always to be indicated and exist on the tables!</span><br /><br />&nbsp; &nbsp;SET AUTOPEN <span style="color: #0000ff;">ON</span> <span style="color: #B900B9;">//your choice!</span><br /><br />&nbsp; &nbsp;SET ADO FORCE LOCK OFF &nbsp; <span style="color: #B900B9;">// required ahf why?</span><br /><br />&nbsp; &nbsp;<span style="color: #B900B9;">//isnt the path to mdb needed?</span><br />&nbsp; &nbsp;SET ADO <span style="color: #00C800;">DEFAULT</span> DATABASE <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"northwind.mdb"</span> ;<br />&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">SERVER</span> <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"Microsoft.Jet.OLEDB.4.0"</span> &nbsp; &nbsp; ;<br />&nbsp; &nbsp; &nbsp; &nbsp;ENGINE <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"ACCESS"</span><br /><br /><br />USE customers<br />dbgotop<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />SET ORDER <span style="color: #0000ff;">TO</span> <span style="color: #000000;">1</span><br />xbrowser fastedit<br /><br />SET ORDER <span style="color: #0000ff;">TO</span> <span style="color: #000000;">2</span><br />dbgotop<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />xbrowser fastedit<br /><br /><span style="color: #B900B9;">// This is not working</span><br /><span style="color: #B900B9;">// data is natural order</span><br /><span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">ON</span> FIELD->CITY <span style="color: #0000ff;">TO</span> temp1<br />SET <span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">TO</span> TEMP1<br />dbgotop<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />xbrowser fastedit<br /><br /><span style="color: #B900B9;">//try also this</span><br /><span style="color: #B900B9;">//select 0</span><br /><span style="color: #B900B9;">//USE "INFORMATION_SCHEMA.TABLES" //MySQL only?</span><br /><span style="color: #B900B9;">//xbrowser fastedit</span><br /><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">nil</span></div>[/code:homsp4lm]
ADO RDD xHarbour
AHF, Here is the data you wanted regarding the temp index. I am using the same ADORDD version as you are. James 1: => CUSTOMERS NomeRDD: ADORDD ============================== RecNo RecCount BOF EOF 1 45 .F. .F. Índices em uso TagName CUSTOMERID CUSTID => COUNTRY DESC COUNTRY Relations Records locked
ADO RDD xHarbour
AHF, The thought just came to me that the customers table in the ACCESS Northwind.mdb does not have the HBRECNO field (because it is a default file). Could that be the reason that the temp indexes aren't working? James
ADO RDD xHarbour
James, Without some autoinc field defined as recno results are unpredictable. It might be it.
ADO RDD xHarbour
Antonio F, OK, I exported the customer table from the SQL database to a DBF, dropped the table, then recreated the SQL table so the HBRECNO field would be created. And imported the records back in from the DBF. Then the temp index began working. Problem solved. Thanks for your help. James
ADO RDD xHarbour
James, Glad to know. <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> By the way did you make all that with APPEND FROM or and COPY TO? When a table is created with adordd it checks automatically if recno field exists and if not creates it. When you use copy to from dbf to sql since it calls ado_create the recno field its automatically checked you dont need to include it in the structure.
ADO RDD xHarbour
Antonio F, Yes, I did a COPY TO a dbf, then built the SQL table from the structure of the DBF (and I did know that the HBRECNO field would be added automatically). Then I did an APPEND FROM the dbf. Fairly simple now that I have the code written. I am wondering about these two lists: SET ADO TABLES INDEX LIST TO ... SET ADODBF TABLES INDEX LIST TO ... What is the difference between the ADO and the ADODBF designations? Since they both contain the same lists aren't they redundant? Or, are there instances where they don't contain the same lists? James
ADO RDD xHarbour
Antonio F, You asked previously about&#058; SET ADO FORCE LOCK ON I had a comment in my code that it was required, and you asked why. Well, I found that if you try to do an APPEND FROM with lots of records it will crash without the above statement. I had it crash once at 500 something records and another time at 1300 something records. So there is something going on that is not consistent which leads me to believe it may have to do with memory and/or timing. I am also wondering if it is doing a commit after each record which can account for how slow it appends records. A single commit after every 100 records would increase the speed 100 times. I really can't see any reason why it would need to do a commit after each record. James
ADO RDD xHarbour
James, Please check 01_readme.pdf [quote:vb7r6kg3] A) SET ADO TABLES INDEX LIST TO …. ---------------------------------------------------- This Set is used by the SQL engine to build select with order by. Thus the fields must be separated by comma and it can include SQL functions or ASC DESC This Set cannot include Clipper/(x)Harbour functions as they are unknown to SQL. Example: SET ADO TABLES INDEX LIST TO { {"TABLE1",{"FIRST","FIRST DESC"} }, {"TABLE2" ,{"CODID","CODID"}} } B) SET ADODBF TABLES INDEX LIST TO… ----------------------------------------------------------- This Set is used to evaluate Clipper/(x)Harbour expressions such as: &( indexkey( 0 ) ) OrdKey( ) Etc. So it must contain your actual real index expressions. Example: SET ADODBF TABLES INDEX LIST TO { {"TABLE1",{"FIRST","FIRST"} }, {"TABLE2" ,{"CODID","STR(CODID,2,0)"}} } Summarize When we use &(indexkey(0)) we can’t evaluate an index expression in ADO TABLES “NAME, DDATA, NVALUE” we will get an error but we can issue SQL SELECT like that. Thus we need ADODBF TABLES expression “NAME+DTOS(DDATE )+STR(NVALUE) “ to do it. So both must be defined one for SQL the other real index clipper type expressions. [/quote:vb7r6kg3]
ADO RDD xHarbour
James, [quote="James Bott":6t3nw8el] Antonio F, You asked previously about&#058; SET ADO FORCE LOCK ON I had a comment in my code that it was required, and you asked why. Well, I found that if you try to do an APPEND FROM with lots of records it will crash without the above statement. I had it crash once at 500 something records and another time at 1300 something records. So there is something going on that is not consistent which leads me to believe it may have to do with memory and/or timing. I am also wondering if it is doing a commit after each record which can account for how slow it appends records. A single commit after every 100 records would increase the speed 100 times. I really can't see any reason why it would need to do a commit after each record. James[/quote:6t3nw8el] What do you mean by "memory and/or time"? COPY TO and APPEND FROM the source area rdd calls ado_append and then ado_putvalue for each record. Both these functions call :update() each time. This might be the reason of taking so long? Do you mean we should change the :cursorType to adLockBatchOptimistic start a transaction and :updatebatch only at the end? May be there is a bug in locks as it should in COPY TO open the destination table exclusively only in APPEND FROM ADORDD locks record by record. Ill check it. Thanks for your helpful feed back.
ADO RDD xHarbour
Antonio F, Thanks for the detailed explanation of the indexes. It helps a lot. I thought we were going to have to give up the FW functions, but it seems not. This is great news to me. James
ADO RDD xHarbour
Antonio F, [quote:3lf2bw2v]What do you mean by "memory and/or time"?[/quote:3lf2bw2v] Maybe I should have said RAM and timing. In the past I have had programs crash when they ran out of RAM. And also, the OS sometimes lags and the program is expecting something to be done that isn't so you get a error that isn't trapped in your code. Both of these are very hard to solve since they are not exactly repeatable. [quote:3lf2bw2v]COPY TO and APPEND FROM the source area rdd calls ado_append and then ado_putvalue for each record. Both these functions call :update() each time. This might be the reason of taking so long?[/quote:3lf2bw2v] Oh, it absolutely is the reason. [quote:3lf2bw2v]Do you mean we should change the :cursorType to adLockBatchOptimistic start a transaction and :updatebatch only at the end?[/quote:3lf2bw2v] Well it does seem that there is very little chance of someone else trying to access a DBF while it is being created. This is generally a maintenance process, and probably being done when nobody is using the system. Or possibly an export to be used by another program. [quote:3lf2bw2v]May be there is a bug in locks as it should in COPY TO open the destination table exclusively only in APPEND FROM ADORDD locks record by record.[/quote:3lf2bw2v] It would seem proper to COPY TO exclusively. With the APPEND FROM, possibly there could be a programming option to set the locking interval; x records or all records. Like I mentioned in a previous post, my calculations were that it would take about 12 hours to append a million records to a local drive (longer on a network drive). So, initializing a large database could take several days with multiple millions of records. A business would have to shut down to do this. If I remember correctly, it takes almost the same time to append 100 records (or even 500) followed by a single update, as it does to append 1 record and update. Updates are really slow for some reason. Yesterday I showed a client a sample of one of his data tables running in an SQL engine. He was very pleased to see it. Keep up the great work you are doing. James
ADO RDD xHarbour
Antoino F, I forgot to mention that an UPDATE forces the disk buffer to be written to disk, so this the reason the update is so slow. If there is only an UPDATE after 100 records (or even 500) there is still probably (depending on the buffer's size) only one disk write, thus the great increase in speed. James
ADO RDD xHarbour
James, Unfortunately I haven't find any way to adordd copy to has enough speed to allow copy to from dbf to sql millions of records. It is really to slow. adordd copy to is good for copying a small set of records ( couple hundreds ) from or to dbfs or from sql to sql. In order to import big dbfs file to sql you can use adofuncs that might do the job much quicker. I've tried to work with :updatebatch() but then I have then problems with recno autoinc field. May be Mr Rao can help on this subject. I've made in meantime some improvements in speed and corrected some index management to mimic exactly index behavior and copy to now copies all records both with SET ADO FORCE LOCK ON or OFF. Ill post a new version within the next days.
ADO RDD xHarbour
Antonio F, Thanks for the update. I didn't see any mention of changing the commit frequency. Have you looked at that? I will be looking forward to the updated ADORDD. I have been working on tests here comparing the results of ADORDD vs DBFCDX drivers and I haven't found any problems yet (other than the APPEND speed). Thanks again for all your work. James
ADO RDD xHarbour
James, In adordd we cant control commit frequency, as far as I know, with :addnew method. As soon as we move or add new record the previous its auto committed because ado auto calls :update(). Being other rdd than ado in source area the loop its controlled by that rdd and we cant do anything else. On the other hand when the source rdd its adordd then we could be much faster because its adordd controlling the loop through ado_trans. Here we could use the following: SELECT * INTO newfile FROM currentfile But we have a limitation we can evaluate the while or for code blocks because we only receive it as a code block thus disabling us to use it as WHERE clause expression so we will end with the same speed problem. The only way out is to have a hb_adorddcopyto( origin file, dest file, where clause ). Here its very fast because its pure SQl treated as above. But I dont know if it is worth while to build such function because you can do it directly from app code and doesn't interfere or take advantage with adordd. Ex [code=fw:18a2o4nn]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br /><span style="color: #B900B9;">//get adordd connection to have it in same transaction processing</span><br />hb_GetAdoConnection<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #000000;">Execute</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"SELECT * &nbsp;INTO newfile FROM currentfile WHERE expression"</span> <span style="color: #000000;">&#41;</span><br /><br />USE newfile &nbsp;/this is adordd<br />....<br />&nbsp;</div>[/code:18a2o4nn] If there is any way to get from the code block the char expression then we could do it completed integrated in adordd otherwise I cant see how we can do it.
ADO RDD xHarbour
Antonio, [quote:18u2yb7o]If there is any way to get from the code block the char expression[/quote:18u2yb7o] Unfortunately no, unless we save it as a string value in advance
ADO RDD xHarbour
James, [quote:h7kgj66a]Yes, I did a COPY TO a dbf, then built the SQL table from the structure of the DBF (and I did know that the HBRECNO field would be added automatically). Then I did an APPEND FROM the dbf. Fairly simple now that I have the code written.[/quote:h7kgj66a] I forgot to mention that you can do it with just one step [code=fw:h7kgj66a]<div class="fw" id="{CB}" style="font-family: monospace;"><br />USE dbf VIA <span style="color: #ff0000;">"DBFCDX"</span><br />COPY <span style="color: #0000ff;">TO</span> sqltable &nbsp;VIA <span style="color: #ff0000;">"ADORDD"</span> <span style="color: #B900B9;">//if not the default rdd</span><br />&nbsp;</div>[/code:h7kgj66a] After investigating, the fastest way to import big amounts of data to MySql is to export it first to csv file and then import it using LOAD DATA statement. I think other DBs engines have alternatives like this. You can try it like using the example in my previous post. In adordd we can do anything else to improve it and maintaining 100% compatibility with existing app code.
ADO RDD xHarbour
New version of ADORDD at <!-- m --><a class="postlink" href="https://github.com/AHFERREIRA/adordd.git">https://github.com/AHFERREIRA/adordd.git</a><!-- m --> Changes: Faster opening recordsets Recordsets are now opened by recno order when no index is active as any dbf Tables without auto inc fieldto be used as recno throws an error whe opening it Reccount faster Copy To (from other rdd to adordd) works ok with both set ado force locks on / off
ADO RDD xHarbour
Hello Antonio F and others, I have a question about adordd, I want to understand better how adordd works. [code=fw:meyvfnow]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"adordd.ch"</span><br /><br />&nbsp; &nbsp; REQUEST ADORDD, ADOVERSION<br /><br />&nbsp; &nbsp; <span style="color: #00C800;">FUNCTION</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; &nbsp; &nbsp;RddRegister<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"ADORDD"</span>,<span style="color: #000000;">1</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp;RddSetDefault<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"ADORDD"</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp;SET ADO FORCE LOCK OFF &nbsp; <span style="color: #B900B9;">// Required!</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp;SET ADO <span style="color: #00C800;">DEFAULT</span> DATABASE <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"testdb1"</span> <span style="color: #00C800;">SERVER</span> <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"localhost"</span> &nbsp;ENGINE <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"MYSQL"</span> USER <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"root"</span> PASSWORD <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"password"</span><br />&nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp;USE CUSTOMER<br />&nbsp; &nbsp; &nbsp; &nbsp;APPEND BLANK<br />&nbsp; &nbsp; &nbsp; &nbsp;REPLACE FIELD->FIRST WITH <span style="color: #ff0000;">"Pieter2"</span>&nbsp; &nbsp;&nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #B900B9;">// APPEND FROM customer2 via "DBFCDX"</span><br />&nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp;BROWSE<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;<br />&nbsp; &nbsp;<span style="color: #00C800;">Return</span> <span style="color: #00C800;">nil</span></div>[/code:meyvfnow] Question: where are Commands, like USE, APPEND BLANK, REPLACE FIELD etc translated into ado code? I tried to find it in adordd.prg, adordd.ch, but I could not find it. Best regards, Pieter
ADO RDD xHarbour
Pieter, adordd its coded at usr rdd level so there isn't any translation into ado code. It is the default rdd that is replaced by adordd like ads rdd, dbfcdx rdd or any other rdd. All rdd table and index functions will work exactly the same. Nothing changes in your code. In adordd.prg for ex the REPLACE or Fieldput calls the ADO_PUTVALUE. The rdd fuctions are "mapped " to the ado functions in ADORDD_GETFUNCTABLE. This is why the level of app code compatibility its so high with adordd against other approaches. Syntax is exactly the same. But you can also work (getting the work area recordset or connection) with SQL directly using functions like those in adofuncs.prg or executing SQL statements. Resuming you can wok only ISAM based or SQL based or both. Its your choice. Besides this the code will be totally compatible with standard (x)Harbour rdd code so it will work exactly the same if you change the adordd to any other.
ADO RDD xHarbour
Antonio, Thank you:D. I think I understand the concept partially, but I also think there is still some things to learn for me. So is it true that usrrdd.lib and/or rdds.lib in the xharbour123/lib directory implement the rdd. If yes, what is then the difference between usrrdd.lib and adordd.lib? Are usrdd.lib and rdds.lib written in C language? In my Clipper 5.2 book from Rick Spence there is a picture which looks like this: Database commands -> RDD Interface -> Database driver - Storted data. I understand Database commands (USE, APPEND BLANK) and storted data (dfb file/sql). I understand the main concept of a rdd (Replaceabel database driver, a layer, which one can change, and the code can stay same, even when you have another database system under it), but the differences between RDD interface and Database driver is not yet clear for me. Do usrdd.lib and rdds.lib and adordd.lib belong to RDD interface or to the database driver? I am not sure whether I asked questions very well or if they are really importent. But if you have some tips that would be welcome. Thanks again. Best regards, Pieter
ADO RDD xHarbour
Pieter, Im not a rdd expert at this level. May be Antonio Linares can explain it better. [quote:3cz1pmq7]So is it true that usrrdd.lib and/or rdds.lib in the xharbour123/lib directory implement the rdd. If yes, what is then the difference between usrrdd.lib and adordd.lib? Are usrdd.lib and rdds.lib written in C language? [/quote:3cz1pmq7] I see usrrdd as an interface to allow us programming new rdds. Its usrrdd that organizes all work areas data memory spaces etc. usrrdd for itself it does nothing. Yes check usrrdd.c [quote:3cz1pmq7] In my Clipper 5.2 book from Rick Spence there is a picture which looks like this: Database commands -> RDD Interface -> Database driver - Storted data. [/quote:3cz1pmq7] I think in adordd it is: Database commands -> ADORDD -> ADO FRAMEWORK - Storted data. or Database commands -> USRRDD -> ADORDD - Storted data. [quote:3cz1pmq7] I understand Database commands (USE, APPEND BLANK) and storted data (dfb file/sql). I understand the main concept of a rdd (Replaceabel database driver, a layer, which one can change, and the code can stay same, even when you have another database system under it), but the differences between RDD interface and Database driver is not yet clear for me. Do usrdd.lib and rdds.lib and adordd.lib belong to RDD interface or to the database driver? [/quote:3cz1pmq7] See above. What is the reason for all these questions ? What are you looking for?
ADO RDD xHarbour
Antonio F, Before I spend time testing this, I thought I should ask. First, I thought we were not supposed to be able to use any functions in SQL indexes, but then I saw you mentioned using (x)Harbour functions such as DTOS(DATE). I am wondering if user-defined functions can be used? I have tried one and it is sorting the data, but it isn't sorting the same way it does when using the DBFNTX RDD, so I am assuming we can't. I hope I'm wrong. Maybe I have the syntax wrong. James
ADO RDD xHarbour
James, [quote:1xfnqgq3]First, I thought we were not supposed to be able to use any functions in SQL indexes, but then I saw you mentioned using (x)Harbour functions such as DTOS(DATE). [/quote:1xfnqgq3] [code=fw:1xfnqgq3]<div class="fw" id="{CB}" style="font-family: monospace;"><br />&nbsp; &nbsp;<span style="color: #B900B9;">//SQL &nbsp;CAN BE USED ANY SQL FUNCTIONS MATCHING CLIPPER FUNCTIONS</span><br />&nbsp; <span style="color: #B900B9;">// WE DONT NEED THE CONVERSION FUNCTIONS IN SQL</span><br />&nbsp; &nbsp; SET ADO TABLES <span style="color: #0000ff;">INDEX</span> LIST <span style="color: #0000ff;">TO</span> <span style="color: #000000;">&#123;</span> &nbsp; <span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"TABLE1"</span>,<span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"COD1"</span>,<span style="color: #ff0000;">"COD+NCOD2+DCOD3"</span><span style="color: #000000;">&#125;</span>...<br /><br />&nbsp; &nbsp;<span style="color: #B900B9;">// CLIPPER EXPRESSIONS </span><br />&nbsp; &nbsp;<span style="color: #B900B9;">// WE NEED THIS OTHERWISE IF YOU DO &(INDEXKEY(0)) YOU GET AN ERROR</span><br />&nbsp; &nbsp; SET ADODBF TABLES <span style="color: #0000ff;">INDEX</span> LIST <span style="color: #0000ff;">TO</span> <span style="color: #000000;">&#123;</span> &nbsp; <span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"TABLE1"</span>,<span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"COD1"</span>,<span style="color: #ff0000;">"COD+STR(NCOD2)+DTOS(DCOD3)"</span><span style="color: #000000;">&#125;</span>...<br />&nbsp; &nbsp; <br />&nbsp;</div>[/code:1xfnqgq3] Concerning UDFs the SQL engine doesnt know it so the only chance is to create these UDFs at the server and then you should be able to call it just like any other SQL function. Remember that the counter type of that SQL function in our app must be defined in SET ADODBF INDEX LIST to enable our app to evaluate it any time. Besides that remember that the Vars must be passed in the index expressions already evaluated as in SQL engine they are out of scope. Never tried it but it should work. With ADS its exactly like this. When you said that you tried UDF this is what happens: If used with INDEX ON the function its simply ignored and if there is a FIELD inside is simply extracted. If used with SET ADO TABLES INDEX it should generate an error if its not defined at the server. Please check for ex. MYsql CREATE FUNCTION
ADO RDD xHarbour
[quote="AHF":2ndtcw9g]Pieter, Im not a rdd expert at this level. May be Antonio Linares can explain it better. [quote:2ndtcw9g]So is it true that usrrdd.lib and/or rdds.lib in the xharbour123/lib directory implement the rdd. If yes, what is then the difference between usrrdd.lib and adordd.lib? Are usrdd.lib and rdds.lib written in C language? [/quote:2ndtcw9g] I see usrrdd as an interface to allow us programming new rdds. Its usrrdd that organizes all work areas data memory spaces etc. usrrdd for itself it does nothing. Yes check usrrdd.c [quote:2ndtcw9g] In my Clipper 5.2 book from Rick Spence there is a picture which looks like this: Database commands -> RDD Interface -> Database driver - Storted data. [/quote:2ndtcw9g] I think in adordd it is: Database commands -> ADORDD -> ADO FRAMEWORK - Storted data. or Database commands -> USRRDD -> ADORDD - Storted data. [quote:2ndtcw9g] I understand Database commands (USE, APPEND BLANK) and storted data (dfb file/sql). I understand the main concept of a rdd (Replaceabel database driver, a layer, which one can change, and the code can stay same, even when you have another database system under it), but the differences between RDD interface and Database driver is not yet clear for me. Do usrdd.lib and rdds.lib and adordd.lib belong to RDD interface or to the database driver? [/quote:2ndtcw9g] See above. What is the reason for all these questions ? What are you looking for?[/quote:2ndtcw9g] Antonio F, [quote:2ndtcw9g]What is the reason for all these questions ?[/quote:2ndtcw9g] I want to know how things conceputally works. How the technologies work together. I think that in the long term I can then solve prolems better. [quote:2ndtcw9g]What are you looking for?[/quote:2ndtcw9g] See above, I have demonstrated a adordd test application(Topic: Test ado rdd app: <!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?f=3&t=30963">viewtopic.php?f=3&t=30963</a><!-- l -->) to my colleages, now we are all interested in using it. Originally we wanted to use only standard ado, but I think using adordd also, is very good. I want to thank you and everybody else who made it possible that that we can use the code of adordd.prg and I wish your project at <!-- m --><a class="postlink" href="http://ajusera.com">http://ajusera.com</a><!-- m --> lots of luck:). Best regards, Pieter
ADO RDD xHarbour
Antonio F, [code=fw:2kj5gnt0]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #B900B9;">//SQL  CAN BE USED ANY SQL FUNCTIONS MATCHING CLIPPER FUNCTIONS</span><br /><span style="color: #B900B9;">// WE DONT NEED THE CONVERSION FUNCTIONS IN SQL</span><br />SET ADO TABLES <span style="color: #0000ff;">INDEX</span> LIST <span style="color: #0000ff;">TO</span> <span style="color: #000000;">&#123;</span>   <span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"TABLE1"</span>,<span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"COD1"</span>,<span style="color: #ff0000;">"COD+NCOD2+DCOD3"</span><span style="color: #000000;">&#125;</span>...</div>[/code:2kj5gnt0] Are you saying that SQL can concatenate unlike data values automatically? Are unlike data values always converted to string, or could you add a date + 10 and get a date ten days after the date specified? (I'm not sure why you might want to do that, just wondering.) I just looked up SQL functions for ACCESS and see there are some, but only 8 and maybe 3 or 4 of them might be useful. And none of them deal with dates. Sigh... Later I will look up SQL functions for MySQL. [code=fw:2kj5gnt0]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #B900B9;">// CLIPPER EXPRESSIONS </span><br /><span style="color: #B900B9;">// WE NEED THIS OTHERWISE IF YOU DO &(INDEXKEY(0)) YOU GET AN ERROR</span><br />SET ADODBF TABLES <span style="color: #0000ff;">INDEX</span> LIST <span style="color: #0000ff;">TO</span> <span style="color: #000000;">&#123;</span>   <span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"TABLE1"</span>,<span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"COD1"</span>,<span style="color: #ff0000;">"COD+STR(NCOD2)+DTOS(DCOD3)"</span><span style="color: #000000;">&#125;</span>...</div>[/code:2kj5gnt0] I don't think I have ever used indexkey() before. I just read up on it, and I will have to think of where I might use it in the future. Does this only apply to indexkey() or are there other xHarbour functions too? If so, which ones? [quote:2kj5gnt0][UDFs] If used with INDEX ON the function is simply ignored and if there is a FIELD inside is simply extracted. When you said that you tried a UDF this is what happens: If used with SET ADO TABLES INDEX it should generate an error if its not defined at the server.[/quote:2kj5gnt0] This what I would have expected, and I did get an error when I tried two indexes--something like "Too many recursive errors." OK, I don't understand how you can define a function at the server. What language do you use? Does the server understand xHarbour? I will Google this. The one index used a lot in the app I am trying to convert uses two different fields, both containing strings, and concatenates them into a larger string then adds the two digits of the century (either "19" or "20"). So you end up with what you would normally get with DTOS(dDate). Yes it is strangely overly complex, but I am stuck with it. Yes, I can create a third field and post the result to it every time the record is saved, and (I think) the data is always saved using my database class, so it would be simple to force this automatically within the Save() method. But I will have to view over 100,000 lines of code to insure that all data is saved via the Save() method. (I going to need lots of coffee and some reading glasses for that!). I know, "If it was easy, anyone could do it!" Thanks for your patience dealing with a SQL novice. James
ADO RDD xHarbour
James, [quote:22q5p10h]Are you saying that SQL can concatenate unlike data values automatically? Are unlike data values always converted to string, or could you add a date + 10 and get a date ten days after the date specified? (I'm not sure why you might want to do that, just wondering.) [/quote:22q5p10h] In order by (indexes) you dont need to make any conversion between different data types as opposite to clipper thats why these ADORDD SET ... INDEX.... SELECT DDATA+10 AS MYDATE ORDER BY MYSTRING+MYDATE [quote:22q5p10h]I don't think I have ever used indexkey() before. I just read up on it, and I will have to think of where I might use it in the future. [/quote:22q5p10h] seek key do while indexkey(0) = key //gives some abstraction of the fields we are seeking [quote:22q5p10h]Does this only apply to indexkey() or are there other xHarbour functions too? If so, which ones? [/quote:22q5p10h] This applies to all functions and I dont know how many but one thing is sure the expected return values are respected acc clipper standards where you cant have different data types together in same expression without convert it all to the same data type. [quote:22q5p10h]This what I would have expected, and I did get an error when I tried two indexes--something like "Too many recursive errors." OK, I don't understand how you can define a function at the server. What language do you use? Does the server understand xHarbour? I will Google this. [/quote:22q5p10h] I think UDFunctions at MySql server must be written in C. Others I dont know. In ADS you can also do it. [quote:22q5p10h]The one index used a lot in the app I am trying to convert uses two different fields, both containing strings, and concatenates them into a larger string then adds the two digits of the century (either "19" or "20")[/quote:22q5p10h] It probably can be done. Please post index expression.
ADO RDD xHarbour
Antonio F, Here is the index and the UDF. IDATE and DATE are two character fields. IDATE is in the format YYMM where it is the last two digits of the year (e.g. 15 for 2015). DATE is really day in the format DD. Like I said previously, icon3() just returns what you would get from DTOS( dDate ) when SET EPOCH TO 1980 is set. [code=fw:12h53whu]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">ON</span> ICON3<span style="color: #000000;">&#40;</span>IDATE+DATE<span style="color: #000000;">&#41;</span> <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"DATE"</span><br /><br /><span style="color: #B900B9;">// icondate is in format YYMMDD</span><br /><span style="color: #B900B9;">// Returned date is in format YYYYMMDD</span><br /><span style="color: #00C800;">FUNCTION</span> icon3<span style="color: #000000;">&#40;</span>icondate<span style="color: #000000;">&#41;</span><br />   <span style="color: #B900B9;">//icondate is idate+date</span><br />   <span style="color: #00C800;">IF</span> VAL<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">SUBSTR</span><span style="color: #000000;">&#40;</span>icondate,<span style="color: #000000;">1</span>,<span style="color: #000000;">2</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>< <span style="color: #000000;">80</span><br />      <span style="color: #00C800;">RETURN</span> <span style="color: #ff0000;">'20'</span>+icondate<br />   <span style="color: #00C800;">ELSE</span><br />      <span style="color: #00C800;">RETURN</span> <span style="color: #ff0000;">'19'</span>+icondate<br />   <span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">nil</span> <br /><br /> </div>[/code:12h53whu] James
ADO RDD xHarbour
Antonio F, Here is how it can be solved using a database class (and adding a new field SDATE). [code=fw:19keonzj]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">Method</span> Save<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">IF</span> VAL<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">SUBSTR</span><span style="color: #000000;">&#40;</span>::<span style="color: #000000;">IDATE</span>+::<span style="color: #000000;">DATE</span>,<span style="color: #000000;">1</span>,<span style="color: #000000;">2</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>< <span style="color: #000000;">80</span><br />&nbsp; &nbsp; &nbsp; ::<span style="color: #000000;">SDATE</span>:=<span style="color: #ff0000;">'20'</span>+::<span style="color: #000000;">IDATE</span>+::<span style="color: #000000;">DATE</span><br />&nbsp; &nbsp;<span style="color: #00C800;">ELSE</span><br />&nbsp; &nbsp; &nbsp; ::<span style="color: #000000;">SDATE</span>:=<span style="color: #ff0000;">'19'</span>+::<span style="color: #000000;">IDATE</span>+::<span style="color: #000000;">DATE</span><br />&nbsp; &nbsp;<span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">Return</span> ::<span style="color: #00C800;">super</span>:<span style="color: #000000;">save</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp;</div>[/code:19keonzj] James
ADO RDD xHarbour
James, You can use If( in SELECT and in ORDER BY. SELECT field+IF( field1= ..., true expr, false expr) AS myfield FROM myTable ORDER BY myfield or SELECT field ORDER BY field+IF( field1= ..., true, false) You can also use CASE instead of IF. You can use also conversion functions such as CONVERT(.... or concatenation CONCAT(... Please remember that these SQL order by expressions must be at SET ADO TABLE LIST INDEX
ADO RDD xHarbour
Antonio F, Ok, thanks that is all very useful info. [quote:15jmk6w9]SELECT field ORDER BY field+IF( field1= ..., true, false)[/quote:15jmk6w9] So could I then convert this UDF: [code=fw:15jmk6w9]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">FUNCTION</span> icon3<span style="color: #000000;">&#40;</span>icondate<span style="color: #000000;">&#41;</span><br />   <span style="color: #B900B9;">//icondate is idate+date</span><br />   <span style="color: #00C800;">IF</span> VAL<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">SUBSTR</span><span style="color: #000000;">&#40;</span>icondate,<span style="color: #000000;">1</span>,<span style="color: #000000;">2</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>< <span style="color: #000000;">80</span><br />      <span style="color: #00C800;">RETURN</span> <span style="color: #ff0000;">'20'</span>+icondate<br />   <span style="color: #00C800;">ELSE</span><br />      <span style="color: #00C800;">RETURN</span> <span style="color: #ff0000;">'19'</span>+icondate<br />   <span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">nil</span></div>[/code:15jmk6w9] To this index (assuming using MySQL): [code=fw:15jmk6w9]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #0000ff;">index</span> <span style="color: #0000ff;">on</span> <span style="color: #00C800;">if</span><span style="color: #000000;">&#40;</span><span style="color: #0000ff;">left</span><span style="color: #000000;">&#40;</span>idate,<span style="color: #000000;">2</span><span style="color: #000000;">&#41;</span><<span style="color: #ff0000;">"80"</span>, <span style="color: #ff0000;">"20"</span>+idate+date, <span style="color: #ff0000;">"19"</span>+idate+date<span style="color: #000000;">&#41;</span></div>[/code:15jmk6w9] The above would, of course, also work with Fivewin. James
ADO RDD xHarbour
James, You have to try it with Mysql Workbench and then apply the correct expression into the app. I dont know if such literal expression is accepted in INDEX ON at the compile time you have to try it. My be you have to place it in a var and evaluated in INDEX ON In SET ADO DBF INDEX it would be ok. Please be aware that you will might need different expressions accordingly to the SQL engine used.
ADO RDD xHarbour
Hello Antonio F, and other members. It is going well with the adordd implementation of my application. (I am using now a smaller application than the normal application, but it should be similar for the normal application). I got an error at this moment. Part of the log of the error: Application =========== Admin.: - ADS: LOCAL Error ocurred at: 08-09-2015, 14:39:07 Error description: Error BASE/1132 Bound error: array access Error id 1: - Error id 2: - Current opened dbf: BASIS - 1 Last menu action: <onbekend> Args: [ 1] = A (L=0) [ 2] = N 1 Stack Calls =========== Called from ADOPSEUDOSEEK(3749) Called from ADOSEEKCLIFIND(3412) Called from ADO_SEEK(3371) Called from DBSEEK(0) Called from DBFSEEK(1479) Called from DBFSELECT(1465) Called from ABASIS(2912) Called from UBTEST(42) System ====== CPU type: Intel(R) Pentium(R) CPU N3540 @ 2.16GHz 2166 Mhz Hardware memory: 3500 megs Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20150213) Windows version: 8 Our application works with ADS, I tried to remove the ads parts out of the application, and replace with adordd code. There were only very few places where I had to do that. Here are some of the changes which looks like: [code=fw:169qa4mo]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">IF</span><span style="color: #000000;">&#40;</span>.F.<span style="color: #000000;">&#41;</span><br /><span style="color: #B900B9;">// Check if Ads is used local or remote</span><br />lAdsLocal := <span style="color: #00C800;">IF</span><span style="color: #000000;">&#40;</span> AppRegistry<span style="color: #000000;">&#40;</span> <span style="color: #000000;">2</span>,<span style="color: #ff0000;">"ADS"</span>,<span style="color: #ff0000;">""</span> <span style="color: #000000;">&#41;</span> == <span style="color: #ff0000;">"LOCAL"</span>,.T.,.F. <span style="color: #000000;">&#41;</span><br />nAdsType := <span style="color: #00C800;">IF</span><span style="color: #000000;">&#40;</span> lAdsLocal,<span style="color: #000000;">1</span>,<span style="color: #000000;">2</span> <span style="color: #000000;">&#41;</span><br /><br /><span style="color: #B900B9;">// Harbour database engine</span><br />rddRegister<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"ADS"</span>,<span style="color: #000000;">1</span> <span style="color: #000000;">&#41;</span><br />rddsetdefault<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"ADS"</span> <span style="color: #000000;">&#41;</span><br />AdsSetServerType<span style="color: #000000;">&#40;</span> nAdsType <span style="color: #000000;">&#41;</span>       <span style="color: #B900B9;">// 1=Local, 2=Remote, 4=AIS</span><br />AdsSetFileType<span style="color: #000000;">&#40;</span> <span style="color: #000000;">2</span> <span style="color: #000000;">&#41;</span>                <span style="color: #B900B9;">// 1=Ntx, 2=Cdx, 3=Adt</span><br /><br /><span style="color: #00C800;">ELSE</span><br /><br /><span style="color: #B900B9;">//ADORDD</span><br />RddRegister<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"ADORDD"</span>,<span style="color: #000000;">1</span><span style="color: #000000;">&#41;</span><br />RddSetDefault<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"ADORDD"</span><span style="color: #000000;">&#41;</span><br />SET ADO FORCE LOCK OFF   <span style="color: #B900B9;">// Required!</span><br />SET ADO <span style="color: #00C800;">DEFAULT</span> DATABASE <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"database"</span> <span style="color: #00C800;">SERVER</span> <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"localhost"</span>  ENGINE <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"MYSQL"</span> USER <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"root"</span> PASSWORD <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"password"</span><br /><br /><span style="color: #00C800;">ENDIF</span><br /><br /> </div>[/code:169qa4mo] [code=fw:169qa4mo]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">//#define ADS_DRIVER        "ADS"</span><br /><span style="color: #00D7D7;">#define</span> ADS_DRIVER        <span style="color: #ff0000;">"ADORDD<br /></span></div>[/code:169qa4mo] [code=fw:169qa4mo]<div class="fw" id="{CB}" style="font-family: monospace;"><br />REM ADORDD files opnemen<br />echo %hbdir%\lib\adordd.lib + >> UBtest.bc<br />echo %hbdir%\lib\rdds.lib + >> UBtest.bc<br />echo %hbdir%\lib\usrrdd.lib + >> UBtest.bc<br /><br />REM ADS files opnemen<br />rem echo %hbdir%\lib\rddads.lib + >> UBtest.bc<br />rem echo %acedir%\Ace32.lib + >> UBtest.bc<br /> </div>[/code:169qa4mo] I hope you can help me with where I should find the solution. Do you think I should change something in my application or in adorrd.prg? Kind regards, Pieter
ADO RDD xHarbour
Pieter, What adordd version are you using? I would not take out ADS from your prgs I would use instead around the code: [code=fw:bga7je6t]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">IF</span> RDDSETDEFAUL<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> == <span style="color: #ff0000;">"ADORDD"</span><br />&nbsp; <span style="color: #B900B9;">//adordd code chages</span><br /><span style="color: #00C800;">ELSE</span><br />&nbsp; <span style="color: #B900B9;">//your actual code</span><br /><span style="color: #00C800;">ENDIF</span><br />&nbsp;</div>[/code:bga7je6t] and link all rdds. Then you only have to change RDDSETDEFAULT and your app will work with any of them. By the way the next version of adordd has big changes and it seems that will be 100% compatible with any clipper code. Just link and go. Changes: Data from server only read once. Better underlying data synchronization (deletions and new additions by others). Big big improvements in speed ( seeks, relations, record movement, filters, etc) browses even with several relations are extremely fast. Indexes are not anymore queries with order by but :Sort instead. Finally Indexes with any clipper expressions including any UDFs. Thanks to Mr Rao! Code in general cleaner and much reduced. I hope to have it ready between 21-26.09 because we are testing every change. All our trials are done with MySql / ACCESS and recordsets between 50.000 and 200.000 recs.
ADO RDD xHarbour
Antonio F, Thank you:D. How can I see which version of ADORDD I have in the application? Something like MsgInfo(ADORDDVERSION()) maybe? I am looking forward to the new adordd. Pieter
ADO RDD xHarbour
Pieter, ADOVERSION()
ADO RDD xHarbour
MsgInfo(ADOVERSION()) gives: AdoRdd Version 1.170815/1
ADO RDD xHarbour
Pieter, There is a problem with open indexes but I dont now what. Do you have the tables and indexes opened in your error log? Can you post it ? If you dont you can use this code to check it. [code=fw:2xkxvpjo]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">FUNCTION</span> expalias<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">LOCAL</span> cerrorlog := <span style="color: #ff0000;">""</span>,n,j,ntarget,x<br /><br />&nbsp; &nbsp;<span style="color: #00C800;">for</span> n = <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> <span style="color: #000000;">255</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">if</span> ! Empty<span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">Alias</span><span style="color: #000000;">&#40;</span> n <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cErrorLog += CRLF + Str<span style="color: #000000;">&#40;</span> n, <span style="color: #000000;">3</span> <span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">": "</span> + <span style="color: #00C800;">If</span><span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">Select</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> == n,<span style="color: #ff0000;">"=> "</span>, <span style="color: #ff0000;">" &nbsp; "</span> <span style="color: #000000;">&#41;</span> + ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PadR<span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">Alias</span><span style="color: #000000;">&#40;</span> n <span style="color: #000000;">&#41;</span>, <span style="color: #000000;">15</span> <span style="color: #000000;">&#41;</span> + Space<span style="color: #000000;">&#40;</span> <span style="color: #000000;">20</span> <span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">"NomeRDD: "</span> + ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">Alias</span><span style="color: #000000;">&#40;</span> n <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span> RddName<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> + CRLF<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cErrorLog += <span style="color: #ff0000;">" &nbsp; &nbsp; =============================="</span> + CRLF<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cErrorLog += <span style="color: #ff0000;">" &nbsp; &nbsp; RecNo &nbsp; &nbsp;RecCount &nbsp; &nbsp;BOF &nbsp; EOF"</span> + CRLF<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cErrorLog += <span style="color: #ff0000;">" &nbsp; &nbsp;"</span> + Transform<span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">Alias</span><span style="color: #000000;">&#40;</span> n <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span> RecNo<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>, <span style="color: #ff0000;">"99999"</span> <span style="color: #000000;">&#41;</span> + ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">" &nbsp; &nbsp; &nbsp;"</span> + Transform<span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">Alias</span><span style="color: #000000;">&#40;</span> n <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span> RecCount<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>, <span style="color: #ff0000;">"99999"</span> <span style="color: #000000;">&#41;</span> + ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">" &nbsp; &nbsp; &nbsp;"</span> + cValToChar<span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">Alias</span><span style="color: #000000;">&#40;</span> n <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span> BoF<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> + ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">" &nbsp; "</span> + cValToChar<span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">Alias</span><span style="color: #000000;">&#40;</span> n <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span> EoF<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> + CRLF + CRLF<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cErrorLog += <span style="color: #ff0000;">" &nbsp; &nbsp; Índices em uso "</span> + Space<span style="color: #000000;">&#40;</span> <span style="color: #000000;">23</span> <span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">"TagName"</span> + CRLF<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">for</span> j = <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> <span style="color: #000000;">15</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">if</span> ! Empty<span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">Alias</span><span style="color: #000000;">&#40;</span> n <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span> IndexKey<span style="color: #000000;">&#40;</span> j <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cErrorLog += Space<span style="color: #000000;">&#40;</span> <span style="color: #000000;">8</span> <span style="color: #000000;">&#41;</span> + ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">If</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">Alias</span><span style="color: #000000;">&#40;</span> n <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span> IndexOrd<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> == j, <span style="color: #ff0000;">"=> "</span>, <span style="color: #ff0000;">" &nbsp; "</span> <span style="color: #000000;">&#41;</span> + ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PadR<span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">Alias</span><span style="color: #000000;">&#40;</span> n <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span> IndexKey<span style="color: #000000;">&#40;</span> j <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>, <span style="color: #000000;">35</span> <span style="color: #000000;">&#41;</span> + ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">Alias</span><span style="color: #000000;">&#40;</span> n <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span> OrdName<span style="color: #000000;">&#40;</span> j <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> + ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CRLF<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">endif</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">next</span><br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cErrorLog += CRLF + <span style="color: #ff0000;">" &nbsp; &nbsp; Relações em uso "</span> + CRLF<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">for</span> j = <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> <span style="color: #000000;">8</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">if</span> ! Empty<span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#40;</span> nTarget := <span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">Alias</span><span style="color: #000000;">&#40;</span> n <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span> DbRSelect<span style="color: #000000;">&#40;</span> j <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cErrorLog += Space<span style="color: #000000;">&#40;</span> <span style="color: #000000;">8</span> <span style="color: #000000;">&#41;</span> + Str<span style="color: #000000;">&#40;</span> j <span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">": "</span> + ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">"TO "</span> + <span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">Alias</span><span style="color: #000000;">&#40;</span> n <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span> DbRelation<span style="color: #000000;">&#40;</span> j <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> + ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">" INTO "</span> + <span style="color: #0000ff;">Alias</span><span style="color: #000000;">&#40;</span> nTarget <span style="color: #000000;">&#41;</span> + CRLF<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #B900B9;">// uValue = ( Alias( n ) )->( DbRelation( j ) )</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #B900B9;">// cErrorLog += cValToChar( &( uValue ) ) + CRLF</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">endif</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">next</span><br />&nbsp; &nbsp; &nbsp; x := &nbsp;<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">alias</span><span style="color: #000000;">&#40;</span>n<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>-><span style="color: #000000;">&#40;</span>dbrlocklist<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; cErrorLog += Space<span style="color: #000000;">&#40;</span> <span style="color: #000000;">8</span> <span style="color: #000000;">&#41;</span> +<span style="color: #ff0000;">"Registos fechados "</span>+CRLF<br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">for</span> j = <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> len<span style="color: #000000;">&#40;</span>x<span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cErrorLog += Space<span style="color: #000000;">&#40;</span> <span style="color: #000000;">8</span> <span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">"Registo nr "</span>+str<span style="color: #000000;">&#40;</span>x<span style="color: #000000;">&#91;</span>j<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>+CRLF<br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">next</span><br /><br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">endif</span><br />&nbsp; &nbsp;<span style="color: #00C800;">next</span><br />&nbsp; &nbsp;SHOWMEMO<span style="color: #000000;">&#40;</span>cerrorlog<span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">RETURN</span> .t.<br />&nbsp;</div>[/code:2xkxvpjo]
ADO RDD xHarbour
Antonio F, I have used your code of FUNCTION expalias() (I used memowrit() instead of SHOWMEMO()) [code=fw:2xgshdw5]<div class="fw" id="{CB}" style="font-family: monospace;"><br />  <span style="color: #000000;">1</span>:    USERS                              NomeRDD: <span style="color: #000000;">ADORDD</span><br />     ==============================<br />     RecNo    RecCount    BOF   EOF<br />        <span style="color: #000000;">1</span>          <span style="color: #000000;">3</span>      .F.   .F.<br /><br />     Índices em uso                        TagName<br /><br />     Relações em uso <br />        Registos fechados <br /><br />  <span style="color: #000000;">2</span>:    <span style="color: #0000ff;">ID</span>                                 NomeRDD: <span style="color: #000000;">ADORDD</span><br />     ==============================<br />     RecNo    RecCount    BOF   EOF<br />        <span style="color: #000000;">1</span>          <span style="color: #000000;">1</span>      .F.   .F.<br /><br />     Índices em uso                        TagName<br /><br />     Relações em uso <br />        Registos fechados <br /><br />  <span style="color: #000000;">3</span>: => BASIS                              NomeRDD: <span style="color: #000000;">ADORDD</span><br />     ==============================<br />     RecNo    RecCount    BOF   EOF<br />        <span style="color: #000000;">1</span>          <span style="color: #000000;">2</span>      .F.   .F.<br /><br />     Índices em uso                        TagName<br /><br />     Relações em uso <br />        Registos fechados <br /> </div>[/code:2xgshdw5] Here is more code of my program. [code=fw:2xgshdw5]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">IF</span> ! GetInlogdata<span style="color: #000000;">&#40;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#41;</span><br />    <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">nil</span><br /><span style="color: #00C800;">ENDIF</span><br />LoginOke<span style="color: #000000;">&#40;</span> .F.,.T. <span style="color: #000000;">&#41;</span><br /><br />aOpenDbf := <span style="color: #000000;">&#123;</span> <span style="color: #ff0000;">"basis"</span>,<span style="color: #ff0000;">"id"</span>,<span style="color: #ff0000;">"users"</span> <span style="color: #000000;">&#125;</span><br /><span style="color: #00C800;">IF</span> ! DBFopen<span style="color: #000000;">&#40;</span> aOpenDbf,<span style="color: #ff0000;">"S"</span>,<span style="color: #000000;">1</span>,<span style="color: #000000;">1</span> <span style="color: #000000;">&#41;</span><br />    <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">nil</span><br /><span style="color: #00C800;">ENDIF</span><br /><br />expalias<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />aBasis<span style="color: #000000;">&#40;</span> <span style="color: #00C800;">nil</span>,.T.<span style="color: #000000;">&#41;</span> <span style="color: #B900B9;">//Error happens in this function.</span><br /><br /> </div>[/code:2xgshdw5] I can send you more code or information if needed.
ADO RDD xHarbour
Pieter, I would say that you are seeking without any index opened. What does aBasis?
ADO RDD xHarbour
Antonio F, [code=fw:2h59qzrz]<div class="fw" id="{CB}" style="font-family: monospace;"><br />&nbsp; &nbsp;Error description: <span style="color: #000000;">Error</span> BASE/<span style="color: #000000;">1132</span> &nbsp;Bound error: <span style="color: #000000;">array</span> access<br />&nbsp; &nbsp;Error <span style="color: #0000ff;">id</span> <span style="color: #000000;">1</span>: -<br />&nbsp; &nbsp;Error <span style="color: #0000ff;">id</span> <span style="color: #000000;">2</span>: -<br />&nbsp; &nbsp;Current opened dbf: <span style="color: #000000;">BASIS</span> - <span style="color: #000000;">1</span><br />&nbsp; &nbsp;Last <span style="color: #0000ff;">menu</span> <span style="color: #0000ff;">action</span>: <onbekend><br />&nbsp; &nbsp;Args:<br />&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span> &nbsp; <span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span> = A &nbsp; &nbsp;<span style="color: #000000;">&#40;</span>L=<span style="color: #000000;">0</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span> &nbsp; <span style="color: #000000;">2</span><span style="color: #000000;">&#93;</span> = N &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">1</span><br /><br />Stack Calls<br />===========<br />&nbsp; &nbsp;Called <span style="color: #0000ff;">from</span> ADOPSEUDOSEEK<span style="color: #000000;">&#40;</span><span style="color: #000000;">3749</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;Called <span style="color: #0000ff;">from</span> ADOSEEKCLIFIND<span style="color: #000000;">&#40;</span><span style="color: #000000;">3412</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;Called <span style="color: #0000ff;">from</span> ADO_SEEK<span style="color: #000000;">&#40;</span><span style="color: #000000;">3371</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;Called <span style="color: #0000ff;">from</span> DBSEEK<span style="color: #000000;">&#40;</span><span style="color: #000000;">0</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;Called <span style="color: #0000ff;">from</span> DBFSEEK<span style="color: #000000;">&#40;</span><span style="color: #000000;">1479</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;Called <span style="color: #0000ff;">from</span> DBFSELECT<span style="color: #000000;">&#40;</span><span style="color: #000000;">1465</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;Called <span style="color: #0000ff;">from</span> ABASIS<span style="color: #000000;">&#40;</span><span style="color: #000000;">2912</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;Called <span style="color: #0000ff;">from</span> UBTEST<span style="color: #000000;">&#40;</span><span style="color: #000000;">45</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp;</div>[/code:2h59qzrz] In function aBasis, the comment translated in english is: Base - load data in object In this function aBasis, there is a function DBFselect() which is used a lot in the program. In this error the code looks like this: DBFselect( "basis",1, etc. ). The error happens in the DBFselect function. Comment which is written by DBFselect function is: "Select a DBF (and open it if not allready opened)". I think it is a kind of USE or DbUseArea, but then customized for our program. Pieter
ADO RDD xHarbour
Pieter, Called from DBFSEEK(1479) before adordd. Its not USE. You are seeking the table and no indexes are opened. The error occurs in [code=fw:33mr9urp]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">STATIC</span> <span style="color: #00C800;">FUNCTION</span> ADOPSEUDOSEEK<span style="color: #000000;">&#40;</span>nWA,cKey,aWAData,lSoftSeek,lBetween,cKeybottom<span style="color: #000000;">&#41;</span><br /><br />&nbsp;<span style="color: #00C800;">LOCAL</span> nOrder := aWAData<span style="color: #000000;">&#91;</span>WA_INDEXACTIVE<span style="color: #000000;">&#93;</span><br />&nbsp;<span style="color: #00C800;">LOCAL</span> cExpression := aWAData<span style="color: #000000;">&#91;</span>WA_INDEXEXP<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>nOrder<span style="color: #000000;">&#93;</span> <span style="color: #B900B9;">//here the error the array is empty</span><br />&nbsp;</div>[/code:33mr9urp] Should error "table not indexed" but it seems not. Place expalias() after use table and indexes and check it.
ADO RDD xHarbour
Antonio F, Oké, I think I have done what you suggested (see also my email). It looks like it is working well until Dbseek(). Pieter
ADO RDD xHarbour
RE: ADORDD and Memory Issues For this discussion I am talking about standard FWH code that was written for DBF files, since this is the reason for having an ADORDD. I assume that whenever a database is opened via ADORDD, that a recordset is created containing the entire database. Is that correct? I know that we have to live with the designs of SQL client/server, but this can create a big issue with memory. If we open several databases with hundreds of thousands, or even millions of records, then we are going to quickly run out of RAM. In my apps, I often may have several copies of the same database open in different objects. Memory is not an issue with this when using DBFs, since they often only load one record at a time, or maybe a screen full with a browse. But with SQL we are going to load the entire database just to get access to one record. So if I have two objects that need one record each from a database, I will have two recordsets containing the entire database in memory. Is that correct? Of course it also means that we have to load the entire database across the network--multiple times. I know that some memory can be paged out to disk, but this comes at the cost of speed and also garbage collection I am guessing. So the speed of the same app running with a DBF RDD would be much faster than with the ADORDD (regardless of the fact that it is client/server). It seems like this is going to be a real issue with all but very small files. Yes, I know this can be solved by rewriting our apps to take advantage of SQL's query capabilities, but that is another entire project. We would pretty much have to rewrite our entire apps. Thoughts? James
ADO RDD xHarbour
James, adordd is in big changes and will only read from table once when it opens it. You can also use with a query to limit the range of the set. After loading the set it only re read the table again when new additions by others are made. Next week Ill post a new version with big changes, much much faster, UDFs in indexes etc. Im now converting another app to SQL and this app does not have historic data files as should be. All the records for the last 20 years are in the daily working files! I had to add a new routine to have a indication of the working period and then USE the table with a WHERE clause for datefield = working date. This reduced the working load from > 1000.000 recs to less than 50.000! This app can have many tables opened at same time because it works with MDIs windows each one with their own tables, relations etc saved as each window objects. Did nt change any code logic and app is running very fast. Still on trials. But note that also with dbfs leaving tables grow so much would be a cause of many indexes problems, data corruption etc. You will see adordd power in LAN or even better in a WAN with many users. Because sets are worked locally performance degradation does not happen and the speed you have with one user it is same with 40. This is the maximum I have tried but I believe that this will also be true for 200 since it will only depends of the server capacity of serving all the requests that with ADO are very few so even the server overload will not occur. Next version of adordd will be available 21-16.09. I will change the name to openrdd (Ill explain why when post it)
ADO RDD xHarbour
Antonio F. I look forward to all the new features and modifications. However, you are confirming my concerns. // with DBF RDD use customer // loads one record // with ADORDD use customer // loads the entire database So opening 20 databases with a DBF RDD loads only 20 records into memory. Opening 20 databases with ADORDD loads 20 entire databases into memory. Yes modifying your code to limit the range of the records loaded is the best solution and that is a viable option if you have a program written for a single customer. However, I am working on a commercial program that is on hundreds of sites. Most are fine with DBFs but some sites are larger with more users and more data and they would benefit from SQL. However, this means it is not practical to just use the same program and link in different RDDs for different database types. So we have two options, fork the program into two versions (twice the updates). Or, put in lots of IF/THENs--still lots more work. I'm just confirming that only in some situations are you going to be able to just link in an SQL RDD without issues--some of which may be show-stoppers. James
ADO RDD xHarbour
James, [quote:vwnnkaio]So opening 20 databases with a DBF RDD loads only 20 records into memory. Opening 20 databases with ADORDD loads 20 entire databases into memory. [/quote:vwnnkaio] Today memory its not a problem. Its cheap! 20 tables its not so much even to ADO memory management. But for sure for our kind of ISAM coding our main problem resides here! [quote:vwnnkaio]So we have two options, fork the program into two versions (twice the updates). Or, put in lots of IF/THENs--still lots more work.[/quote:vwnnkaio] May be not so much work if you can use a kind of replacement #command or may be the app has a open function that take care of all USE. [quote:vwnnkaio]I'm just confirming that only in some situations are you going to be able to just link in an SQL RDD without issues--some of which may be show-stoppers. [/quote:vwnnkaio] Stay tuned we might not be confined to Ms ADO!
ADO RDD xHarbour
Hello Antonio F, I am making progress with my main program with ADORDD. But I got a problem with ' (apostrof) Do you think there is still a way to use ' (apostrof) in a program? Example testprogram USE CUSTOMER APPEND BLANK REPLACE FIRST WITH "Test'Pieter" Errorlog: Application =========== Path and name: C:\Pieter\LeerOmgevingXharbour\learn-database.exe (32 bits) Size: 2,781,696 bytes Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20150213) FiveWin Version: FWHX 15.01 Windows version: 6.2, Build 9200 Time from start: 0 hours 0 mins 6 secs Error occurred at: 09/24/15, 13:46:41 Error description: Error ADODB.Connection/0 S_OK: EXECUTE Args: [ 1] = C UPDATE CUSTOMER SET FIRST = 'Test'Pieter' WHERE HBRECNO = 516 Stack Calls =========== Called from: => TOLEAUTO:EXECUTE( 0 ) Called from: adordd.prg => ADO_PUTVALUE( 1532 ) Called from: learn-database.prg => LEARNADORDD2( 55 ) Called from: learn-database.prg => MAIN( 22 ) System ====== CPU type: Intel(R) Pentium(R) CPU N3540 @ 2.16GHz 2166 Mhz Hardware memory: 3500 megs Free System resources: 90 % GDI resources: 90 % User resources: 90 % Windows total applications running: 4 1 , 2 , C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.9600.17810_none_a9edf0 3 DDE Server Window, C:\Windows\SYSTEM32\OLE32.DLL 4 Tussen taken schakelen, C:\Pieter\LeerOmgevingXharbour\learn-database.exe Variables in use ================ Procedure Type Value ========================== TOLEAUTO:EXECUTE Param 1: C "UPDATE CUSTOMER SET FIRST = 'Test'Pieter' WHERE HBRECNO = 516" Local 1: U Local 2: C "ADODB.Connection" ADO_PUTVALUE Param 1: N 1 Param 2: N 2 Param 3: C "'Test'Pieter'" Local 1: A Len: 38 Local 2: O Class: TOLEAUTO Local 3: N 516 Local 4: A Len: 6 Local 5: U Local 6: U Local 7: A Len: 7 LEARNADORDD2 Local 1: C "Test'Pieter" MAIN Linked RDDs =========== DBF DBFFPT DBFBLOB DBFCDX DBFNTX ADORDD DataBases in use ================ 1: => CUSTOMER RddName: ADORDD ============================== RecNo RecCount BOF EOF 516 516 .F. .F. Indexes in use TagName Relations in use Classes in use: =============== 1 ERROR 2 HASHENTRY 3 HBCLASS 4 HBOBJECT 5 TFONT 6 TWINDOW 7 TDIALOG 8 TBRUSH 9 TCONTROL 10 TXBROWSE 11 TXBRWCOLUMN 12 TBTNBMP 13 TSCROLLBAR 14 TRECT 15 TOLEAUTO 16 VTWRAPPER 17 TREG32 Memory Analysis =============== 256 Static variables Dynamic memory consume: Actual Value: 0 bytes Highest Value: 0 bytes 
ADO RDD xHarbour
Pieter, Instead of: [code=fw:rlo5j4sz]<div class="fw" id="{CB}" style="font-family: monospace;">REPLACE FIRST WITH <span style="color: #ff0000;">"Test'Pieter"</span></div>[/code:rlo5j4sz] Please try: [code=fw:rlo5j4sz]<div class="fw" id="{CB}" style="font-family: monospace;">REPLACE FIRST WITH <span style="color: #ff0000;">"Test''Pieter"</span></div>[/code:rlo5j4sz] //2' ' or [code=fw:rlo5j4sz]<div class="fw" id="{CB}" style="font-family: monospace;">REPLACE FIRST WITH <span style="color: #ff0000;">"Test<span style="color: #000000;">\'</span>Pieter"</span></div>[/code:rlo5j4sz] and let me know the result.
ADO RDD xHarbour
(1) REPLACE FIRST WITH "Test''Pieter" //gives Test'Pieter (2) //I think this ' is the same as my previous post. (I copied your code to my testapp) REPLACE FIRST WITH "Test'Pieter" Gives: Application =========== Path and name: C:\Pieter\LeerOmgevingXharbour\learn-database.exe (32 bits) Size: 2,781,696 bytes Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20150213) FiveWin Version: FWHX 15.01 Windows version: 6.2, Build 9200 Time from start: 0 hours 0 mins 5 secs Error occurred at: 09/24/15, 15:00:39 Error description: Error ADODB.Connection/0 S_OK: EXECUTE Args: [ 1] = C UPDATE CUSTOMER SET FIRST = 'Test'Pieter' WHERE HBRECNO = 520 Stack Calls =========== Called from: => TOLEAUTO:EXECUTE( 0 ) Called from: adordd.prg => ADO_PUTVALUE( 1532 ) Called from: learn-database.prg => LEARNADORDD2( 56 ) Called from: learn-database.prg => MAIN( 22 ) System ====== CPU type: Intel(R) Pentium(R) CPU N3540 @ 2.16GHz 2166 Mhz Hardware memory: 3500 megs Free System resources: 90 % GDI resources: 90 % User resources: 90 % Windows total applications running: 4 1 , 2 , C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.9600.17810_none_a9edf0 3 DDE Server Window, C:\Windows\SYSTEM32\OLE32.DLL 4 Tussen taken schakelen, C:\Pieter\LeerOmgevingXharbour\learn-database.exe Variables in use ================ Procedure Type Value ========================== TOLEAUTO:EXECUTE Param 1: C "UPDATE CUSTOMER SET FIRST = 'Test'Pieter' WHERE HBRECNO = 520" Local 1: U Local 2: C "ADODB.Connection" ADO_PUTVALUE Param 1: N 1 Param 2: N 2 Param 3: C "'Test'Pieter'" Local 1: A Len: 38 Local 2: O Class: TOLEAUTO Local 3: N 520 Local 4: A Len: 6 Local 5: U Local 6: U Local 7: A Len: 7 LEARNADORDD2 Local 1: C "Test'Pieter" MAIN Linked RDDs =========== DBF DBFFPT DBFBLOB DBFCDX DBFNTX ADORDD DataBases in use ================ 1: => CUSTOMER RddName: ADORDD ============================== RecNo RecCount BOF EOF 520 520 .F. .F. Indexes in use TagName Relations in use Classes in use: =============== 1 ERROR 2 HASHENTRY 3 HBCLASS 4 HBOBJECT 5 TFONT 6 TWINDOW 7 TDIALOG 8 TBRUSH 9 TCONTROL 10 TXBROWSE 11 TXBRWCOLUMN 12 TBTNBMP 13 TSCROLLBAR 14 TRECT 15 TOLEAUTO 16 VTWRAPPER 17 TREG32 Memory Analysis =============== 256 Static variables Dynamic memory consume: Actual Value: 0 bytes Highest Value: 0 bytes 
ADO RDD xHarbour
Pieter, The second alternative is a escape \ + ' (take out the +)
ADO RDD xHarbour
Antonio F, Thank you. Yes that also works. Pieter
ADO RDD xHarbour
I use [] all the time to build filter strings and other cases where a single ' or " may be needed. Try [code=fw:2e209lur]<div class="fw" id="{CB}" style="font-family: monospace;"><br />REPLACE FIRST WITH <span style="color: #000000;">&#91;</span>Test<span style="color: #ff0000;">'Pieter]<br /></span></div>[/code:2e209lur]
ADO RDD xHarbour
New version of adordd at <!-- m --><a class="postlink" href="https://github.com/AHFERREIRA/adordd.git">https://github.com/AHFERREIRA/adordd.git</a><!-- m --> Several small bugs corrected. SET ADO TABLES INDEX LIST TO not needed anymore. Now support for any clipper expression in index including UDFs Indexes, Scope, Filter, Seek, Locate 100% clipper compatible. Speed much improved. Now recordset its only read once when opening it. New additions by others automatically detected. New SET ADO INDEX UDFS TO to indicate to adordd the UDFs. This enables adordd to avoid building unnecessary indexes with this routine because its expensive to use it. Index data conversion functions must not be placed here. Only place here true UDFs and functions that change the size of expressions itself. TO DO 1) Deleted records not implemented yet.Will try to use maromano great routines. 2) New option in SET ADO DEFAULT DATABASE TO .. CLASSNAME where classname is a class name providing ado methods and data to avoid using ado and oledb or odbc and making it much faster. Im remembering the excellent work HDO from Manuel Exposito. Then we can be really fast and multi platform. 3) Arrays of reserved keywords SET CHECK RESERVED KEYWORDS ON /OFF to check the existence of any sql reserved word and use a dictionary to avoid changing any code in actual apps. This version has been tested in a small environment with MYSql and some new features might not be 100%. These refers mainly to Scopes, UDFs in indexes, data synchronization Place all necessary SETs in top of app, compile and link with adordd. If you find some incompatibilities please report to change it. It must run now with no code change! Enrico, James can you try new features.?
ADO RDD xHarbour
[quote="AHF":v4tg5w1n]Enrico, James can you try new features.?[/quote:v4tg5w1n] I'm very sorry but I didn't tried your ADORDD yet and I haven't the time to try it at the moment. EMG
ADO RDD xHarbour
[quote="Gale FORd":2zsgtcni]I use [] all the time to build filter strings and other cases where a single ' or " may be needed. Try [code=fw:2zsgtcni]<div class="fw" id="{CB}" style="font-family: monospace;"><br />REPLACE FIRST WITH <span style="color: #000000;">&#91;</span>Test<span style="color: #ff0000;">'Pieter]<br /></span></div>[/code:2zsgtcni][/quote:2zsgtcni] Hi Gale Ford, thanks for your reply.(still a time ago I see <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) --> ) I just tried it, it did not work by me. I got another solution for now which is: REPLACE FIRST WITH "Test''Pieter" Kind regards, Pieter
ADO RDD xHarbour
New adordd version <!-- m --><a class="postlink" href="https://github.com/AHFERREIRA/adordd.git">https://github.com/AHFERREIRA/adordd.git</a><!-- m --> 1) Some small bugs corrections, code and speed improvement. 2) NEW FEATURE : Works with deleted records just like any other dbf rdd Records are marked as deleted and they are removed from table with pack. If you choose to let other applications not to work with deleted records this way when adordd resync or requery the set if the record does not exist anymore a error number 10002 is thrown and you should take care yourself of re-position it in app code. Adordd can not guess what to do in these cases. Thanks to maromano! 3) New parameter in SET ADO DATABASE .. CLASSNAME to indicate an alternative class that should provide the methods and data needed by adordd. In this case it can work with other class that communicates directly with the DB engine. It can be much faster and multi platform. next version 1) use path to create sql files and open with same path. slashes are change to minus sign. ready within 2 weeks 2) Taking care of field name conflicts with each sql engine reserved words. Sometimes these occurrences are the source of very strange behavior and very difficult to identify.. (no time schedule yet) 2) Improved connection parameters such as Port, SSl encryption, compression, win auth, various replication servers, charset, table caching (no time schedule yet) All trials have been made with ACCESS and MySql on production. Please let me know if you find problems with other engines. FireBird its uncompleted if you need it please let me know and we will try to include it together. Enjoy it!
ADO RDD xHarbour
Antonio, please make definition of the local variables! C:\adordd\adordd.prg(1238) Warning W0001 Ambiguous reference: 'XBOOK' C:\adordd\adordd.prg(1247) Warning W0001 Ambiguous reference: 'ABOOKMARKS' C:\adordd\adordd.prg(1248) Warning W0001 Ambiguous reference: 'ABOOKMARKS' C:\adordd\adordd.prg(1248) Warning W0001 Ambiguous reference: 'ABOOKMARKS' C:\adordd\adordd.prg(1249) Warning W0001 Ambiguous reference: 'ABOOKMARKS' C:\adordd\adordd.prg(1250) Warning W0001 Ambiguous reference: 'XBOOK' C:\adordd\adordd.prg(1478) Warning W0001 Ambiguous reference: 'OERROR' C:\adordd\adordd.prg(1479) Warning W0001 Ambiguous reference: 'OERROR' C:\adordd\adordd.prg(1480) Warning W0001 Ambiguous reference: 'OERROR' C:\adordd\adordd.prg(1481) Warning W0001 Ambiguous reference: 'OERROR' C:\adordd\adordd.prg(1482) Warning W0001 Ambiguous reference: 'OERROR' C:\adordd\adordd.prg(1483) Warning W0001 Ambiguous reference: 'OERROR' C:\adordd\adordd.prg(1523) Warning W0001 Ambiguous reference: 'CSQL' C:\adordd\adordd.prg(1524) Warning W0001 Ambiguous reference: 'CSQL' C:\adordd\adordd.prg(1526) Warning W0001 Ambiguous reference: 'CSQL' C:\adordd\adordd.prg(2970) Warning W0001 Ambiguous reference: 'NDECMALS' C:\adordd\adordd.prg(5413) Warning W0001 Ambiguous reference: 'CTABLE' 5800 No code generated ** error 1 ** deleting .\adordd.hrb Drücken Sie eine beliebige Taste . . .
ADO RDD xHarbour
Gunther, Done! Thanks
ADO RDD xHarbour
Antonio, Would you mind uploading the new version (with the LOCALs) declared to Github? As you know, unless they are declared they are PRIVATEs, so I don't want to do a lot of testing when PRIVATEs may be visible outside the RDD. I know, I could declare them myself, but then I would still have to retest when your version becomes available. Regards, James
ADO RDD xHarbour
Antonio, It also seems that your TRYADORDD.PRG file has not been updated as it is erroring out with 3 errors. And there are undeclared vars too. If would really help if you could provide in this test PRG, tests of all the new functions also. Otherwise each of us has to create test programs. James
ADO RDD xHarbour
James, You re right but now I havent the time to remake it. Ill try to do it as soon as I have the time. Thanks
ADO RDD xHarbour
New version adordd at <!-- m --><a class="postlink" href="https://github.com/AHFERREIRA/adordd.git">https://github.com/AHFERREIRA/adordd.git</a><!-- m --> Please check 01_readme.pdf because some things changed a bit. New features: Use path to create sql files and open with same path. slashes are change to underscore sign. This allow to use same tables name in the same database as with database file system folder tree. Use SET ADO TABLENAME WITH PATH ON /OFF to enable this new feature. All tables must of course have been loaded with the same SET. As with other rdds you should use exactly the same routines to obtain a temporary file name from the operating system file to be created and adordd will maintain automatically those temporary files deleting it when not needed anymore. Fieldnames with reserved keywords are enclosed in "`"+fieldname+"`" it seems to woks with any keyword. Tested with MySql and ACCESS only but should wok with all others. New SET ADO TABLENAME WITH PATH ON /OFF New hb_AdoUpload( cBaseDir, cRDD, dbEngine, lOverWrite ) New HB_adorddFile( cFile) Replaces File() New hb_ADOrddCOPYFILE( cTableOrigin, cTableDestination ) Replaces CopyFile() New hb_adordddir( cPath ) imitates the directory() but on a SQL database where table names are with path. next version 1) Persistent recordsets to open huge sets (> 1000000 k) very fast after first opening. (Already on trials) 2) Improved connection parameters such as Port, SSl encryption, compression, win auth, various replication servers, charset, table caching (no time schedule yet we are still studying if it is better to defined all at the ODBC or OLEDB level)
ADO RDD xHarbour
Antonio, there are still warnings on compiling! You should use es2 as errorlevel in compiler. Compiling 'C:\adordd\adordd.prg'... C:\adordd\adordd.prg(486) Warning W0001 Ambiguous reference: 'OCATALOG' C:\adordd\adordd.prg(487) Warning W0001 Ambiguous reference: 'OCATALOG' C:\adordd\adordd.prg(1906) Warning W0001 Ambiguous reference: 'XVALUE' C:\adordd\adordd.prg(1922) Warning W0001 Ambiguous reference: 'XVALUE' C:\adordd\adordd.prg(5722) Warning W0001 Redefinition or duplicate definition of #define DBS_NAME C:\adordd\adordd.prg(5723) Warning W0001 Redefinition or duplicate definition of #define DBS_TYPE C:\adordd\adordd.prg(5724) Warning W0001 Redefinition or duplicate definition of #define DBS_LEN C:\adordd\adordd.prg(5725) Warning W0001 Redefinition or duplicate definition of #define DBS_DEC C:\adordd\adordd.prg(5757) Warning W0005 RETURN statement with no return value in function [b:pu39027y]Also this function is missing: waiton( " Subdir......"+ cFile)[/b:pu39027y]
ADO RDD xHarbour
Gunther, I dont know why didnt get those errors. Its corrected for next posted version. Meanwhile please alter in adordd.prg : C:\adordd\adordd.prg(1906) Warning W0001 Ambiguous reference: 'XVALUE' with cFieldName C:\adordd\adordd.prg(1922) Warning W0001 Ambiguous reference: 'XVALUE' with uInfo C:\adordd\adordd.prg(5757) Warning W0005 RETURN statement with no return value in function RETURN NIL You can delete these: C:\adordd\adordd.prg(5722) Warning W0001 Redefinition or duplicate definition of #define DBS_NAME C:\adordd\adordd.prg(5723) Warning W0001 Redefinition or duplicate definition of #define DBS_TYPE C:\adordd\adordd.prg(5724) Warning W0001 Redefinition or duplicate definition of #define DBS_LEN C:\adordd\adordd.prg(5725) Warning W0001 Redefinition or duplicate definition of #define DBS_DEC waiton( " Subdir......"+ cFile) Thanks
ADO RDD xHarbour
adordd finished version at <!-- m --><a class="postlink" href="https://github.com/AHFERREIRA/adordd.git">https://github.com/AHFERREIRA/adordd.git</a><!-- m --> adordd is finished! I don't have plans to add any new functionalities to it. Its now working just like any other kind dbfcdx rdd and it allows you to port your app in minutes (time to load tables) to any SQL. From now on Ill only post new versions to correct bugs. All your comments, experiences, ideas and bug reports are most welcomed! New features: 1) ADO_EXIT called internally to close all tables and connections whe exit the app. 2) Gave up the idea of persistent recordsets to open huge sets because the difference speed in opening its completely lost closing it( saving it) instead I ve made a new set. SET ADO CACHESIZE TO 100 ASYNC ON ASYNCNOWAIT ON This set has huge impact on performance opening huge tables. Playing with this set might improve significantly the opening time but then you might not have all rows available immediately. You have to test yourself if your app works ok with the different options. adordd main problem is opening huge tables without any where clause causing it to load all rows. This brings problems with loading time and memory consumption. On the other hand please remember that this would be the slowest loading time of a table no matter if you have 1 or 200 users opposite to dbfcdx kind of rdds. This is not a standard practice in SQL but to keep backwards compatibility with our apps we need to do it like this. In apps where there aren't any historic files and all data is kept in the working tables the only alternative is either to pass old data to historic files or use USE ctable WHERE where clause. If you cannot do any of these and you have huge tables adordd might not be for you and in these cases the only alternative to go to SQL is ADS as far as I know (keeping almost same app code ). The only workaround for this limitation is to build a class accessing the SQL through C interface (HDO from Exposito for ex). adordd can work with any other class as long as the few methods and data adordd use from MS ADO are replicated in that class. This class could build the sets in a local dbf files, arrays etc.
ADO RDD xHarbour
Antonio, First of all congratulations for this huge job! I'm going to test it ASAP. Just a question: Is there any working example showing all (or most of all) features of your rdd? TIA,
ADO RDD xHarbour
Kleyber, Thanks. You have tryadordd but be advise that I didnt test it myself with these last versions, but should be a good guide. There arent any special features to show, it works just like dbcdx kind rdd. The best way to test it is to upload your tables compile and link adordd and run it. Please read 01_readme.pdf you have it all there.
ADO RDD xHarbour
Thank you for your effort Antonio, I'll try it also as soon as possible.
ADO RDD xHarbour
Antonio, this error comes on different places in the code of adordd.prg. I tested with access and mssql. Error description: Error ADODB.Recordset/6 DISP_E_UNKNOWNNAME: OPEN Args: [ 1] = C SELECT `AUTO_INCREMENT` FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'adisc' AND TABLE_NAME = 'TABLE1' [ 2] = O ADODB.Connection Stack Calls =========== Called from: => TOLEAUTO:OPEN( 0 ) Called from: C:\adordd\adordd.prg => ADORECCOUNT( 806 ) Called from: C:\adordd\adordd.prg => ADO_REFRESH( 823 ) Called from: C:\adordd\adordd.prg => ADO_GOTOP( 989 ) Called from: C:\adordd\adordd.prg => ADO_OPEN( 381 )
ADO RDD xHarbour
Gunther, This routine returns the lastrec(). With access it can not error that because with engine = ACCESS its SELECT MAX--- you can check the code. As I informed previously I only tried it with Access but mainly with MySql. I suspect that with MsSql the syntax of SELECT ... FROM SCHEMA... its wrong. Do you know the correct one ? Meantime if you want to try it replace in ADORECCOUNT IF aAWData[ WA_ENGINE ] = "ACCESS" .OR. aAWData[ WA_ENGINE ] = "MSSQL" Its slower but it should work.
ADO RDD xHarbour
Antonio, with Access i read this error: Error description: Error ADODB.Recordset/6 DISP_E_UNKNOWNNAME: OPEN Args: [ 1] = C SELECT * FROM TABLE1 ORDER BY HBRECNO [ 2] = O ADODB.Connection [ 3] = N 2 [ 4] = N 3 [ 5] = N 0 Stack Calls =========== Called from: => TOLEAUTO:OPEN( 0 ) Called from: C:\adordd\adordd.prg => ADO_OPEN( 318 ) In tryadordd.prg: [code=fw:9wposlmt]<div class="fw" id="{CB}" style="font-family: monospace;">   SET ADO <span style="color: #00C800;">DEFAULT</span> DATABASE <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"D:<span style="color: #000000;">\W</span>HATEVER<span style="color: #000000;">\T</span>ESTADORDD.MDB"</span> <span style="color: #00C800;">SERVER</span> <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"ACESS"</span> ENGINE <span style="color: #0000ff;">TO</span> ACCESS USER <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">""</span> PASSWORD <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">""</span><br /> </div>[/code:9wposlmt]should be: [code=fw:9wposlmt]<div class="fw" id="{CB}" style="font-family: monospace;">SET ADO <span style="color: #00C800;">DEFAULT</span> DATABASE <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"D:<span style="color: #000000;">\W</span>HATEVER<span style="color: #000000;">\T</span>ESTADORDD.MDB"</span> <span style="color: #00C800;">SERVER</span> <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">""</span> ENGINE <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"ACCESS"</span> USER <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">""</span> PASSWORD <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">""</span><br /> </div>[/code:9wposlmt] [code=fw:9wposlmt]<div class="fw" id="{CB}" style="font-family: monospace;"> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"DOES TABLE1 EXISTS ON DB ?"</span>+CVALTOCHAR<span style="color: #000000;">&#40;</span>hb_adoRddExistsTable<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"Table1"</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />   <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"DOES TABLE3 EXISTS ON DB ?"</span>+CVALTOCHAR<span style="color: #000000;">&#40;</span>hb_adoRddExistsTable<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"Table3"</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span></div>[/code:9wposlmt] should be: [code=fw:9wposlmt]<div class="fw" id="{CB}" style="font-family: monospace;"> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"DOES TABLE1 EXISTS ON DB ?"</span>+CVALTOCHAR<span style="color: #000000;">&#40;</span>hb_adoRddExistsTable<span style="color: #000000;">&#40;</span> ,<span style="color: #ff0000;">"Table1"</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />   <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"DOES TABLE3 EXISTS ON DB ?"</span>+CVALTOCHAR<span style="color: #000000;">&#40;</span>hb_adoRddExistsTable<span style="color: #000000;">&#40;</span>, <span style="color: #ff0000;">"Table3"</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span></div>[/code:9wposlmt]
ADO RDD xHarbour
Antonio, i found the equivalent for MSSQL in function ADORECCOUNT(nWA,oRecordSet): [code=fw:ebz6tl3g]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">IF</span> aAWData<span style="color: #000000;">&#91;</span> WA_ENGINE <span style="color: #000000;">&#93;</span> = <span style="color: #ff0000;">"ACCESS"</span> <span style="color: #B900B9;">//.or. aAWData[ WA_ENGINE ] = "MSSQL"//6.08.15 ONLY WITH ACCESSIT TAKES LONGER IN BIG TABLES</span><br />&nbsp; &nbsp; &nbsp; cSql := <span style="color: #ff0000;">"SELECT MAX("</span>+<span style="color: #000000;">&#40;</span>ADO_GET_FIELD_RECNO<span style="color: #000000;">&#40;</span> aAWData<span style="color: #000000;">&#91;</span>WA_TABLENAME<span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>+<span style="color: #ff0000;">") FROM "</span>+aAWData<span style="color: #000000;">&#91;</span>WA_TABLENAME<span style="color: #000000;">&#93;</span><br />&nbsp; &nbsp;ELSEIF aAWData<span style="color: #000000;">&#91;</span> WA_ENGINE <span style="color: #000000;">&#93;</span> = <span style="color: #ff0000;">"MSSQL"</span><br />&nbsp; &nbsp;&nbsp;cSql := <span style="color: #ff0000;">"SELECT IDENT_CURRENT('"</span>+aAWData<span style="color: #000000;">&#91;</span>WA_TABLENAME<span style="color: #000000;">&#93;</span>+<span style="color: #ff0000;">"')+1 AS AUTO_INCREMENT"</span><br />&nbsp; &nbsp;<span style="color: #00C800;">ELSE</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #B900B9;">//30.06.15 REPLACED BY RAO NAGES IDEA next incremente key</span><br />&nbsp; &nbsp; &nbsp; cSql := <span style="color: #ff0000;">"SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES"</span>+;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">" WHERE TABLE_SCHEMA = '"</span>+aAWData<span style="color: #000000;">&#91;</span> WA_CATALOG <span style="color: #000000;">&#93;</span>+<span style="color: #ff0000;">"' AND TABLE_NAME = '"</span>+aAWData<span style="color: #000000;">&#91;</span> WA_TABLENAME <span style="color: #000000;">&#93;</span>+<span style="color: #ff0000;">"'"</span><br />&nbsp; &nbsp;<span style="color: #00C800;">ENDIF</span></div>[/code:ebz6tl3g]
ADO RDD xHarbour
Gunther, Great! In ACCESS its also needed [code=fw:32j3ex94]<div class="fw" id="{CB}" style="font-family: monospace;"><br />&nbsp;cSql := <span style="color: #ff0000;">"SELECT MAX("</span>+<span style="color: #000000;">&#40;</span>ADO_GET_FIELD_RECNO<span style="color: #000000;">&#40;</span> aAWData<span style="color: #000000;">&#91;</span>WA_TABLENAME<span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>+<span style="color: #ff0000;">")[b:32j3ex94]+1[/b:32j3ex94] FROM "</span>+aAWData<span style="color: #000000;">&#91;</span>WA_TABLENAME<span style="color: #000000;">&#93;</span><br />&nbsp;</div>[/code:32j3ex94] Is it working now with MSSQL?
ADO RDD xHarbour
Gunther I am just curious .. what are you trying to extract from the database .. a table structure, field attribute ? Rick Lipkin
ADO RDD xHarbour
Antonio, Rick! "SELECT IDENT_CURRENT('"+aAWData[WA_TABLENAME]+"')+1 AS AUTO_INCREMENT" i found in internet for MSSQL. Antonio, there are a error with ACCESS!!! [quote:nqrlv8wp]Error description: Error ADODB.Recordset/6 DISP_E_UNKNOWNNAME: OPEN Args: [ 1] = C SELECT * FROM TABLE1 ORDER BY HBRECNO [ 2] = O ADODB.Connection [ 3] = N 2 [ 4] = N 3 [ 5] = N 0 Stack Calls =========== Called from: => TOLEAUTO:OPEN( 0 ) Called from: C:\adordd\adordd.prg => ADO_OPEN( 318 ) [/quote:nqrlv8wp]
ADO RDD xHarbour
Gunther, Strange here its ok Is the field HBRECNO in the table ? What is your SET ADO CACHESIZE TO... ?
ADO RDD xHarbour
Antonio, now i found that the .mdb is constructed but no tables inside!! -> Also the error comes from here. I use this code: [code=fw:3fpva3xa]<div class="fw" id="{CB}" style="font-family: monospace;">DbCreate<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"table1;"</span>+cPath+<span style="color: #ff0000;">"<span style="color: #000000;">\t</span>est2.mdb"</span>, .....</div>[/code:3fpva3xa] ADO CACHESIZE i do not use!
ADO RDD xHarbour
Gunther, Those are left overs from trials. Take out ";cpath" you dot need it anymore. The database its auto created if not exist during connection. In fact if you verify the table was created in the database indicated in SET ADO DEFAULT DATABASE... Confirm?
ADO RDD xHarbour
Antonio, sorry, no tables! I test [code=fw:1sqcu213]<div class="fw" id="{CB}" style="font-family: monospace;">DbCreate<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"table2;test2.mdb"</span>, ....<br />DbCreate<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"table2;test2"</span>, ....<br />DbCreate<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"table2;<span style="color: #000000;">\t</span>est2.mdb"</span>, ....</div>[/code:1sqcu213] Antonio, i found MY bug! I check with file() the .MdB and as she is produced on connection i never come to the dbcreate()... THANKS, ALL IS OK!!!
ADO RDD xHarbour
Gunther, Do it just like in clipper DbCreate( "table2,{...) Is SET ADO DEFAULT DATABASE TO TESTADORDD.MDB ? Isnt the table there instead ?
ADO RDD xHarbour
Antonio, please see my earlier post! All is ok now! Thanks for your great work!