topic
stringlengths 1
63
| text
stringlengths 1
577k
⌀ |
|---|---|
ADO RDD xHarbour
|
Antonio,
[quote:30kd32cw]seek whatever = select * from .... where (seek expression)[/quote:30kd32cw]
Why don't you create a new RecordSet for this seek ?
This way, the original RecordSet remains intact.
|
ADO RDD xHarbour
|
Antonio,
The name of the index in the array is the name of the tag of the struct index file right?
Yes.
This approach didn't foresee to keep the struct file name index and it might not be needed.
You simply ask for the orders (tags) right?
Yes.
The struct file name itself is not needed ?
Yes.
The only thing we need is to open all indexes with the table if SET AUTO OPEN is true and place the current order accordingly to SET AUTORDER. Right?
Yes.
Let´s see it better with a sample:
So, if SET AUTOPEN is ON, after a USE .... command the indexes should be opened, i. e. calling ADORDD SET INDEX TO TAG1, TAG2, TAG3, TAG4, TAG5... going over the items from ListIndex(nOption) for such table.
For instance, if we define at ListIndex those indexes for table CUSTOMER:
[code=fw:15it8rqn]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">LOCAL</span> a := <span style="color: #000000;">{</span> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"CUSTOMER"</span>, <span style="color: #000000;">{</span><span style="color: #ff0000;">"CUSTOMER1"</span>, <span style="color: #ff0000;">"NAME"</span><span style="color: #000000;">}</span> ,;<br /> <span style="color: #000000;">{</span><span style="color: #ff0000;">"CUSTOMER2"</span>, <span style="color: #ff0000;">"NAME"</span>, <span style="color: #ff0000;">"WHERE CITY = 'Barcelona' "</span><span style="color: #000000;">}</span> ,;<br /> <span style="color: #000000;">{</span><span style="color: #ff0000;">"LUCAS"</span>, <span style="color: #ff0000;">"STREET"</span>, <span style="color: #ff0000;">"WHERE NOTES = 'varis' "</span><span style="color: #000000;">}</span> ,;<br /> <span style="color: #000000;">}</span> <span style="color: #000000;">}</span><br /> </div>[/code:15it8rqn]
So, if I do:
[code=fw:15it8rqn]<div class="fw" id="{CB}" style="font-family: monospace;"><br />SET AUTOPEN <span style="color: #0000ff;">ON</span><br /><br />USE access.mdb VIA <span style="color: #ff0000;">"ADORDD"</span> TABLE <span style="color: #ff0000;">"CUSTOMER"</span> ACCESS <span style="color: #00C800;">NEW</span> <span style="color: #0000ff;">ALIAS</span> <span style="color: #ff0000;">"CUSTOMER"</span><br /> </div>[/code:15it8rqn]
ADORDD should call
SET INDEX TO CUSTOMER1, CUSTOMER2, LUCAS
by itself.
Thank you.
|
ADO RDD xHarbour
|
Lucas,
Its done also taking in account autoorder setting.
Ill post a new version asap
Thanks for the info.
|
ADO RDD xHarbour
|
Thank you Antonio, there is no rush.
I would like to ask you how I define such indexes with functions and conditions. For instance:
[code=fw:1q9pcrp4]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">ON</span> FIELD->FSERIE + StrZero <span style="color: #000000;">(</span> FIELD->FNUMERO, <span style="color: #000000;">20</span> <span style="color: #000000;">)</span> TAG CAB<br /><br /><span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">ON</span> FIELD->FNUMERO TAG ALB <span style="color: #00C800;">FOR</span> FIELD->FP != <span style="color: #ff0000;">"S"</span><br /><br /><span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">ON</span> FIELD->TIPDOC TAG AUXILIAR3 <span style="color: #00C800;">FOR</span> !EMPTY<span style="color: #000000;">(</span> FIELD->TIPDOC <span style="color: #000000;">)</span><br /><br /><span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">ON</span> DTOS<span style="color: #000000;">(</span> FIELD->FECHA <span style="color: #000000;">)</span> TAG CARTERA3 <span style="color: #00C800;">FOR</span> FIELD->COBRO = <span style="color: #000000;">0</span></div>[/code:1q9pcrp4]
Thank you.
|
ADO RDD xHarbour
|
Lucas,
[quote="lucasdebeltran":2gwx4at7]Thank you Antonio, there is no rush.
I would like to ask you how I define such indexes with functions and conditions. For instance:
[code=fw:2gwx4at7]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">ON</span> FIELD->FSERIE + StrZero <span style="color: #000000;">(</span> FIELD->FNUMERO, <span style="color: #000000;">20</span> <span style="color: #000000;">)</span> TAG CAB<br /><br /><span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">ON</span> FIELD->FNUMERO TAG ALB <span style="color: #00C800;">FOR</span> FIELD->FP != <span style="color: #ff0000;">"S"</span><br /><br /><span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">ON</span> FIELD->TIPDOC TAG AUXILIAR3 <span style="color: #00C800;">FOR</span> !EMPTY<span style="color: #000000;">(</span> FIELD->TIPDOC <span style="color: #000000;">)</span><br /><br /><span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">ON</span> DTOS<span style="color: #000000;">(</span> FIELD->FECHA <span style="color: #000000;">)</span> TAG CARTERA3 <span style="color: #00C800;">FOR</span> FIELD->COBRO = <span style="color: #000000;">0</span></div>[/code:2gwx4at7]
Thank you.[/quote:2gwx4at7]
[code=fw:2gwx4at7]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #000000;">{</span>....<br /><span style="color: #000000;">{</span><span style="color: #ff0000;">"CAB"</span>,<span style="color: #000000;">{</span><span style="color: #ff0000;">"FSERIE,NUMERO"</span><span style="color: #000000;">}</span><span style="color: #000000;">}</span> <span style="color: #B900B9;">//I dont know strzero </span><br /><span style="color: #000000;">{</span><span style="color: #ff0000;">"ALB"</span>,<span style="color: #000000;">{</span><span style="color: #ff0000;">"FNUMERO"</span><span style="color: #000000;">}</span>,<span style="color: #000000;">{</span><span style="color: #ff0000;">"WHERE FP != 'S' "</span><span style="color: #000000;">}</span><span style="color: #000000;">}</span> <span style="color: #B900B9;">//!= depends on your DB it might only accepts <></span><br /><span style="color: #000000;">{</span><span style="color: #ff0000;">"AUXILIAR3"</span>,<span style="color: #000000;">{</span><span style="color: #ff0000;">"TIPODOC"</span><span style="color: #000000;">}</span>,<span style="color: #000000;">{</span><span style="color: #ff0000;">"WHERE TIPODOC != NULL"</span><span style="color: #000000;">}</span><span style="color: #000000;">}</span> <br /><span style="color: #000000;">{</span><span style="color: #ff0000;">"CARTEIRA3"</span>,<span style="color: #000000;">{</span><span style="color: #ff0000;">"FECHA"</span><span style="color: #000000;">}</span>,<span style="color: #000000;">{</span><span style="color: #ff0000;">"WHERE COBRO = 0 "</span><span style="color: #000000;">}</span><span style="color: #000000;">}</span> <span style="color: #000000;">}</span><br /> </div>[/code:2gwx4at7]
You can use on the condition ele of the array any sql statement permitted by your server.
Conversion functions in the index field ele are not needed in SQL.
Please remember that Indexes are truly only selects, Seeks and Locates with more than one field on the expression also.
The problem I have to start solve on Monday is Seeks and child related tables with the expression corresponding to multiple fields for a way to reset the previous recordset as soon as the result from these are not needed anymore.
Please remember that in these conditions you keep that tables with those selects.
Please try it yourself.
Open table
Open index
browse()
nRec := recno()
seek x (expr = 2 or more fields)
browse()
go to nRec
See what I mean?
|
ADO RDD xHarbour
|
Thank you Antonio.
Have you looked at arrayrdd source, SQLRDD rdd source or Mediator SQL RDD from <!-- w --><a class="postlink" href="http://www.otc.pl?">www.otc.pl?</a><!-- w -->.
It may help.
Also, if you use find for seek?. I think in ADO indexes are fine for showing the data ordered by a field, but they are not so important for searching and speed as they are in DBF.
|
ADO RDD xHarbour
|
Antonio,
DbCreate() working:
[code=fw:28owrdr1]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br /><span style="color: #00C800;">STATIC</span> <span style="color: #00C800;">FUNCTION</span> ADO_CREATE<span style="color: #000000;">(</span> nWA, aOpenInfo <span style="color: #000000;">)</span><br /><br /><br /> <span style="color: #00C800;">TRY</span><br /> <span style="color: #00C800;">IF</span> Lower<span style="color: #000000;">(</span> <span style="color: #0000ff;">Right</span><span style="color: #000000;">(</span> cDataBase, <span style="color: #000000;">4</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> == <span style="color: #ff0000;">".fdb"</span><br /> oConnection:<span style="color: #000000;">Execute</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"CREATE TABLE "</span> + cTableName + <span style="color: #ff0000;">" ("</span> + StrTran<span style="color: #000000;">(</span> StrTran<span style="color: #000000;">(</span> aWAData<span style="color: #000000;">[</span> WA_SQLSTRUCT <span style="color: #000000;">]</span>, <span style="color: #ff0000;">"["</span>, <span style="color: #ff0000;">'"'</span> <span style="color: #000000;">)</span>, <span style="color: #ff0000;">"]"</span>, <span style="color: #ff0000;">'"'</span> <span style="color: #000000;">)</span> + <span style="color: #ff0000;">")"</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ELSE</span><br /><br /> <span style="color: #B900B9;">//oConnection:Execute( "CREATE TABLE [" + cTableName + "] (" + aWAData[ WA_SQLSTRUCT ] + ")" )</span><br /><br /> N := FW_AdoCreateTableSQL<span style="color: #000000;">(</span> cTableName, aWAData<span style="color: #000000;">[</span> WA_SQLSTRUCT <span style="color: #000000;">]</span>, oConnection, .T. <span style="color: #000000;">)</span><br /> oConnection:<span style="color: #000000;">Execute</span><span style="color: #000000;">(</span> N <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">ENDIF</span><br /> CATCH<br /> oError := ErrorNew<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oError:<span style="color: #000000;">GenCode</span> := EG_CREATE<br /> oError:<span style="color: #000000;">SubCode</span> := <span style="color: #000000;">1004</span><br /> oError:<span style="color: #000000;">Description</span> := hb_langErrMsg<span style="color: #000000;">(</span> EG_CREATE <span style="color: #000000;">)</span> + <span style="color: #ff0000;">" ("</span> + ;<br /> hb_langErrMsg<span style="color: #000000;">(</span> EG_UNSUPPORTED <span style="color: #000000;">)</span> + <span style="color: #ff0000;">")"</span><br /> oError:<span style="color: #000000;">FileName</span> := aOpenInfo<span style="color: #000000;">[</span> UR_OI_NAME <span style="color: #000000;">]</span><br /> oError:<span style="color: #000000;">CanDefault</span> := .T.<br /><br /> <span style="color: #00C800;">FOR</span> n := <span style="color: #000000;">0</span> <span style="color: #0000ff;">TO</span> oConnection:<span style="color: #000000;">Errors</span>:<span style="color: #0000ff;">Count</span> - <span style="color: #000000;">1</span><br /> oError:<span style="color: #000000;">Description</span> += oConnection:<span style="color: #000000;">Errors</span><span style="color: #000000;">(</span> n <span style="color: #000000;">)</span>:<span style="color: #000000;">Description</span><br /> <span style="color: #00C800;">NEXT</span><br /><br /> UR_SUPER_ERROR<span style="color: #000000;">(</span> nWA, oError <span style="color: #000000;">)</span><br /> END<br /><br /> oConnection:<span style="color: #000000;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">RETURN</span> HB_SUCCESS<br /><br /><br /><br /><span style="color: #00C800;">STATIC</span> <span style="color: #00C800;">FUNCTION</span> ADO_CREATEFIELDS<span style="color: #000000;">(</span> nWA, aStruct <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">LOCAL</span> aWAData := USRRDD_AREADATA<span style="color: #000000;">(</span> nWA <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">LOCAL</span> n<br /><br />aWAData<span style="color: #000000;">[</span> WA_SQLSTRUCT <span style="color: #000000;">]</span> := aStruct<br /><br /><br /><span style="color: #B900B9;">/*<br /> aWAData[ WA_SQLSTRUCT ] := ""<br /><br /> FOR n := 1 TO Len( aStruct )<br /> IF n > 1<br /> aWAData[ WA_SQLSTRUCT ] += ", "<br /> ENDIF<br /> aWAData[ WA_SQLSTRUCT ] += "[" + aStruct[ n ][ DBS_NAME ] + "]"<br /> DO CASE<br /> CASE aStruct[ n ][ DBS_TYPE ] $ "C,Character"<br /> aWAData[ WA_SQLSTRUCT ] += " CHAR(" + str( aStruct[ n ][ DBS_LEN ] ) + ") NULL"<br /><br /> CASE aStruct[ n ][ DBS_TYPE ] == "V"<br /> aWAData[ WA_SQLSTRUCT ] += " VARCHAR(" + str( aStruct[ n ][ DBS_LEN ] ) + ") NULL"<br /><br /> CASE aStruct[ n ][ DBS_TYPE ] == "B"<br /> aWAData[ WA_SQLSTRUCT ] += " DOUBLE NULL"<br /><br /> CASE aStruct[ n ][ DBS_TYPE ] == "Y"<br /> aWAData[ WA_SQLSTRUCT ] += " SMALLINT NULL"<br /><br /> CASE aStruct[ n ][ DBS_TYPE ] == "I"<br /> aWAData[ WA_SQLSTRUCT ] += " MEDIUMINT NULL"<br /><br /> CASE aStruct[ n ][ DBS_TYPE ] == "D"<br /> aWAData[ WA_SQLSTRUCT ] += " DATE NULL"<br /><br /> CASE aStruct[ n ][ DBS_TYPE ] == "T"<br /> aWAData[ WA_SQLSTRUCT ] += " DATETIME NULL"<br /><br /> CASE aStruct[ n ][ DBS_TYPE ] == "@"<br /> aWAData[ WA_SQLSTRUCT ] += " TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP"<br /><br /> CASE aStruct[ n ][ DBS_TYPE ] == "M"<br /> aWAData[ WA_SQLSTRUCT ] += " TEXT NULL"<br /><br /> CASE aStruct[ n ][ DBS_TYPE ] == "N"<br /> aWAData[ WA_SQLSTRUCT ] += " NUMERIC(" + str( aStruct[ n ][ DBS_LEN ] ) + ")"<br /><br /> CASE aStruct[ n ][ DBS_TYPE ] == "L"<br /> aWAData[ WA_SQLSTRUCT ] += " LOGICAL"<br /> ENDCASE<br /> NEXT<br /><br /><br />*/</span><br /><br /><br /> <span style="color: #00C800;">RETURN</span> HB_SUCCESS<br /><br /><br /> </div>[/code:28owrdr1]
|
ADO RDD xHarbour
|
Hello Antonio,
I detected that the changes are not saved to the disk.
Have you checked this?.
Thank you.
|
ADO RDD xHarbour
|
Sample to test it:
[code=fw:2as6i00o]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> aArray := <span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /><br /><span style="color: #B900B9;">/*<br /> DbCreate( "test2.mdb;table1", { { "FIRST", "C", 30, 0 },;<br /> { "LAST", "C", 30, 0 },;<br /> { "AGE", "N", 8, 0 } }, "ADORDD" )<br /><br />*/</span><br /> USE test2.mdb VIA <span style="color: #ff0000;">"ADORDD"</span> TABLE <span style="color: #ff0000;">"table1"</span> <span style="color: #00C800;">NEW</span><br /><br />browse<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><br /> APPEND BLANK<br /> test2->First := <span style="color: #ff0000;">"HOMER si no Homer"</span><br /> test2->Last := <span style="color: #ff0000;">"Simpson"</span><br /> test2->Age := <span style="color: #000000;">45</span><br /><br /> APPEND BLANK<br /> test2->First := <span style="color: #ff0000;">"aaa Lara"</span><br /> test2->Last := <span style="color: #ff0000;">"Croft si no"</span><br /> test2->Age := <span style="color: #000000;">32</span><br /><br /><br /> GO TOP<br /><br /> <span style="color: #0000ff;">xBrowse</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> DbCloseAll<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><br /><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /> </div>[/code:2as6i00o]
|
ADO RDD xHarbour
|
Lucas, Antonio,
[quote:1pml654a]Have you looked at arrayrdd source, SQLRDD rdd source or Mediator SQL RDD from <!-- w --><a class="postlink" href="http://www.otc.pl?">www.otc.pl?</a><!-- w -->.
It may help.
Also, if you use find for seek?. I think in ADO indexes are fine for showing the data ordered by a field, but they are not so important for searching and speed as they are in DBF.[/quote:1pml654a]
I've looked arrayrdd but not the others I don't have the code.
ADO_CREATE not started yet.
I'm still struggling with seeks with more than one field in seek expr..
We have the following alternatives:
1) Select a new set with where clause with fields used in seek expr.
Pros - Good performance
Cons - Seek must be reset some how if one needs to access records out of the scope
of the select. Previous Set could be saved.
Actual solution in adorddd being tested.
2) ADO Find based on the initial select with a new column = to the fields used in the index expr.
ex : index expr - field1+field2+field3
Initial select is then:
SELECT ctable.*, (field1+field2+field3) AS INDEKEY FROM ctable ORDER BY field1+field2+field3
This allow us to use ADO Find on the INDEXKEY column and we can even create a ADO index on that
column Ex indexkey:Optimize := TRUE
Pros - Don't need any code change in the app.
Cons - Don't know how performance is
I'm implementing this to initiate trials.
3) A mixture of both above solutions:
Instead of use seek in relations create a SELECT with both related areas with the join clause = to the related
fields and the same new indexkey new column
Ex:
SELECT ctable.*, cTable2.*, ctable.(field1+field2+field3) AS INDEKEY FROM ctable,ctable2 LEFT JOIN ....
ORDER BY field1+field2+field3
Pros - Don't need any code change in the app. Only one select for the job. Best performance.
Cons - We need somehow when changing area to ctable2 or address fields in ctable2 to redirected to ctable
area. Dont know if it is possible.
I'm checking now the solution 2 but I would like to know what is your opinion.
Do you have any experience using :Find on a Optimize field on a huge table (couple of 100.000) ? Is it fast?
|
ADO RDD xHarbour
|
Antonio,
Ive a problem with bookmarks.
The value returned by bookmark its a Variant.Ex.
nrecno := oSet:bookmark
......
dbgoto(nrecno) = adordd - oSet:Bookmark := nrecno
nRecni it is received in ADO_GOTOID as integer with no decimals and might be any value.
How can we solve this?
By the way in adordd in all recno function (RECNO, GOTO etc) tests if there is a field HBRECNO in the table (autoinc)
If true it uses the value on that field for all recno operations.
This is a optional that assures that will work 100% in all situations under any kind of cursor.
|
ADO RDD xHarbour
|
Antonio,
DbSeek only supports searching into 1 field.
[quote:3gpgb7jp]DbSeek()
Searches a value in the controlling index.
Syntax
DbSeek( <xValue>, [<lSoftSeek>], [<lFindLast>] ) --> lFound
Arguments
<xValue>
The value to search for. Its data type must match the data type of the index expression of the controlling index.
<lSoftSeek>
This optional value defaults to .F. (false) causing the DbSeek() function to position the record pointer at Eof() if <xValue> is not found in the index. When .T. (true) is passed for <lSoftSeek> and <xValue> is not found in the index, the record pointer is positioned on the record with the next higher index value.
<lFindLast>
<lFindLast> is only relevant when the database contains multiple records having identical index values. It defaults to .F. (false) causing the DbSeek() function to position the record pointer on the first record found. .T. (true) instructs DbSeek() to position the record pointer on the last of multiple records having the same index value. Return
DbSeek() returns .T. (true) if <xValue> is found, otherwise .F. (false).
Description
The DbSeek() function is used to perform fast searches in databases. To accomplish this, the database must be indexed, since DbSeek() searches the value <xValue> in the controlling index, rather than in the database. It operates in the current work area, unless it is used in an aliased expression.
When DbSeek() finds <xValue> in the controlling index, it returns .T. (true) and positions the record pointer to the corresponding record. The parameter <lFindLast> optionally specifies which record to find if there are multiple records having the same index value. By default, the first record is found. If <lFindLast> is .T. (true), DbSeek() positions the record pointer on the last of the records having identical index values.
After a successful search, the function Found() returns .T. (true) until the record pointer is moved again. In addition, both functions, BoF() and EoF() return .F. (false).
If the searched value is not found, DbSeek() positions the record pointer on the "ghost record" (Lastrec()+
[/quote:3gpgb7jp]
But the real problem is that data is not saved!!!. When the program is closed, they are lost!.
Thank you very much.
|
ADO RDD xHarbour
|
Antonio,
I don't understand this line:
[quote:mpejbos1]dbgoto(nrecno) = adordd - oSet:Bookmark := nrecno[/quote:mpejbos1]
Could you please explain it ? thanks
|
ADO RDD xHarbour
|
Lucas,
[quote:3ug2ae8y]DbSeek only supports searching into 1 field.[/quote:3ug2ae8y]
Can you post the code example and index used? Here seeks more 1 field.
[quote:3ug2ae8y]But the real problem is that data is not saved!!!. When the program is closed, they are lost!.[/quote:3ug2ae8y]
To us the most important and difficult features are:
1) To have all indexes, record movement, seek, locates and relations emulating 100% ISAM as dbf and ADS.
2) Concurrent access with Transactions.
I dont foresee problems in other features but still not initiated.
As I told you I'm not looking yet for field replaces ,writes etc.
It should work but I really can not tell.
Last version its in trial with transactions!
Please check if your version already has transactions. In this case transactions only be flushed with dbcommit.
We are trying beginstrans with the first lock and committrans with dbcommit or rollbacktrans with ADOBEGINTRANS(nArea).
Could you please try it?
|
ADO RDD xHarbour
|
Antonio,
[quote="Antonio Linares":1n5bq4tx]Antonio,
I don't understand this line:
[quote:1n5bq4tx]dbgoto(nrecno) = adordd - oSet:Bookmark := nrecno[/quote:1n5bq4tx]
Could you please explain it ? thanks[/quote:1n5bq4tx]
Example:
[code=fw:1n5bq4tx]<div class="fw" id="{CB}" style="font-family: monospace;"><br />nRec := recno<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// value of bookmark in adordd returned 2.00</span><br />....<br />dbgoto<span style="color: #000000;">(</span>nRec<span style="color: #000000;">)</span> <span style="color: #B900B9;">// value in ado_gotoid() 2 ors:BookMark := nRec you get a bookmark error!</span><br /> </div>[/code:1n5bq4tx]
This means that the value returned from recno() its correct.
Then when passing it to dbgoto() it gets to ado_gotoid() in adordd incorrect.
Bookmark does not assure any specific datatype because it depends on the provider.
|
ADO RDD xHarbour
|
Lucas,
New version adordd -trial alternative seeks <!-- m --><a class="postlink" href="https://github.com/AHFERREIRA/adordd.git">https://github.com/AHFERREIRA/adordd.git</a><!-- m -->
ready : auto open, auto order, relations, record movements (go to, recno, eof, etc), locate and continue, seeks.
Search for "experimental phase" in the code to understand what I m trying to do.
Can you try relations and seeks with a medium size table (> 100.000 records) (both parent and child) on a browse to check performance?
Transactions are automatically called so please dont forget to issue dbcommit after each transaction or data wont be saved.
In this trial transacts are initiated in the first lock and ended in the first dbcommit.
Thanks
|
ADO RDD xHarbour
|
Lucas,
Is APPEND BLANK working ?
|
ADO RDD xHarbour
|
Antonio,
Please send me addfef.ch.
Thanks
|
ADO RDD xHarbour
|
Antonio,
Can you check what function is calling UR_EXISTS ?
|
ADO RDD xHarbour
|
[quote="AHF":1tttu0tv]Antonio,
Please send me addfef.ch.
Thanks[/quote:1tttu0tv]
Where is such file ? I can't find it in Harbour files neither in FWH ones.
|
ADO RDD xHarbour
|
Antonio,
[quote="AHF":3265h2ye]Antonio,
Can you check what function is calling UR_EXISTS ?[/quote:3265h2ye]
In adordd.prg there is:
aADOFunc[ UR_EXISTS ] := @ADO_EXISTS()
|
ADO RDD xHarbour
|
Antonio,
[quote:399kncp3]Where is such file ? I can't find it in Harbour files neither in FWH ones.[/quote:399kncp3]
Its mentioned in adofuncs.prg
[quote:399kncp3]In adordd.prg there is:
aADOFunc[ UR_EXISTS ] := @ADO_EXISTS()[/quote:399kncp3]
I meant what is the function calling UR_EXISTS ?
|
ADO RDD xHarbour
|
Antonio,
What are these function for?
/* non WorkArea functions */
#define UR_EXIT 95
#define UR_DROP 96
#define UR_EXISTS 97
#define UR_RENAME 98
|
ADO RDD xHarbour
|
Antonio,
adordd its almost finished and all "light" trials seem to be ok Not one line code changed!:D
adordd its prepared to work the dbseek with selects or :find and the final decision will depend on performance.
It might compensates the trade off between no code change and speed. We will see.
Now I'm missing information asked in my previous posts.
I'm finishing:
APPEND FROM and COPY TO to be parse into sql (INSERT INTO ... SELECT FROM.... ) but shouldn't be a problem.
I'm sure that many bugs will be found but we are getting there. <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
|
ADO RDD xHarbour
|
Antonio,
UR_EXIT seems as an EXIT procedure where we can do cleaning if needed.
Regarding the others, dbcmd.c uses them this way:
[code=fw:ccydbegq]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">HB_FUNC</span><span style="color: #000000;">(</span> HB_DBDROP <span style="color: #000000;">)</span><br /><span style="color: #000000;">{</span><br /> LPRDDNODE pRDDNode;<br /> HB_USHORT uiRddID;<br /> HB_ULONG ulConnection;<br /> const char * szDriver;<br /> PHB_ITEM pName;<br /><br /> szDriver = hb_parc<span style="color: #000000;">(</span> <span style="color: #000000;">3</span> <span style="color: #000000;">)</span>;<br /> <span style="color: #00C800;">if</span><span style="color: #000000;">(</span> ! szDriver <span style="color: #000000;">)</span> <span style="color: #B900B9;">/* no VIA RDD parameter, use default */</span><br /> <span style="color: #000000;">{</span><br /> szDriver = hb_rddDefaultDrv<span style="color: #000000;">(</span> <span style="color: #00C800;">NULL</span> <span style="color: #000000;">)</span>;<br /> <span style="color: #000000;">}</span><br /> ulConnection = hb_parnl<span style="color: #000000;">(</span> <span style="color: #000000;">4</span> <span style="color: #000000;">)</span>;<br /><br /> pRDDNode = hb_rddFindNode<span style="color: #000000;">(</span> szDriver, &uiRddID <span style="color: #000000;">)</span>; <span style="color: #B900B9;">/* find the RDDNODE */</span><br /> pName = hb_param<span style="color: #000000;">(</span> <span style="color: #000000;">1</span>, HB_IT_STRING <span style="color: #000000;">)</span>;<br /><br /> <span style="color: #00C800;">if</span><span style="color: #000000;">(</span> pRDDNode && pName <span style="color: #000000;">)</span><br /> hb_retl<span style="color: #000000;">(</span> SELF_DROP<span style="color: #000000;">(</span> pRDDNode, pName, hb_param<span style="color: #000000;">(</span> <span style="color: #000000;">2</span>, HB_IT_STRING <span style="color: #000000;">)</span>,<br /> ulConnection <span style="color: #000000;">)</span> == HB_SUCCESS <span style="color: #000000;">)</span>;<br /> <span style="color: #00C800;">else</span><br /> hb_errRT_DBCMD<span style="color: #000000;">(</span> EG_ARG, EDBCMD_EVAL_BADPARAMETER, <span style="color: #00C800;">NULL</span>, HB_ERR_FUNCNAME <span style="color: #000000;">)</span>;<br /><span style="color: #000000;">}</span><br /><br /><span style="color: #00C800;">HB_FUNC</span><span style="color: #000000;">(</span> HB_DBEXISTS <span style="color: #000000;">)</span><br /><span style="color: #000000;">{</span><br /> LPRDDNODE pRDDNode;<br /> HB_USHORT uiRddID;<br /> HB_ULONG ulConnection;<br /> const char * szDriver;<br /> PHB_ITEM pName;<br /><br /> szDriver = hb_parc<span style="color: #000000;">(</span> <span style="color: #000000;">3</span> <span style="color: #000000;">)</span>;<br /> <span style="color: #00C800;">if</span><span style="color: #000000;">(</span> ! szDriver <span style="color: #000000;">)</span> <span style="color: #B900B9;">/* no VIA RDD parameter, use default */</span><br /> szDriver = hb_rddDefaultDrv<span style="color: #000000;">(</span> <span style="color: #00C800;">NULL</span> <span style="color: #000000;">)</span>;<br /><br /> ulConnection = hb_parnl<span style="color: #000000;">(</span> <span style="color: #000000;">4</span> <span style="color: #000000;">)</span>;<br /><br /> pRDDNode = hb_rddFindNode<span style="color: #000000;">(</span> szDriver, &uiRddID <span style="color: #000000;">)</span>; <span style="color: #B900B9;">/* find the RDD */</span><br /> pName = hb_param<span style="color: #000000;">(</span> <span style="color: #000000;">1</span>, HB_IT_STRING <span style="color: #000000;">)</span>;<br /><br /> <span style="color: #00C800;">if</span><span style="color: #000000;">(</span> pRDDNode && pName <span style="color: #000000;">)</span><br /> hb_retl<span style="color: #000000;">(</span> SELF_EXISTS<span style="color: #000000;">(</span> pRDDNode, pName, hb_param<span style="color: #000000;">(</span> <span style="color: #000000;">2</span>, HB_IT_STRING <span style="color: #000000;">)</span>,<br /> ulConnection <span style="color: #000000;">)</span> == HB_SUCCESS <span style="color: #000000;">)</span>;<br /> <span style="color: #00C800;">else</span><br /> hb_errRT_DBCMD<span style="color: #000000;">(</span> EG_ARG, EDBCMD_EVAL_BADPARAMETER, <span style="color: #00C800;">NULL</span>, HB_ERR_FUNCNAME <span style="color: #000000;">)</span>;<br /><span style="color: #000000;">}</span><br /><br /><span style="color: #00C800;">HB_FUNC</span><span style="color: #000000;">(</span> HB_DBRENAME <span style="color: #000000;">)</span><br /><span style="color: #000000;">{</span><br /> LPRDDNODE pRDDNode;<br /> HB_USHORT uiRddID;<br /> HB_ULONG ulConnection;<br /> const char * szDriver;<br /> PHB_ITEM pTable, pIndex, pNewName;<br /><br /> szDriver = hb_parc<span style="color: #000000;">(</span> <span style="color: #000000;">4</span> <span style="color: #000000;">)</span>;<br /> <span style="color: #00C800;">if</span><span style="color: #000000;">(</span> ! szDriver <span style="color: #000000;">)</span> <span style="color: #B900B9;">/* no VIA RDD parameter, use default */</span><br /> szDriver = hb_rddDefaultDrv<span style="color: #000000;">(</span> <span style="color: #00C800;">NULL</span> <span style="color: #000000;">)</span>;<br /><br /> ulConnection = hb_parnl<span style="color: #000000;">(</span> <span style="color: #000000;">5</span> <span style="color: #000000;">)</span>;<br /><br /> pRDDNode = hb_rddFindNode<span style="color: #000000;">(</span> szDriver, &uiRddID <span style="color: #000000;">)</span>; <span style="color: #B900B9;">/* find the RDDNODE */</span><br /> pTable = hb_param<span style="color: #000000;">(</span> <span style="color: #000000;">1</span>, HB_IT_STRING <span style="color: #000000;">)</span>;<br /> pIndex = hb_param<span style="color: #000000;">(</span> <span style="color: #000000;">2</span>, HB_IT_STRING <span style="color: #000000;">)</span>;<br /> pNewName = hb_param<span style="color: #000000;">(</span> <span style="color: #000000;">3</span>, HB_IT_STRING <span style="color: #000000;">)</span>;<br /> <span style="color: #00C800;">if</span><span style="color: #000000;">(</span> pIndex && ! pNewName <span style="color: #000000;">)</span><br /> <span style="color: #000000;">{</span><br /> pNewName = pIndex;<br /> pIndex = <span style="color: #00C800;">NULL</span>;<br /> <span style="color: #000000;">}</span><br /><br /> <span style="color: #00C800;">if</span><span style="color: #000000;">(</span> pRDDNode && pTable && pNewName <span style="color: #000000;">)</span><br /> hb_retl<span style="color: #000000;">(</span> SELF_RENAME<span style="color: #000000;">(</span> pRDDNode, pTable, pIndex, pNewName,<br /> ulConnection <span style="color: #000000;">)</span> == HB_SUCCESS <span style="color: #000000;">)</span>;<br /> <span style="color: #00C800;">else</span><br /> hb_errRT_DBCMD<span style="color: #000000;">(</span> EG_ARG, EDBCMD_EVAL_BADPARAMETER, <span style="color: #00C800;">NULL</span>, HB_ERR_FUNCNAME <span style="color: #000000;">)</span>;<br /><span style="color: #000000;">}</span></div>[/code:ccydbegq]
|
ADO RDD xHarbour
|
Antonio,
[quote:owsdlucm]adordd its almost finished and all "light" trials seem to be ok Not one line code changed!:D [/quote:owsdlucm]
Excellent! <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
This is the real power of open source cooperative development:
Fernando and me started thinking about the importance of an ADO RDD and we started coding it. Later Miguel Marchuet cooperated also, and finally you completed it.
Simply great <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
|
ADO RDD xHarbour
|
Antonio,
Time to announce it in the Harbour devel and users lists <!-- s;-) --><img src="{SMILIES_PATH}/icon_wink.gif" alt=";-)" title="Wink" /><!-- s;-) -->
|
ADO RDD xHarbour
|
Antonio,
Does append blank and replace work?.
In my tests from last week once the aplication was closed, [b:3jpxuo27]data were lost[/b:3jpxuo27].
Antonio L., please wait to the announcment.
Thank you.
|
ADO RDD xHarbour
|
Ahf and others: thanks and congratulations.
I have saw announcement on xharbour forum but no on harbour forum.
is adordd harbour/xharbour compatible ? Is it operative in production environment ?
Regards
|
ADO RDD xHarbour
|
Please,
Put simple test.prg for diferents test, in github.
I like test under Sql Server and MySql.
Regards.
|
ADO RDD xHarbour
|
Rafa,
[code=fw:3akovahm]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> aArray := <span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /><br /> <span style="color: #00C800;">if</span> !file<span style="color: #000000;">(</span> <span style="color: #ff0000;">"test2.mdb )<br /> DbCreate( "</span>test2.mdb;table1<span style="color: #ff0000;">", { { "</span>FIRST<span style="color: #ff0000;">", "</span>C<span style="color: #ff0000;">", 30, 0 },;<br /> { "</span>LAST<span style="color: #ff0000;">", "</span>C<span style="color: #ff0000;">", 30, 0 },;<br /> { "</span>AGE<span style="color: #ff0000;">", "</span>N<span style="color: #ff0000;">", 8, 0 } }, "</span>ADORDD<span style="color: #ff0000;">" )<br /><br /> endif<br /><br /><br /><br /> USE test2.mdb VIA "</span>ADORDD<span style="color: #ff0000;">" TABLE "</span>table1<span style="color: #ff0000;">" NEW<br /><br />browse()<br /><br /><br /> APPEND BLANK<br /> test2->First := "</span>HOMER si no Homer<span style="color: #ff0000;">"<br /> test2->Last := "</span>Simpson<span style="color: #ff0000;">"<br /> test2->Age := 45<br /><br /> APPEND BLANK<br /> test2->First := "</span>aaa Lara<span style="color: #ff0000;">"<br /> test2->Last := "</span>Croft si no<span style="color: #ff0000;">"<br /> test2->Age := 32<br /><br /><br /> GO TOP<br /><br /> XBROWSER FASTEDIT<br /> DbCloseAll()<br /><br /><br /><br /><br />return nil<br /><br /> <br /><br /><br /></span></div>[/code:3akovahm]
|
ADO RDD xHarbour
|
[quote="lucasdebeltran":1j9uis2r]Antonio,
Does append blank and replace work?.
In my tests from last week once the aplication was closed, [b:1j9uis2r]data were lost[/b:1j9uis2r].
Antonio L., please wait to the announcment.
Thank you.[/quote:1j9uis2r]
Lucas,
The problem is with transactions please check adorrd.prg and try inhibiting transactions or try issue dbcommit() and check if it is ok.
Replace Im trying it seems to be ok.
:AddNew() is disrupted not ok anymore! (append)
The reason is that in order to enable seek expression like we do normally I had to add one more field to the selects that is INDEXKEY.
ex:
INDEX ON field1+field2+field3 TO xfile
SET INDEX TO xfile
when select
SELECT *.xfile, (field1+field2+field3) AS INDEXKEY ORDER BY field1,field2,field3
if the cursor is adUseClient INDEXKEY gets indexed by ADO.
This enable you to seek in any part of the seek key.
DBSEEK( SPACE(LEN(field1))+"whatever")
.or.
DBSEEK("whatever")
Now because INDEXKEY does not really exists in the table when we call :addnew() we get error.
Im trying to solve it.
Its an ADO problem because with SQL INSERT works ok.
May be M Rao or Enrico can give us a hand?
|
ADO RDD xHarbour
|
[quote="hmpaquito":2dzn4e7i]Ahf and others: thanks and congratulations.
I have saw announcement on xharbour forum but no on harbour forum.
is adordd harbour/xharbour compatible ? Is it operative in production environment ?
Regards[/quote:2dzn4e7i]
adordd is harbour/xharbour compatible.
There are still for sure many bugs but what is most important its to understand if the approach that Im convinced will work with almost or even no code changes in apps.
Having as many people as possible trying will help to solve all the issues more rapidly.
|
ADO RDD xHarbour
|
[quote:3smy6dlw]Having as many people as possible trying will help to solve all the issues more rapidly[/quote:3smy6dlw]
+1
|
ADO RDD xHarbour
|
Antonio,
[quote:qv7arj3m]:AddNew() is disrupted not ok anymore! (append)
The reason is that in order to enable seek expression like we do normally I had to add one more field to the selects that is INDEXKEY.
Now because INDEXKEY does not really exists in the table when we call :addnew() we get error.
Im trying to solve it.
Its an ADO problem because with SQL INSERT works ok.
May be M Rao, Enrico can give us a hand?[/quote:qv7arj3m]
I cannot find anywhere if this is a ADO limitation or if there is another way to do it!
With this would be much easy to adapt it to existing apps.
|
ADO RDD xHarbour
|
Antonio,
I have emailed Mr. Rao asking for his advice
|
ADO RDD xHarbour
|
Buenas, seria bueno quitar todo referente a Fivewin, para que sea más fácil compilar.
Por ejemplo,
[code=fw:1ez7h47r]<div class="fw" id="{CB}" style="font-family: monospace;">#ifndef __XHARBOUR__<br /><br /> #xcommand <span style="color: #00C800;">TRY</span> => BEGIN SEQUENCE WITH <span style="color: #000000;">{</span>| oErr | <span style="color: #00C800;">Break</span><span style="color: #000000;">(</span> oErr <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> #xcommand CATCH <span style="color: #000000;">[</span><!oErr!><span style="color: #000000;">]</span> => RECOVER <span style="color: #000000;">[</span>USING <oErr><span style="color: #000000;">]</span> <-oErr-><br /> #xcommand FINALLY => ALWAYS<br /> <br /> <span style="color: #00D7D7;">#define</span> UR_FI_FLAGS <span style="color: #000000;">6</span><br /> <span style="color: #00D7D7;">#define</span> UR_FI_STEP <span style="color: #000000;">7</span><br /> <span style="color: #00D7D7;">#define</span> UR_FI_SIZE <span style="color: #000000;">5</span> <span style="color: #B900B9;">// by Lucas for Harbour</span><br /><br /><br />#endif<br /><br /><span style="color: #00C800;">function</span> cValToChar<span style="color: #000000;">(</span> u <span style="color: #000000;">)</span>; <span style="color: #00C800;">return</span> CStr<span style="color: #000000;">(</span> u <span style="color: #000000;">)</span><br /><span style="color: #00C800;">function</span> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span> u <span style="color: #000000;">)</span> ; <span style="color: #00C800;">return</span> Alert<span style="color: #000000;">(</span> u <span style="color: #000000;">)</span><br /><span style="color: #00C800;">function</span> MsgAlert<span style="color: #000000;">(</span> u <span style="color: #000000;">)</span>; <span style="color: #00C800;">return</span> Alert<span style="color: #000000;">(</span> u <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">function</span> cFilePath<span style="color: #000000;">(</span> cPathMask <span style="color: #000000;">)</span> <span style="color: #B900B9;">// returns path of a filename</span><br /><br /> <span style="color: #00C800;">local</span> n := RAt<span style="color: #000000;">(</span> <span style="color: #ff0000;">"<span style="color: #000000;">\"</span>, cPathMask ), cDisk<br /><br />return If( n > 0, Upper( Left( cPathMask, n ) ),;<br /> ( cDisk := cFileDisc( cPathMask ) ) + If( ! Empty( cDisk ), "</span>\<span style="color: #ff0000;">", "</span><span style="color: #ff0000;">" ) )<br /><br />function cFileNoPath( cPathMask ) <br /><br /> local n := RAt( "</span>\<span style="color: #ff0000;">", cPathMask )<br /><br />return If( n > 0 .and. n < Len( cPathMask ),;<br /> Right( cPathMask, Len( cPathMask ) - n ),;<br /> If( ( n := At( "</span>:<span style="color: #ff0000;">", cPathMask ) ) > 0,;<br /> Right( cPathMask, Len( cPathMask ) - n ),;<br /> cPathMask ) )<br /><br />function cFileNoExt( cPathMask ) // returns the filename without ext<br /><br /> local cName := AllTrim( cFileNoPath( cPathMask ) )<br /> local n := RAt( "</span>.<span style="color: #ff0000;">", cName )<br /><br />return AllTrim( If( n > 0, Left( cName, n - 1 ), cName ) )<br /><br />function cFileDisc( cPathMask ) // returns drive of the path<br /><br />return If( At( "</span>:<span style="color: #ff0000;">", cPathMask ) == 2, ;<br /> Upper( Left( cPathMask, 2 ) ), "</span><span style="color: #ff0000;">" )<br /><br />#pragma BEGINDUMP<br />#include <hbapi.h><br /><br />HB_FUNC( LAND )<br />{<br /> hb_retl( ( hb_parnl( 1 ) & hb_parnl( 2 ) ) != 0 );<br />}<br /><br />#pragma ENDDUMP<br /></span></div>[/code:1ez7h47r]
Lucas, con harbour, en la linea 1621
[code=fw:1ez7h47r]<div class="fw" id="{CB}" style="font-family: monospace;"> <span style="color: #00C800;">IF</span> TABLES_WITH_FIELD_HB_RECNO <br /> <span style="color: #B900B9;">//create ado index only with adUseClient</span><br /> <span style="color: #00C800;">IF</span> oRecordSet:<span style="color: #000000;">CursorLocation</span> = adUseClient<br /> oRecordSet:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span> oRecordSet:<span style="color: #000000;">Fields</span>:<span style="color: #0000ff;">Count</span> <span style="color: #000000;">-1</span> <span style="color: #000000;">)</span>:<span style="color: #000000;">Properties</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"Optimize"</span><span style="color: #000000;">)</span> := <span style="color: #000000;">1</span> <span style="color: #B900B9;">// AQUI CASCA!!</span><br /> <span style="color: #00C800;">ENDIF</span><br /> <span style="color: #00C800;">ENDIF</span> </div>[/code:1ez7h47r]
Esto es lo que suelta, de momento
[code=fw:1ez7h47r]<div class="fw" id="{CB}" style="font-family: monospace;">c:\adotest>hbmk2 test.hbm<br />Harbour <span style="color: #000000;">3.2</span>.0dev <span style="color: #000000;">(</span>r1411121701<span style="color: #000000;">)</span><br />Copyright <span style="color: #000000;">(</span>c<span style="color: #000000;">)</span> <span style="color: #000000;">1999</span><span style="color: #000000;">-2014</span>, http:<span style="color: #B900B9;">//harbour-project.org/</span><br />Compiling <span style="color: #ff0000;">'test.prg'</span>...<br />Lines <span style="color: #000000;">377</span>, Functions/Procedures <span style="color: #000000;">1</span><br />Generating C source output <span style="color: #0000ff;">to</span> <span style="color: #ff0000;">'C:<span style="color: #000000;">\U</span>sers<span style="color: #000000;">\r</span>afa<span style="color: #000000;">\A</span>ppData<span style="color: #000000;">\L</span>ocal<span style="color: #000000;">\T</span>emp<span style="color: #000000;">\h</span>bmk_st8wdm.dir<span style="color: #000000;">\t</span>est.c'</span>... Done.<br />Compiling <span style="color: #ff0000;">'adordd.prg'</span>...<br />adordd.prg<span style="color: #000000;">(</span><span style="color: #000000;">1621</span><span style="color: #000000;">)</span> Error E0022 Invalid lvalue <span style="color: #ff0000;">':'</span></div>[/code:1ez7h47r]
Mi hbmk que uso;
[code=fw:1ez7h47r]<div class="fw" id="{CB}" style="font-family: monospace;">hbblink.hbc<br />hbwin.hbc<br /><br />-lxhb -lgtwin -lgtwvg -lgtgui -lhbwin -lhbmisc -lhbxpp -lhbct <br />-ic:/programacion/harbour3/include;c:\programacion\harbour32\contrib\xhb<br /><br />-otest<br />-w0<br />-es1<br />-mt<br /><br />test.prg<br />adordd.prg</div>[/code:1ez7h47r]
De todas maneras, no funciona el test que me has enviado...
C:\adotest>test
Error WINOLE/1007 No se pudo encontrar el archivo 'C:\programacion\pms\adordd\test2.mdb'. (0x80004005ft JET Database Engine (DOS Error -2147352567)
Called from TOLEAUTO:OPEN(0)
Called from ADO_OPEN(232)
Called from DBUSEAREA(0)
Called from MAIN(18)
Miraré por que no lo crea...
Saludos Cordiales
|
ADO RDD xHarbour
|
Uy, faltaba meterle un REQUEST HB_GT_WVT_DEFAULT para ver que hace
Me dice que descomente esta linea ???
// cSql := FW_AdoCreateTableSQL( cTableName, aWAData[ WA_SQLSTRUCT ], oConnection, .T. )
// oConnection:Execute( cSql )
¿ Pero esto depende de Fivewin ?
Si es así, dejo las pruebas porque no tengo ese codigo o ¿ ese codigo es libre ?
Dejo el codigo sin dependencias de FW
[code=fw:30dx4fv5]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"adordd.ch"</span><br /><br />REQUEST HB_GT_WVT_DEFAULT<br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> aArray := <span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /><br /> rddsetdefault<span style="color: #000000;">(</span> <span style="color: #ff0000;">'ADORDD'</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// Forzamos RDD por defecto de HARBOUR</span><br /><br /> <span style="color: #00C800;">if</span> !file<span style="color: #000000;">(</span> <span style="color: #ff0000;">"test2.mdb"</span> <span style="color: #000000;">)</span><br /> DbCreate<span style="color: #000000;">(</span> <span style="color: #ff0000;">"test2.mdb;table1"</span>, <span style="color: #000000;">{</span> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"FIRST"</span>, <span style="color: #ff0000;">"C"</span>, <span style="color: #000000;">30</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"LAST"</span>, <span style="color: #ff0000;">"C"</span>, <span style="color: #000000;">30</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"AGE"</span>, <span style="color: #ff0000;">"N"</span>, <span style="color: #000000;">8</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">}</span> <span style="color: #000000;">}</span>, <span style="color: #ff0000;">"ADORDD"</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">endif</span><br /><br /><br /><br /> USE test2.mdb VIA <span style="color: #ff0000;">"ADORDD"</span> TABLE <span style="color: #ff0000;">"table1"</span> <span style="color: #00C800;">NEW</span><br /><br /> browse<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><br /> APPEND BLANK<br /> test2->First := <span style="color: #ff0000;">"HOMER si no Homer"</span><br /> test2->Last := <span style="color: #ff0000;">"Simpson"</span><br /> test2->Age := <span style="color: #000000;">45</span><br /><br /> APPEND BLANK<br /> test2->First := <span style="color: #ff0000;">"aaa Lara"</span><br /> test2->Last := <span style="color: #ff0000;">"Croft si no"</span><br /> test2->Age := <span style="color: #000000;">32</span><br /><br /><br /> GO TOP<br /><br /> browse<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #B900B9;">// XBROWSER FASTEDIT</span><br /> DbCloseAll<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span></div>[/code:30dx4fv5]
Saludos Cordiales
|
ADO RDD xHarbour
|
Antonio,
[quote="AHF":hi9pr33p]May be M Rao or Enrico can give us a hand?[/quote:hi9pr33p]
I could help but I need a reduced and self-contained sample showing the problem.
EMG
|
ADO RDD xHarbour
|
Antonio,
I cannot find the cause of this error:
[quote:3sm3bidf]
argumentos <nenhuma>
descrição Workarea not in use
ficheiro <nenhuma>
genCode 35: EG_NOTABLE
operação ORDSETFOCUS
osCode (Não é erro do sistema operativo)
severity 2
subCode 2001
subSystem DBCMD
tries 0
Stack Calls
Procedimentos / Metodos (linha)
===============================
Chamado de TDMDICHILD:FECHAMDI(558)
Chamado de (b)ENCOMCLIENTES(207) //ACTIVATE WINDOW ... VALID owmdi1:FechaMdi(obrowse)
Chamado de TDMDICHILD:END(0)
Chamado de TDMDICHILD:SYSCOMMAND(0)
Chamado de TWINDOW:HANDLEEVENT(0)
Chamado de TDMDICHILD:HANDLEEVENT(0)
Chamado de _FWH(0)
Chamado de WINRUN(0)
Chamado de TMDIFRAME:ACTIVATE(0)
Chamado de MAIN(74)
[/quote:3sm3bidf]
The FechaMdi(obrowse) only closes tables nothing else.
When I close the table = oBrw:calias immediately error.
This code works many years ok with other rdds.
Do you have any idea what can cause this error?
|
ADO RDD xHarbour
|
[quote="Enrico Maria Giordano":1a56wsk8]Antonio,
[quote="AHF":1a56wsk8]May be M Rao or Enrico can give us a hand?[/quote:1a56wsk8]
I could help but I need a reduced and self-contained sample showing the problem.
EMG[/quote:1a56wsk8]
Enrico,
A self contained code its difficult but the problem is:
In adordd accordingly with the index active the select is like this:
SELECT encclist.*,(NRFACTUR+codcliente+CODIGOPROD+ARMAZEM) as indexkey FROM encclist ORDER BY NRFACTUR,codcliente,codigoprod,armazem
Where the indexkey is NRFACTUR+codcliente+CODIGOPROD+ARMAZEM.
From this recordset we cannot call oRecordSet:AddNew() it gives error.
If we use instead a recordset ike:
SELECT encclist.* FROM encclist ORDER BY NRFACTUR,codcliente,codigoprod,armazem
There inst any problem.
It will be impossible to add rows to the first recordset because of the aliase column?
|
ADO RDD xHarbour
|
Antonio,
[quote="AHF":a0j5wefs]It will be impossible to add rows to the first recordset because of the aliase column?[/quote:a0j5wefs]
No, not for the aliased column but for the calculated column.
EMG
|
ADO RDD xHarbour
|
Enrico,
Does it means we could addnew specifying others columns except the calculated column or not even that.
|
ADO RDD xHarbour
|
Antonio,
[quote="AHF":1afrr3p3]Enrico,
Does it means we could addnew specifying others columns except the calculated column or not even that.[/quote:1afrr3p3]
I think that the entire recordset is readonly, but I'm not sure. Please try.
EMG
|
ADO RDD xHarbour
|
Enrico,
Thanks. Its read only.
Do you know what can cause this?
[quote:79ds2prc]I cannot find the cause of this error:
Quote:
argumentos <nenhuma>
descrição Workarea not in use
ficheiro <nenhuma>
genCode 35: EG_NOTABLE
operação ORDSETFOCUS
osCode (Não é erro do sistema operativo)
severity 2
subCode 2001
subSystem DBCMD
tries 0
Stack Calls
Procedimentos / Metodos (linha)
===============================
Chamado de TDMDICHILD:FECHAMDI(558)
Chamado de (b)ENCOMCLIENTES(207) //ACTIVATE WINDOW ... VALID owmdi1:FechaMdi(obrowse)
Chamado de TDMDICHILD:END(0)
Chamado de TDMDICHILD:SYSCOMMAND(0)
Chamado de TWINDOW:HANDLEEVENT(0)
Chamado de TDMDICHILD:HANDLEEVENT(0)
Chamado de _FWH(0)
Chamado de WINRUN(0)
Chamado de TMDIFRAME:ACTIVATE(0)
Chamado de MAIN(74)
The FechaMdi(obrowse) only closes tables nothing else.
When I close the table = oBrw:calias immediately error.
This code works many years ok with other rdds.
Do you have any idea what can cause this error?[/quote:79ds2prc]
|
ADO RDD xHarbour
|
[quote="AHF":3bve0pxg]Antonio,
I cannot find the cause of this error:
[quote:3bve0pxg]
argumentos <nenhuma>
descrição Workarea not in use
ficheiro <nenhuma>
genCode 35: EG_NOTABLE
operação ORDSETFOCUS
osCode (Não é erro do sistema operativo)
severity 2
subCode 2001
subSystem DBCMD
tries 0
Stack Calls
Procedimentos / Metodos (linha)
===============================
Chamado de TDMDICHILD:FECHAMDI(558)
Chamado de (b)ENCOMCLIENTES(207) //ACTIVATE WINDOW ... VALID owmdi1:FechaMdi(obrowse)
Chamado de TDMDICHILD:END(0)
Chamado de TDMDICHILD:SYSCOMMAND(0)
Chamado de TWINDOW:HANDLEEVENT(0)
Chamado de TDMDICHILD:HANDLEEVENT(0)
Chamado de _FWH(0)
Chamado de WINRUN(0)
Chamado de TMDIFRAME:ACTIVATE(0)
Chamado de MAIN(74)
[/quote:3bve0pxg]
The FechaMdi(obrowse) only closes tables nothing else.
When I close the table = oBrw:calias immediately error.
This code works many years ok with other rdds.
Do you have any idea what can cause this error?[/quote:3bve0pxg]
It seems as the workarea was already closed and after OrdSetFocus() was called
|
ADO RDD xHarbour
|
ahf,
You need to tracer where close nenhuma. Exit procedures, perhaps... timers...
BTW, <nenhuma>, is bad filename, perhaps a sample...
regards
|
ADO RDD xHarbour
|
Antonio,
Why is subSystem DBCMD ? shouldnt be adordd?
Ive tested with msginfo in place I catch the exact point where error occurs and there is nothing there only close table saved in a var of an object.
close(::encomendas)
::encomendas := nil
Immediately get error. rdd Dbf or ADS ok for many years.
Ill try with debugger.
<nenhuma> means none (no file).
|
ADO RDD xHarbour
|
Dear all,
The adordd its running quite well in the real world, but I'm still finding many bugs.
The main problem is accurate record positioning.
The only solution I could find is the table with a field AUTOINC HBRECNO.
I cant find another solution. Any ideas?
The code its already prepared to both situations but be advise that without this new field can't run exactly the same app code. The adordd can work also with bookmarks if supported otherwise absoluteposition.
Please remember that changing index order and seeking more than one field in the expression will build a new recordset thus situations like described below are probably impossible without field HBRECNO.
ex1
nrec := recno() //actual recordset
set order to anther order //new recordset
go to nrec // only by pure luck it results because nrec refers to previous recordset.
ex2
nrec := recno() //actual recordset
seek " 123" // index expression filed1 len(3) field2 len(5) 2 field in seek exp means new recordset with
where clause.
do while ....
....
skip
enddo
resetseek() //returning to previous recordset
go to nreg //it might work if we save and restore previous set otherwise it not guaranteed.
Besides this it seems that all navigation,relations, seek, find,adding records and updating through the recordset its close to an end. <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
Now my main problem its translate locate expressions like year(field->datedoc) > year(date()).
Ill post last version today.
|
ADO RDD xHarbour
|
New adordd version posted <!-- m --><a class="postlink" href="https://github.com/AHFERREIRA/adordd.git">https://github.com/AHFERREIRA/adordd.git</a><!-- m -->
|
ADO RDD xHarbour
|
[quote="lucasdebeltran":2uparlvj]Antonio,
Does append blank and replace work?.
In my tests from last week once the aplication was closed, [b:2uparlvj]data were lost[/b:2uparlvj].
Antonio L., please wait to the announcment.
Thank you.[/quote:2uparlvj]
Lucas,
dbappend work and Replaces work ate least here.
|
ADO RDD xHarbour
|
Antonio,
[quote="AHF"]Antonio,
Why is subSystem DBCMD ? shouldnt be adordd?[/code]
Can you check is this correct?
|
ADO RDD xHarbour
|
Antonio,
[quote="AHF":2ncjx2p3]The main problem is accurate record positioning.
The only solution I could find is the table with a field AUTOINC HBRECNO.
I cant find another solution. Any ideas?[/quote:2ncjx2p3]
Yes, the only solution is adding an autoincrement field (for record identity). And by the way, it's good practice (if not mandatory) to have it in a SQL table.
EMG
|
ADO RDD xHarbour
|
Antonio,
[quote="AHF":2sg9eaeg]Why is subSystem DBCMD ? shouldnt be adordd?[/quote:2sg9eaeg]
No, DBCMD is for generic database error.
EMG
|
ADO RDD xHarbour
|
[quote="Enrico Maria Giordano":37rdhqht]
And by the way, it's good practice (if not mandatory) to have it in a SQL table.[/quote:37rdhqht]
Enrico,
What do you mean ?
|
ADO RDD xHarbour
|
Antonio,
[quote="AHF":1qi17ggr][quote="Enrico Maria Giordano":1qi17ggr]
And by the way, it's good practice (if not mandatory) to have it in a SQL table.[/quote:1qi17ggr]
Enrico,
What do you mean ?[/quote:1qi17ggr]
You should have an autoincrement field in each table in a SQL database. It's required for record identity.
EMG
|
ADO RDD xHarbour
|
Enrico,
Ok thats what adordd expects.
Do you have the same field name in every table?
|
ADO RDD xHarbour
|
Antonio,
[quote="AHF":1q69pndn]Enrico,
Ok thats what adordd expects.
Do you have the same field name in every table?[/quote:1q69pndn]
This is your choice. I use "ID" but you may prefer "something" + tablename so you won't have problems with the queries.
EMG
|
ADO RDD xHarbour
|
[quote:2timkq9p]This is your choice. I use "ID" but you may prefer "something" + tablename so you won't have problems with the queries.[/quote:2timkq9p]
Which problems ?
IMHO Its seems what same field for all tables is a more clear solution. (hbrecno)
|
ADO RDD xHarbour
|
hmpaquito,
The problem is that there might be users with some "id" autoinc field already in some tables thus adordd should use it and not force them to create a new field.
Antonio,
Do you agree ? Lets give the option to the programmer?
Either a default field name for all tables or a diferent field for each table
|
ADO RDD xHarbour
|
Antonio,
Maybe the solution is to check if such field with those properties exist and if not, then create hbrecno.
Not sure if both can co exist with no problems.
|
ADO RDD xHarbour
|
Antonio,
I think adordd should not be able to create new tables.
From my experience in our clients we cannot. Thats to DBadmin.
Sometimes other apps use the same DB and one cannot alter any struct indexes whatever.
Besides that there are functions already for that propose so users can work directly with it.
My approach for adordd would be place in the start of app :
[code=fw:3uuvensq]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br />SET ADO TABLES <span style="color: #0000ff;">INDEX</span> LIST <span style="color: #0000ff;">TO</span> <span style="color: #000000;">{</span> <span style="color: #000000;">{</span><span style="color: #ff0000;">"SECTOR"</span>,<span style="color: #000000;">{</span><span style="color: #ff0000;">"SECTOR"</span>,<span style="color: #ff0000;">"SECTORES"</span><span style="color: #000000;">}</span> <span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span><span style="color: #ff0000;">"CCLIENTE"</span>,<span style="color: #000000;">{</span><span style="color: #ff0000;">"COD_CLI"</span>,<span style="color: #ff0000;">"CODCLIENTE"</span><span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span><span style="color: #ff0000;">"CLIENTE"</span>,<span style="color: #ff0000;">"NOME"</span><span style="color: #000000;">}</span>,<span style="color: #000000;">{</span><span style="color: #ff0000;">"CTEMP2"</span>,<span style="color: #ff0000;">"VENDEDOR,SECTOR,CODCLIENTE"</span><span style="color: #000000;">}</span> <span style="color: #000000;">}</span> <span style="color: #000000;">}</span> <br /> <br /> SET ADO TEMPORAY NAMES <span style="color: #0000ff;">INDEX</span> LIST <span style="color: #0000ff;">TO</span> <span style="color: #000000;">{</span><span style="color: #ff0000;">"TMP"</span>,<span style="color: #ff0000;">"TEMP"</span><span style="color: #000000;">}</span><br /><br /> SET ADO FIELD RECNO TABLES LIST <span style="color: #0000ff;">TO</span> <span style="color: #000000;">{</span><span style="color: #000000;">{</span><span style="color: #ff0000;">"ENCCLIST"</span>,<span style="color: #ff0000;">"ID"</span><span style="color: #000000;">}</span>,<span style="color: #000000;">{</span><span style="color: #ff0000;">"FACTURAS"</span>,<span style="color: #ff0000;">"IDRECNO"</span><span style="color: #000000;">}</span><span style="color: #000000;">}</span><br /><br /> SET ADO <span style="color: #00C800;">DEFAULT</span> FIELD RECNO <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"HBRECNO"</span><br /><br /> </div>[/code:3uuvensq]
I Think this is flexible enough to allow all situations and not assuming wrong fields.
Agree?
|
ADO RDD xHarbour
|
ahf,
[quote="AHF":3k0yoaag]
[code=fw:3k0yoaag]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br />SET ADO TABLES <span style="color: #0000ff;">INDEX</span> LIST <span style="color: #0000ff;">TO</span> <span style="color: #000000;">{</span> <span style="color: #000000;">{</span><span style="color: #ff0000;">"SECTOR"</span>,<span style="color: #000000;">{</span><span style="color: #ff0000;">"SECTOR"</span>,<span style="color: #ff0000;">"SECTORES"</span><span style="color: #000000;">}</span> <span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span><span style="color: #ff0000;">"CCLIENTE"</span>,<span style="color: #000000;">{</span><span style="color: #ff0000;">"COD_CLI"</span>,<span style="color: #ff0000;">"CODCLIENTE"</span><span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span><span style="color: #ff0000;">"CLIENTE"</span>,<span style="color: #ff0000;">"NOME"</span><span style="color: #000000;">}</span>,<span style="color: #000000;">{</span><span style="color: #ff0000;">"CTEMP2"</span>,<span style="color: #ff0000;">"VENDEDOR,SECTOR,CODCLIENTE"</span><span style="color: #000000;">}</span> <span style="color: #000000;">}</span> <span style="color: #000000;">}</span> <br /> <br /> SET ADO FIELD RECNO TABLES LIST <span style="color: #0000ff;">TO</span> <span style="color: #000000;">{</span><span style="color: #000000;">{</span><span style="color: #ff0000;">"ENCCLIST"</span>,<span style="color: #ff0000;">"ID"</span><span style="color: #000000;">}</span>,<span style="color: #000000;">{</span><span style="color: #ff0000;">"FACTURAS"</span>,<span style="color: #ff0000;">"IDRECNO"</span><span style="color: #000000;">}</span><span style="color: #000000;">}</span><br /><br /> SET ADO <span style="color: #00C800;">DEFAULT</span> FIELD RECNO <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"HBRECNO"</span><br /><br /> </div>[/code:3k0yoaag]
[/quote:3k0yoaag]
I think these global variables or sets should be configured by database and not by application. An application can open multiple databases.
|
ADO RDD xHarbour
|
Antonio,
[quote="hmpaquito":1pdv76q0][quote:1pdv76q0]This is your choice. I use "ID" but you may prefer "something" + tablename so you won't have problems with the queries.[/quote:1pdv76q0]
Which problems ?
IMHO Its seems what same field for all tables is a more clear solution. (hbrecno)[/quote:1pdv76q0]
Problem with joins. In a join you can't have field with same name from different tables so you have to use AS clause.
EMG
|
ADO RDD xHarbour
|
Enrico,
Thats true. But thats to the DB admin and the app developer to define.
adordd should cover any situation so I think the best way is to let to the developer define those in the previous sets.
Wont you agree or do you have a better way?
|
ADO RDD xHarbour
|
Hello,
I have not been able to test latter versions due to a lack of time.
I think we should use always HBRECNO, as it´s not a common field name like ID, which is the one I use. In fact, SQLRDD from xHarbour.com uses a private field for such purpouses.
I also think ADORDD should be able to create "tables", with dbcreate.
In fact, to achieve the equal behaviour as DBFCDX, index auto open should be present.
And the user should [b:14nf5l8x]only do two little changes[/b:14nf5l8x]:
Define at FUNCTION ListIndex() the indexes. They will be opened with SET INDEX TO INDEX1, INDEX2, INDEX3... if SET AUTOPEN is OFF.
Define globally with a SetUp ADORDD function the RBDM type (Access, MSSQL, MySQL..), the server, the user name, the password to connect and the database name.
That´s all.
DbCreate now needs to pass some extra parameeters with ;. Once the above function is created, DBcreate should work as ordinary in DBFCDX:
[code=fw:14nf5l8x]<div class="fw" id="{CB}" style="font-family: monospace;">DbCreate<span style="color: #000000;">(</span> <cDatabase> , ;<br /> <aStructure>, ;<br /> <span style="color: #000000;">[</span><cDriver><span style="color: #000000;">]</span> , ;<br /> <span style="color: #000000;">[</span><lNewArea><span style="color: #000000;">]</span> , ;<br /> <span style="color: #000000;">[</span><cAlias><span style="color: #000000;">]</span> <span style="color: #000000;">)</span> --> <span style="color: #00C800;">NIL</span><br /> </div>[/code:14nf5l8x]
Thank you.
|
ADO RDD xHarbour
|
Sorry, it´s not working.
Test simple:
[code=fw:2pytclpz]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"adordd<span style="color: #000000;">\a</span>dordd.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"adordd<span style="color: #000000;">\a</span>dordd.prg"</span><br /><br /><br />REQUEST ADORDD<br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> aArray := <span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /><br /><br /> RDDSETDEFAULT<span style="color: #000000;">(</span> <span style="color: #ff0000;">"ADORDD"</span> <span style="color: #000000;">)</span><br /><br /><br /> <span style="color: #00C800;">IF</span> !FILE<span style="color: #000000;">(</span> <span style="color: #ff0000;">"test2.mdb"</span> <span style="color: #000000;">)</span><br /><br /> DbCreate<span style="color: #000000;">(</span> <span style="color: #ff0000;">"test2.mdb;table1"</span>, <span style="color: #000000;">{</span> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"FIRST"</span>, <span style="color: #ff0000;">"C"</span>, <span style="color: #000000;">30</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"LAST"</span>, <span style="color: #ff0000;">"C"</span>, <span style="color: #000000;">30</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"AGE"</span>, <span style="color: #ff0000;">"N"</span>, <span style="color: #000000;">8</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">}</span> <span style="color: #000000;">}</span>, <span style="color: #ff0000;">"ADORDD"</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /><br /> USE test2.mdb VIA <span style="color: #ff0000;">"ADORDD"</span> TABLE <span style="color: #ff0000;">"table1"</span> <span style="color: #00C800;">NEW</span> <span style="color: #0000ff;">ALIAS</span> <span style="color: #ff0000;">"TEST2"</span><br /><br /> XBROWSER FASTEDIT<br /><br /><br /> APPEND BLANK<br /> test2->First := <span style="color: #ff0000;">"HOMER si no Homer"</span><br /> test2->Last := <span style="color: #ff0000;">"Simpson"</span><br /> test2->Age := <span style="color: #000000;">45</span><br /><br /> APPEND BLANK<br /> test2->First := <span style="color: #ff0000;">"aaa Lara"</span><br /> test2->Last := <span style="color: #ff0000;">"Croft si no"</span><br /> test2->Age := <span style="color: #000000;">32</span><br /><br /><br /> GO TOP<br /><br /> <span style="color: #0000ff;">xBrowse</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> DbCloseAll<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><br /><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><br /> </div>[/code:2pytclpz]
|
ADO RDD xHarbour
|
Lucas,
[quote:38isdix2]I think we should use always HBRECNO, as it´s not a common field name like ID, which is the one I use. In fact, SQLRDD from xHarbour.com uses a private field for such purpouses.
[/quote:38isdix2]
I choose to give this to the developer. Please see my previous post about SET...
[quote:38isdix2]I also think ADORDD should be able to create "tables", with dbcreate.[/quote:38isdix2]
You can.
[quote:38isdix2]In fact, to achieve the equal behaviour as DBFCDX, index auto open should be present.[/quote:38isdix2]
It is working.
[quote:38isdix2]Define at FUNCTION ListIndex() the indexes. They will be opened with SET INDEX TO INDEX1, INDEX2, INDEX3... if SET AUTOPEN is OFF.[/quote:38isdix2]
AUTO OPEN and SET AUTOORDER should be working.
[quote:38isdix2]Define globally with a SetUp ADORDD function the RBDM type (Access, MSSQL, MySQL..), the server, the user name, the password to connect and the database name. [/quote:38isdix2]
Can you supply code?
[quote:38isdix2]DbCreate now needs to pass some extra parameeters with ;. Once the above function is created, DBcreate should work as ordinary in DBFCDX:[/quote:38isdix2]
What do you mean?
[quote:38isdix2]Sorry, it´s not working.
Test simple:
Code:
#include "fivewin.ch"
#include "adordd\adordd.ch"
#include "adordd\adordd.prg"
[/quote:38isdix2]
Whats the error ? and Whats the version?
|
ADO RDD xHarbour
|
Hello,
XBROWSER FASTEDIT
[quote:alm8os5u]
Error description: Error BASE/1068 Argument error: array access
Args:
[ 1] = U
[ 2] = N 1
Stack Calls
===========
Called from: lucas.prg => (b)ADO_INDEXAUTOOPEN( 1269 )
Called from: => ASCAN( 0 )
Called from: lucas.prg => ADO_INDEXAUTOOPEN( 1269 )
Called from: lucas.prg => ADO_OPEN( 382 )
Called from: => DBUSEAREA( 0 )
Called from: lucas.prg => MAIN( 31 )
[/quote:alm8os5u]
|
ADO RDD xHarbour
|
Next, I SET AUTOPEN OFF:
[quote:1aix0ufl]
Error description: Error BASE/1075 Argument error: >
Args:
[ 1] = N 1
[ 2] = C
Stack Calls
===========
Called from: .\source\classes\DATABASE.PRG => ORDERTAGINFO( 1258 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:SETRDD( 4135 )
Called from: .\source\classes\XBROWSE.PRG => XBRWSETDATASOURCE( 13030 )
Called from: .\source\function\XBROWSER.PRG => XBROWSE( 112 )
Called from: lucas.prg => MAIN( 35 )
[/quote:1aix0ufl]
|
ADO RDD xHarbour
|
Lucas,
I dont know the error. Have you check if index table and names are correct
Was it working in a previous version?
[quote:35vzy7bc]Called from: .\source\classes\DATABASE.PRG => ORDERTAGINFO( 1258 )[/quote:35vzy7bc]
What is that function line doing ?
I hope to post soon today new version that seems to have all these resolved
|
ADO RDD xHarbour
|
[code=fw:lid93e3o]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">function</span> OrderTagInfo<span style="color: #000000;">(</span> aStruct, nCol <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> nFor, nAt, i, nOrders, aTokens, lCond, aCond, aPos<br /><br /> <span style="color: #00C800;">DEFAULT</span> aStruct := DbStruct<span style="color: #000000;">(</span><span style="color: #000000;">)</span>, ;<br /> nCol := DBS_TAG<br /><br /> aCond := Array<span style="color: #000000;">(</span> Len<span style="color: #000000;">(</span> aStruct <span style="color: #000000;">)</span> <span style="color: #000000;">)</span>; AFill<span style="color: #000000;">(</span> aCond, .f. <span style="color: #000000;">)</span><br /> aPos := Array<span style="color: #000000;">(</span> Len<span style="color: #000000;">(</span> aStruct <span style="color: #000000;">)</span> <span style="color: #000000;">)</span>; AFill<span style="color: #000000;">(</span> aPos, <span style="color: #000000;">0</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">for</span> nFor := <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> Len<span style="color: #000000;">(</span> aStruct <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">if</span> Len<span style="color: #000000;">(</span> aStruct<span style="color: #000000;">[</span> nFor <span style="color: #000000;">]</span> <span style="color: #000000;">)</span> < nCol<br /> ASize<span style="color: #000000;">(</span> aStruct<span style="color: #000000;">[</span> nFor <span style="color: #000000;">]</span>, nCol <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">next</span> nFor<br /><br /> nOrders := OrdCount<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">for</span> nFor := <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> nOrders<br /><br /> lCond := ! Empty<span style="color: #000000;">(</span> OrdFor<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /> aTokens := GetTokens<span style="color: #000000;">(</span> OrdKey<span style="color: #000000;">(</span> nFor <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">for</span> i := <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> Len<span style="color: #000000;">(</span> aTokens <span style="color: #000000;">)</span><br /> nAt := AScan<span style="color: #000000;">(</span> aStruct, <span style="color: #000000;">{</span> |aFld| aFld<span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span> == aTokens<span style="color: #000000;">[</span> i <span style="color: #000000;">]</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">if</span> nAt > <span style="color: #000000;">0</span><br /> <span style="color: #00C800;">if</span> aStruct<span style="color: #000000;">[</span> nAt <span style="color: #000000;">]</span><span style="color: #000000;">[</span> nCol <span style="color: #000000;">]</span> == <span style="color: #00C800;">nil</span> .or. <span style="color: #000000;">(</span> aCond<span style="color: #000000;">[</span> nAt <span style="color: #000000;">]</span> .and. ! lCond <span style="color: #000000;">)</span> .or. ;<br /> <span style="color: #000000;">(</span> aPos<span style="color: #000000;">[</span> nAt <span style="color: #000000;">]</span> > i <span style="color: #000000;">)</span><br /> aStruct<span style="color: #000000;">[</span> nAt <span style="color: #000000;">]</span><span style="color: #000000;">[</span> nCol <span style="color: #000000;">]</span> := Upper<span style="color: #000000;">(</span> OrdName<span style="color: #000000;">(</span> nFor <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> aCond<span style="color: #000000;">[</span> nAt <span style="color: #000000;">]</span> := lCond<br /> aPos<span style="color: #000000;">[</span> nAt <span style="color: #000000;">]</span> := i<br /> <span style="color: #00C800;">endif</span><br /> EXIT<br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">next</span> i<br /><br /> <span style="color: #00C800;">next</span> nFor<br /><br /><span style="color: #00C800;">return</span> aStruct<br /> </div>[/code:lid93e3o]
Error is at OrdCount():
nOrders := OrdCount()
for nFor := 1 to nOrders
|
ADO RDD xHarbour
|
Lucas,
You dont have open indexes right ?
|
ADO RDD xHarbour
|
No.
|
ADO RDD xHarbour
|
Antonio, Enrico,
How can we show or hide deleted records in ADO?
How can we enforce SET DELETED?
|
ADO RDD xHarbour
|
Antonio,
[quote="AHF":3hkwsvkt]Antonio, Enrico,
How can we show or hide deleted records in ADO?
How can we enforce SET DELETED?[/quote:3hkwsvkt]
As far as I know, there is no direct support for deleted records in SQL. You have to add a logical field and use it in WHERE clauses, I'm afraid.
EMG
|
ADO RDD xHarbour
|
Perhaps a first version of ADORDD no need to treat the deleted records because generally all have SET DELETED ON at the beginning of our programs
|
ADO RDD xHarbour
|
Enrico,
In fact this is not a problem because deleting records in SQL will wipe records off the table and we cannot recover them again. Is this true for all DB Sql ?
|
ADO RDD xHarbour
|
Antonio,
[quote="AHF":iahikai4]Enrico,
In fact this is not a problem because deleting records in SQL will wipe records off the table and we cannot recover them again. Is this true for all DB Sql ?[/quote:iahikai4]
I don't know but we have to make it "database aware", haven't we?
EMG
|
ADO RDD xHarbour
|
Enrico,
Do you mean mark a record as deleted with truly deleted in SQL using a delete field in the tables?
In dbf apps we have to pack to clean it and some kind of recycle to recover it when adding records.
If we truly delete it nothing else mus be done. Although recall and pack exists in adordd but do nothing.
The trials we ae running with our app there is no problem but maybe others have a different approach.
Is it worth to do it ?
What do you think ?
|
ADO RDD xHarbour
|
The only drawback I see is this case:
[code=fw:1ev9mbpo]<div class="fw" id="{CB}" style="font-family: monospace;">nRec: = RecNo<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />DELETE<br /><br />GO nRec <span style="color: #B900B9;">// Ok dbf. ADO Fail</span></div>[/code:1ev9mbpo]
My opinion: will be few occasions or applications that this circumstance. At the moment I do not think it worthwhile to consider it. Perhaps ADORDD v2.00
|
ADO RDD xHarbour
|
Antonio,
[quote="AHF":ytv53x7p]Enrico,
Do you mean mark a record as deleted with truly deleted in SQL using a delete field in the tables?[/quote:ytv53x7p]
Yes.
[quote="AHF":ytv53x7p]In dbf apps we have to pack to clean it and some kind of recycle to recover it when adding records.
If we truly delete it nothing else mus be done. Although recall and pack exists in adordd but do nothing.
The trials we ae running with our app there is no problem but maybe others have a different approach.
Is it worth to do it ?
What do you think ?[/quote:ytv53x7p]
No, it's not worthwhile. <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
EMG
|
ADO RDD xHarbour
|
To All
I think each RDMS handles deleted records a bit differently .. As in all Sql Databases, when a record is Deleted, it just drops off the 'radar' and there is no need to even worry about it or even to 'Recall' it .. I do not even think you can get it back unless you use some sort of 'roll back' technique.
I will say this .. it is obvious with Ms Access, that the size of the database DOES NOT decrease when you have deleted records so they still must be there, but are just not accessible, hence why you have to Compact and Repair the database from time to time. And, my guess when DBA's tune their MS Sql and Oracles of the world, deleted records are purged during that process.
In any case .. in my experience as a developer with Sql databases .. once a record is deleted, you might as well forget about it and 'Setting Deleted (On or Off )' is irrelevant.
Rick Lipkin
|
ADO RDD xHarbour
|
Rick,
Thanks for the info.
Inside transactions if it fails everything rolled back, but its the only situation I can find where his happens.
Are you trying adordd. All feed back its a great help.
Im trying it for a big app conversion and browses with relations run without any code change except a autoinc field to use for recno().
|
ADO RDD xHarbour
|
Is possible get library for Borland C 5.5 ?
Today, direct from Harbour, is imposible make this library.
Regards
O te pago una cerveza si lo consigues... <!-- s;-) --><img src="{SMILIES_PATH}/icon_wink.gif" alt=";-)" title="Wink" /><!-- s;-) -->
|
ADO RDD xHarbour
|
Antonio
I use the ADO Class and methods to create recordsets to manage SQL.. and creating separate recordsets based on the primary key and the foreign key or a single recordset based on inner and outer joins.. not necessarily like we used to with .Dbf.
I am watching this thread with interest.
Rick Lipkin
|
ADO RDD xHarbour
|
Rick,
Thats the SQL normal way.
Unfortunately we would get only one recordset (joined) and to simulate Dbf behavior and working with already written apps that's not possible because it breaks completely the code.
Thus I'm working with true relations issuing SELECTS for each child only if key changes.
The speed suffers but its completely acceptable.
I'm converting a big app and till now in browses didn't need to change a single line of code!
We have indexes, scopes, seeks, relations, filters (translated to Selets) using exactly the same app source code.
Take a look at the adordd.
Your comments and ideas would be most welcome.
Ill post new version with lot of bugs corrected tomorrow morning.
The actual posted version has been much modified and is very outdated.
|
ADO RDD xHarbour
|
Antonio,
[quote:1g0wrn9i]I'm converting a big app and till now in browses didn't need to change a single line of code![/quote:1g0wrn9i]
Wonderful! <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
|
ADO RDD xHarbour
|
with translate.google.com
great initiative
1. They give the ultimate solution database engine ... update with trend data management
2. For those who have SQLRDD of xharbour.com ... could go with fwh + harbor + ADORDD
3. Invite colleagues who have some kind of rdd ( mysql , dhs, etc ) ,,, to join efforts towards common product and very comprehensive
4. Would give an identity to products: Fivewin SQL , fiveTouch and fiveWeb .. excellent working tool
5. We could think of a contribution to encourage this development , much like the QT project or EasyReport
Greetings ...
Johnson Russi
Colombia
|
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 -->
Please help trying it.
|
ADO RDD xHarbour
|
Hello,
Sorry, but it does not work under Harbour. Many warnings and errors when compiling...
|
ADO RDD xHarbour
|
Elvira,
Place this at top adordd.prg:
This has not been tested by me because I only use xHarbor.
[code][#ifndef __XHARBOUR__
#xcommand TRY => BEGIN SEQUENCE WITH {| oErr | Break( oErr ) }
#xcommand CATCH [<!oErr!>] => RECOVER [USING <oErr>] <-oErr->
#xcommand FINALLY => ALWAYS
#include "fivewin.ch" // as Harbour does not have TRY / CATCH IF YOU DONT HAVE COMENT THIS LINE
#define UR_FI_FLAGS 6
#define UR_FI_STEP 7
#define UR_FI_SIZE 5 // by Lucas for Harbour
//13.04.15 functions given by thefull to compile with Harbour WITHOUT FIVEWIN
function cValToChar( u ); return CStr( u )
function MsgInfo( u ) ; return Alert( u )
function MsgAlert( u ); return Alert( u )
function cFilePath( cPathMask ) // returns path of a filename
local n := RAt( "\", cPathMask ), cDisk
return If( n > 0, Upper( Left( cPathMask, n ) ),;
( cDisk := cFileDisc( cPathMask ) ) + If( ! Empty( cDisk ), "\", "" ) )
function cFileNoPath( cPathMask )
local n := RAt( "\", cPathMask )
return If( n > 0 .and. n < Len( cPathMask ),;
Right( cPathMask, Len( cPathMask ) - n ),;
If( ( n := At( ":", cPathMask ) ) > 0,;
Right( cPathMask, Len( cPathMask ) - n ),;
cPathMask ) )
function cFileNoExt( cPathMask ) // returns the filename without ext
local cName := AllTrim( cFileNoPath( cPathMask ) )
local n := RAt( ".", cName )
return AllTrim( If( n > 0, Left( cName, n - 1 ), cName ) )
function cFileDisc( cPathMask ) // returns drive of the path
return If( At( ":", cPathMask ) == 2, ;
Upper( Left( cPathMask, 2 ) ), "" )
#pragma BEGINDUMP
#include <hbapi.h>
HB_FUNC( LAND )
{
hb_retl( ( hb_parnl( 1 ) & hb_parnl( 2 ) ) != 0 );
}
#pragma ENDDUMP
#endif
/code]
|
ADO RDD xHarbour
|
Antonio, Enrico,Mr Rao,
We have to decide for a way to go but with a few trials and small tables (30.000 records) its difficult to take an option.
May be you have some experience with it.
The problem is when we make a seek with more than on field in the seek expression.(locate will be the same):
1) Today's way in adordd
Opens another record set with where clause for that seek expression
This becomes the working record set with only the records matching the seek expression.
When we need to go to a record outside of this scope adordd has to "guess" it and return the previous
working record set.
This tends to be cumbersome.
Pros : Very fast.
One operation only- open new recordset
Cons: adordd has to do some guessing
2) Another way is to have a new record set with the records matching the seek expression.
Get the record number (defined autoinc field ) from the new record set accordingly to lsoftseek, lfindlast
Close the new record set.
:Find the record number from the new record set in the actual working record set
Return to normal operation.
Pros: adordd has nothing to "guess", same behavior as dbfs
In Oracle seems to be very fast in others DB dont know!
Cons: number of operations :
Open a new recordset
Close new recordset
:Find record in actual working record set
It will not work without some autoinc field to be used as recno because bookmarks
are not guarantee to be the same between difference record sets
EX.
[code=fw:jqoxobx2]<div class="fw" id="{CB}" style="font-family: monospace;"><br />nrec := recno<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">if</span> seek <span style="color: #ff0000;">"whatever whatever2"</span> <span style="color: #B900B9;">// 2 fields in seek expression // 1) new recordset 2) the same</span><br /> <span style="color: #00C800;">do</span> <span style="color: #00C800;">while</span> seek expression = .t.<br /> ....<br /> skip<br /> <span style="color: #00C800;">enddo</span><br /><span style="color: #00C800;">endif</span><br />go <span style="color: #0000ff;">to</span> nrec <span style="color: #B900B9;">// 1) out of the scope needs to revert to previous record set 2) the same record set :find that record</span><br /> </div>[/code:jqoxobx2]
Personally I like more option 2 but....
Please give me your ideas.
|
ADO RDD xHarbour
|
Antonio,
[quote="AHF":2w5zoo0y]Cons: adordd has to do some guessing[/quote:2w5zoo0y]
Please explain this point.
EMG
|
ADO RDD xHarbour
|
[quote="Enrico Maria Giordano":ewe90o4k]Antonio,
[quote="AHF":ewe90o4k]Cons: adordd has to do some guessing[/quote:ewe90o4k]
Please explain this point.
EMG[/quote:ewe90o4k]
Enrico,
In option 1) adordd creates a new recordset but the nrec saved before the seek it will not exist in the new recordset that becomes the working one.
Thus adordd tries to find that record when go to nrec gets called, if it doesnt reverts to the previous recordset (without where clause seek expression).
So adordd guesses if the record its not in the current recordset its in the previous one and restart it.
In option 2) that problem doesnt exists because the working recordset never changes.
The new open recordset with where clause matching the seek expression its only used to extract the record number of the first match and then find it in the working recordset.
The working recordset never changes.
The best way for you to understand is test it:
[code=fw:ewe90o4k]<div class="fw" id="{CB}" style="font-family: monospace;"><br />nrec :=recno<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />seek expression with <span style="color: #000000;">2</span> fields<br />browse<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <br />go <span style="color: #0000ff;">to</span> nrec <span style="color: #B900B9;">//error</span><br />set <span style="color: #0000ff;">index</span> <span style="color: #0000ff;">to</span><br />go <span style="color: #0000ff;">to</span> nrec <span style="color: #B900B9;">//ok</span><br />browse<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> </div>[/code:ewe90o4k]
Can you see the difference?
The main issue here is performance.
Can you test this with MySql with tables bigger than 100.0000 recs and with cursor adUseClient and adUseServer ?
|
ADO RDD xHarbour
|
neither the first nor the second option, but both
my proposal:
basic programming: compatibility mode: 2nd option
advanced programming: 1st option. New command ADORDD_SEEK
|
ADO RDD xHarbour
|
[quote="hmpaquito":9o4itq3r]neither the first nor the second option, but both
my proposal:
basic programming: compatibility mode: 2nd option
advanced programming: 1st option. New command ADORDD_SEEK[/quote:9o4itq3r]
hmpaquito,
Its a good proposal.
Then we would have :
ADO_SEEK(cExpression) = seek build new recordset
ADO_SEEK() reset to previous recordset
And its to the programmer to decide where to pace each.
|
ADO RDD xHarbour
|
The question remains is :find quick enough to work with in average size tables ( 100.0000 records) in every DB?
|
ADO RDD xHarbour
|
[quote="Rick Lipkin":1z4cdh54]Antonio
I use the ADO Class and methods to create recordsets to manage SQL.. and creating separate recordsets based on the primary key and the foreign key or a single recordset based on inner and outer joins.. not necessarily like we used to with .Dbf.
I am watching this thread with interest.
Rick Lipkin[/quote:1z4cdh54]
Rick,
Could you share code for creating separate recordsets based on the primary key and the foreign key ?
|
ADO RDD xHarbour
|
Here are an example .. lets open an Invoice table for [InvoiceNumber] = 354 then open the InvoiceDetail for the foreign key also named [InvoiceNumber]
[code=fw:2x64qiiu]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br />Func _Invoice<span style="color: #000000;">(</span>nRepairNumber<span style="color: #000000;">)</span> <span style="color: #B900B9;">// 354</span><br /><br /><span style="color: #00C800;">Local</span> cSql,oRsInvoice,oRsInvoiceDetail,oErr<br /><br />...<br />...<br />..<br /><br />cSql := <span style="color: #ff0000;">"Select * from [Invoice] where [Invoice Number] = "</span>+ltrim<span style="color: #000000;">(</span>str<span style="color: #000000;">(</span>nRepairNumber<span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /><br />oRsInvoice := TOleAuto<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"ADODB.Recordset"</span> <span style="color: #000000;">)</span><br />oRsInvoice:<span style="color: #000000;">CursorType</span> := <span style="color: #000000;">1</span> <span style="color: #B900B9;">// opendkeyset</span><br />oRsInvoice:<span style="color: #000000;">CursorLocation</span> := <span style="color: #000000;">3</span> <span style="color: #B900B9;">// local cache</span><br />oRsInvoice:<span style="color: #000000;">LockType</span> := <span style="color: #000000;">3</span> <span style="color: #B900B9;">// lockoportunistic</span><br /><br /><span style="color: #00C800;">TRY</span><br /> oRsInvoice:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span> cSQL,xCONNECT <span style="color: #000000;">)</span><br />CATCH oErr<br /> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"Error in Opening INVOICE table"</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">RETURN</span><span style="color: #000000;">(</span>.F.<span style="color: #000000;">)</span><br />END <span style="color: #00C800;">TRY</span><br /><br /><span style="color: #00C800;">If</span> oRsInvoice:<span style="color: #000000;">Eof</span><br /> <span style="color: #0000ff;">Msginfo</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"Could not find Invoice "</span>+trim<span style="color: #000000;">(</span>str<span style="color: #000000;">(</span>nRepairNumber<span style="color: #000000;">)</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> oRsInvoice:<span style="color: #000000;">CLose</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oRsInvoice := <span style="color: #00C800;">nil</span><br /> <span style="color: #00C800;">Return</span><span style="color: #000000;">(</span>.f.<span style="color: #000000;">)</span><br /><span style="color: #00C800;">Endif</span><br /><br /><span style="color: #B900B9;">// open detail table</span><br /><br />cSql := <span style="color: #ff0000;">"Select * from [InvoiceDetail] where [Invoice Number] = "</span>+ltrim<span style="color: #000000;">(</span>str<span style="color: #000000;">(</span>nRepairNumber<span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /><br />oRsInvoiceDetail := TOleAuto<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"ADODB.Recordset"</span> <span style="color: #000000;">)</span><br />oRsInvoiceDetail:<span style="color: #000000;">CursorType</span> := <span style="color: #000000;">1</span> <span style="color: #B900B9;">// opendkeyset</span><br />oRsInvoiceDetail:<span style="color: #000000;">CursorLocation</span> := <span style="color: #000000;">3</span> <span style="color: #B900B9;">// local cache</span><br />oRsInvoiceDetail:<span style="color: #000000;">LockType</span> := <span style="color: #000000;">3</span> <span style="color: #B900B9;">// lockoportunistic</span><br /><br /><span style="color: #00C800;">TRY</span><br /> oRsInvoiceDetail:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span> cSQL,xCONNECT <span style="color: #000000;">)</span><br />CATCH oErr<br /> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"Error in Opening INVOICEDETAIL table"</span> <span style="color: #000000;">)</span><br /> oRsInvoice:<span style="color: #000000;">CLose</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oRsInvoice := <span style="color: #00C800;">nil</span><br /> <span style="color: #00C800;">RETURN</span><span style="color: #000000;">(</span>.F.<span style="color: #000000;">)</span><br />END <span style="color: #00C800;">TRY</span><br /> </div>[/code:2x64qiiu]
This opens two recordsets you can display anyway you want ..
Rick Lipkin
[img:2x64qiiu]http://i57.tinypic.com/168d9hw.jpg[/img:2x64qiiu]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.