topic
stringlengths 1
63
| text
stringlengths 1
577k
⌀ |
|---|---|
ADO RDD xHarbour
|
Antonio, at this place on line 5348 the rdd should not be hardcoded!
[code=fw:3v37y97z]<div class="fw" id="{CB}" style="font-family: monospace;"> <span style="color: #00C800;">IF</span> !FILE<span style="color: #000000;">(</span>cTable<span style="color: #000000;">)</span><br /> DBCREATE<span style="color: #000000;">(</span>cTable,;<br /> <span style="color: #000000;">{</span> <span style="color: #000000;">{</span><span style="color: #ff0000;">"CODLOCK"</span>,<span style="color: #ff0000;">"C"</span>,<span style="color: #000000;">50</span>,<span style="color: #000000;">0</span> <span style="color: #000000;">}</span><span style="color: #000000;">}</span>,;<br /> <span style="color: #ff0000;">"DBFCDX"</span>,.T.,<span style="color: #ff0000;">"TLOCKS"</span><span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">ON</span> CODLOCK <span style="color: #0000ff;">TO</span> <span style="color: #000000;">(</span>cIndex<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span></div>[/code:3v37y97z]
should be
[code=fw:3v37y97z]<div class="fw" id="{CB}" style="font-family: monospace;"> <span style="color: #00C800;">IF</span> !FILE<span style="color: #000000;">(</span>cTable<span style="color: #000000;">)</span><br /> DBCREATE<span style="color: #000000;">(</span>cTable,;<br /> <span style="color: #000000;">{</span> <span style="color: #000000;">{</span><span style="color: #ff0000;">"CODLOCK"</span>,<span style="color: #ff0000;">"C"</span>,<span style="color: #000000;">50</span>,<span style="color: #000000;">0</span> <span style="color: #000000;">}</span><span style="color: #000000;">}</span>,;<br /> rRdd,.T.,<span style="color: #ff0000;">"TLOCKS"</span><span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">ON</span> CODLOCK <span style="color: #0000ff;">TO</span> <span style="color: #000000;">(</span>cIndex<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span></div>[/code:3v37y97z]
|
ADO RDD xHarbour
|
Gunther,
You re absolutely right. Done!
Thanks.
|
ADO RDD xHarbour
|
Dear all,
Please apologize the misaligned code of aodrdd.prg but I only realize it now with Lucas.
Im using NotePad++ and although code is perfectly aligned there it seems thats not the case with MED that most of you are using.
As soon as I can I will passed it through MED to get it all aligned and Ill posted.
|
ADO RDD xHarbour
|
Antonio, for MSSQL should on line ~464 the [WA_ENGINE] "MSSQL" to be and not "SQL"!! And if the authentification to the DB without a password but with windows-authentification the text "Trusted_Connection=yes" should be used.
[code=fw:29fr7hmy]<div class="fw" id="{CB}" style="font-family: monospace;"> <span style="color: #00C800;">CASE</span> aWAData<span style="color: #000000;">[</span> WA_ENGINE <span style="color: #000000;">]</span> == <span style="color: #ff0000;">"MSSQL"</span><br /><br /> aWAData<span style="color: #000000;">[</span> WA_CONNECTION <span style="color: #000000;">]</span>:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"Provider=SQLOLEDB;"</span> + ;<br /> <span style="color: #ff0000;">"server="</span> + aWAData<span style="color: #000000;">[</span> WA_SERVER <span style="color: #000000;">]</span> + ;<br /> <span style="color: #ff0000;">";database="</span> + t_cDataSource + ;<br /> iif<span style="color: #000000;">(</span>empty<span style="color: #000000;">(</span>aWAData<span style="color: #000000;">[</span> WA_USERNAME <span style="color: #000000;">]</span><span style="color: #000000;">)</span>,<span style="color: #ff0000;">";Trusted_Connection=yes"</span>,;<br /> <span style="color: #ff0000;">";uid="</span> + aWAData<span style="color: #000000;">[</span> WA_USERNAME <span style="color: #000000;">]</span> + ;<br /> <span style="color: #ff0000;">";pwd="</span> + aWAData<span style="color: #000000;">[</span> WA_PASSWORD <span style="color: #000000;">]</span> <span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> </div>[/code:29fr7hmy]
|
ADO RDD xHarbour
|
[quote:314bldbd]Antonio, for MSSQL should on line ~464 the [WA_ENGINE] "MSSQL" to be and not "SQL"!! And if the authentification to the DB without a password but with windows-authentification the text "Trusted_Connection=yes" should be used.[/quote:314bldbd]
Done!
|
ADO RDD xHarbour
|
New adordd version at <!-- m --><a class="postlink" href="https://github.com/AHFERREIRA/adordd.git">https://github.com/AHFERREIRA/adordd.git</a><!-- m -->
The code is aligned and clean.
Please read carefully readme to set your app to use adordd.
And please dont forget donate to the humanitarian organization 20 Euros.
|
ADO RDD xHarbour
|
New adordd English manual at <!-- m --><a class="postlink" href="https://github.com/AHFERREIRA/adordd.git">https://github.com/AHFERREIRA/adordd.git</a><!-- m -->
|
ADO RDD xHarbour
|
Antonio in line 405 the code must be anstead:
[code=fw:2t2c1kww]<div class="fw" id="{CB}" style="font-family: monospace;"> <span style="color: #00C800;">CASE</span> aWAData<span style="color: #000000;">[</span> WA_ENGINE <span style="color: #000000;">]</span> == <span style="color: #ff0000;">"SQL"</span></div>[/code:2t2c1kww]
[code=fw:2t2c1kww]<div class="fw" id="{CB}" style="font-family: monospace;"> <span style="color: #00C800;">CASE</span> aWAData<span style="color: #000000;">[</span> WA_ENGINE <span style="color: #000000;">]</span> == <span style="color: #ff0000;">"MSSQL"</span></div>[/code:2t2c1kww]
And in line 5203 also the block of code MUST so:
[code=fw:2t2c1kww]<div class="fw" id="{CB}" style="font-family: monospace;"> <span style="color: #00C800;">CASE</span> cEngine == <span style="color: #ff0000;">"MSSQL"</span><br /> oCn:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"Provider=SQLOLEDB;"</span> + ;<br /> <span style="color: #ff0000;">"server="</span> + cServer + ;<br /> <span style="color: #ff0000;">";database="</span> + cDB + ;<br /> iif<span style="color: #000000;">(</span>empty<span style="color: #000000;">(</span>cUser<span style="color: #000000;">)</span>,<span style="color: #ff0000;">";Trusted_Connection=yes"</span>,;<br /> <span style="color: #ff0000;">";uid="</span> + cUser + ;<br /> <span style="color: #ff0000;">";pwd="</span> + cPass <span style="color: #000000;">)</span><span style="color: #000000;">)</span></div>[/code:2t2c1kww]
|
ADO RDD xHarbour
|
Gunther,
Done!
Thanks.
|
ADO RDD xHarbour
|
I try to open table in localhost (MySql), the result is below.
It took time to open 335,819 records. Is it normal?
[url=http://postimage.org/:3uxdn7o6][img:3uxdn7o6]http://s9.postimg.org/4fz9lncpb/Open_Tbl.png[/img:3uxdn7o6][/url:3uxdn7o6]
[code=fw:3uxdn7o6]<div class="fw" id="{CB}" style="font-family: monospace;">.....<br /> SET ADODBF 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;">"CCRTBL"</span>,<span style="color: #000000;">{</span><span style="color: #ff0000;">"CCRTBL1"</span>,<span style="color: #ff0000;">"TBL_RMNO"</span><span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span><span style="color: #ff0000;">"CCRTBL2"</span>,<span style="color: #ff0000;">"UPPER(TBL_LAST)"</span><span style="color: #000000;">}</span><span style="color: #000000;">}</span>, ;<br /> <span style="color: #000000;">{</span><span style="color: #ff0000;">"CCRGST"</span>,<span style="color: #000000;">{</span><span style="color: #ff0000;">"CCRGST1"</span>,<span style="color: #ff0000;">"GST_INTNO"</span><span style="color: #000000;">}</span><span style="color: #000000;">}</span> ;<br /> <span style="color: #000000;">}</span><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;">"CCRTBL"</span>,<span style="color: #000000;">{</span><span style="color: #ff0000;">"CCRTBL1"</span>,<span style="color: #ff0000;">"TBL_RMNO"</span><span style="color: #000000;">}</span>, ;<br /> <span style="color: #000000;">{</span><span style="color: #ff0000;">"CCRTBL2"</span>,<span style="color: #ff0000;">"TBL_LAST"</span><span style="color: #000000;">}</span><span style="color: #000000;">}</span>, ;<br /> <span style="color: #000000;">{</span><span style="color: #ff0000;">"CCRGST"</span>,<span style="color: #000000;">{</span><span style="color: #ff0000;">"CCRGST1"</span>,<span style="color: #ff0000;">"GST_INTNO"</span><span style="color: #000000;">}</span><span style="color: #000000;">}</span> ;<br /> <span style="color: #000000;">}</span><br /> cSTime := time<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> USE ccrgst <span style="color: #0000ff;">ALIAS</span> <span style="color: #ff0000;">'gst'</span> <span style="color: #00C800;">NEW</span> SHARED<br /> cETime := time<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span><span style="color: #ff0000;">'Open Time : '</span>+cSTime+<span style="color: #ff0000;">' - '</span>+cETime+<span style="color: #ff0000;">' Reccount() : '</span>+Str<span style="color: #000000;">(</span>gst-><span style="color: #000000;">(</span>Reccount<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span></div>[/code:3uxdn7o6]
Thanks,
|
ADO RDD xHarbour
|
Dutch,
I would say thats normal.
The problem is when we use a table we read all records to ADO if we are using adUseClient as :CursorLocation.
With the index the time is doubled because ADORDD first issues a query SELECT * FROM... and then when you SE INDEX it issues another SELECT * FROM ORDER BY.
So 2 queries that read all records.
In these cases either you can set the query SELECT * FROM WHERE condition only to read the records you need might be only a few hundred but this will break code compatibility.
Other alternative try to use adUseServer together with CacheSize and the property Maximum Opens Rows.
CacheSize := 100
Maximum Opens Rows := 170
You will need to change the setup of MySql ODBC driver to enable dynamic cursors.
I dont know how ADORDD will behave because it might loose the :AbsolutePositon property but you can try it.
We will have to study this alternative in a next version.
May be Rao could help us with his knowledge of SQL ad ADO.
Besides that is it working ok?
|
ADO RDD xHarbour
|
1) Function and Command to open/read/write, relation, dbsetfilter(), ordsetfocus(), dbseek() is working well.
2) open record with relation is quite slow. I think the point is JOIN table is the key. Because 'CCRGST' table (guest details) no need to open all records but only the records which related with main table 'CCRTBL' (reservation details).
Is it correct?
How do I join 2 table with ADORDD?
Thanks.
|
ADO RDD xHarbour
|
Hello,
Set relation works the same way as in DBFCDX.
Try at adordd.prg to comment out all cache settings. I am using ADORDD in a WAN scenario via Internet and speed is very good.
|
ADO RDD xHarbour
|
Dutch,
[quote:3dnjh1cj]2) open record with relation is quite slow. I think the point is JOIN table is the key. Because 'CCRGST' table (guest details) no need to open all records but only the records which related with main table 'CCRTBL' (reservation details).
Is it correct?[/quote:3dnjh1cj]
What do you mean open record ?
[quote:3dnjh1cj]How do I join 2 table with ADORDD?[/quote:3dnjh1cj]
hb_GetAdoConnection():Execute(" CREATE VIEW CVIEWNAME....")
SELE 0
USE CVIEWNAME
If after you dont DROP VIEW (deleted ) next time you will not need to create it.
If you do you lll get a error but program will continue (I think)
You can use it like any other table.
Views are dynamic so always updated with last information.
|
ADO RDD xHarbour
|
Lucas,
[quote="lucasdebeltran":1gwjp5gp]Hello,
Set relation works the same way as in DBFCDX.
Try at adordd.prg to comment out all cache settings. I am using ADORDD in a WAN scenario via Internet and speed is very good.[/quote:1gwjp5gp]
How many records the biggest table?
|
ADO RDD xHarbour
|
30.000 records so far.
|
ADO RDD xHarbour
|
Dear Antonio,
Thank you for your help.
[quote="AHF":15yx2t2t]
What do you mean open record ?
[/quote:15yx2t2t]
I mean open table with all records.
|
ADO RDD xHarbour
|
Lucas and Dutch,
Please remember that only the number of records its not enough.
The recsize x nrecords (although in SQL its indicative) its what matters mainly on WAN as this represents the bytes number bring across the cable.
Can you check that?
|
ADO RDD xHarbour
|
I try to create view from 2 table as below
[code=fw:3q9i9wpn]<div class="fw" id="{CB}" style="font-family: monospace;">cCreateViewSql := <span style="color: #ff0000;">"CREATE VIEW TBLGST AS SELECT CCRTBL.TBL_RMNO, CCRTBL.TBL_LAST, CCRTBL.TBL_FIRST, CCRTBL.TBL_ARR, CCRTBL.TBL_DEP, CCRGST.GST_LAST FROM CCRTBL INNER JOIN CCRGST ON CCRTBL.TBL_GSTNO=CCRGST.GST_INTNO"</span><br />hb_GetAdoConnection<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Execute</span><span style="color: #000000;">(</span>cCreateViewSql<span style="color: #000000;">)</span></div>[/code:3q9i9wpn]
But got an error as
[code=fw:3q9i9wpn]<div class="fw" id="{CB}" style="font-family: monospace;"> Description : <span style="color: #000000;">Error</span> ADODB.Connection/<span style="color: #000000;">0</span> S_OK: <span style="color: #000000;">EXECUTE</span><br /> Args:<br /> <span style="color: #000000;">[</span> <span style="color: #000000;">1</span><span style="color: #000000;">]</span> = C CREATE VIEW TBLGST AS <span style="color: #0000ff;">SELECT</span> CCRTBL.TBL_RMNO, CCRTBL.TBL_LAST, CCRTBL.TBL_FIRST, CCRTBL.TBL_ARR, CCRTBL.TBL_DEP, CCRGST.GST_LAST <span style="color: #0000ff;">FROM</span> CCRTBL INNER <span style="color: #0000ff;">JOIN</span> CCRGST <span style="color: #0000ff;">ON</span> CCRTBL.TBL_GSTNO=CCRGST.GST_INTNO<br /><br /> </div>[/code:3q9i9wpn]
|
ADO RDD xHarbour
|
Dutch,
Please remember that without any autoinc field it will not navigate correctly so you must include that field always.
I dont think you can join with different field names.
CCRTBL.TBL_GSTNO=CCRGST.GST_INTNO"
|
ADO RDD xHarbour
|
Dear Antonio,
The problem is my misunderstood. The VIEW has created but I will recreate it then it got error. I have to DROP VIEW before CREATE VIEW, if exist.
But it still take long time to CREATE VIEW. After reuse view, it is quite fast.
Regards,
Dutch
|
ADO RDD xHarbour
|
Dutch,
I think you should only need to create view once.
Then simply use it as any other table.
I think View is kept updated by the server.
|
ADO RDD xHarbour
|
Is It Working with MariaDB ?
|
ADO RDD xHarbour
|
Vilian,
Never tried it.
Can you try to use MYSQL engine at ADORDD and at the Mysql ODBC set it up to connect to MariaDb?
I think the connection string its the same but if not it should be very easy to add support for it in ADORDD.
|
ADO RDD xHarbour
|
New version adordd posted at <!-- m --><a class="postlink" href="https://github.com/AHFERREIRA/adordd.git">https://github.com/AHFERREIRA/adordd.git</a><!-- m -->
Code improvements
Corrected bug in Append from
Working without true locks maintain locklist array nevertheless
Get date value from a field was returning date + time comparison of dDate = dDate even equal dates was returning false. Forgotten to un comment during trials
Trusted connection in MSSQL con string
|
ADO RDD xHarbour
|
Antonio, two errors in the new Version:
In ADO_TRANS() the variable n are not defined.
In ADO_FILE() the variable cTmpTable not defined.
|
ADO RDD xHarbour
|
Gunther,
Done!
Thanks.
Ill post new version today.
|
ADO RDD xHarbour
|
New version adordd at <!-- m --><a class="postlink" href="https://github.com/AHFERREIRA/adordd.git">https://github.com/AHFERREIRA/adordd.git</a><!-- m -->
Minor corrections.
Added connection strings to (not tested) :
SQLITE
POSTGRE
INFORMIX
ANYWHERE
|
ADO RDD xHarbour
|
Antonio,
You are doing an excellent work, congratulations! <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
|
ADO RDD xHarbour
|
I am trying to compile the ADORDD.PRG but I am getting the following "unresolved externals" (see below).
I was using the standard buildx.bat program but then I found the functions in xHarbour\libs\rdds.lib and added this lib to the buildx.bat but the same unresolved externals are still showing up.
buildx.bat
...
echo %hdirl%\rdds.lib + >> b32.bc
Maybe I am also missing a CH file?
How can I confirm that the RDDS.LIB is getting linked in?
Regards,
James
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ FiveWin for xHarbour 15.05 - Jun. 2015 xHarbour development power ³Ü
³ (c) FiveTech, 1993-2015 for Microsoft Windows 9X/NT/200X/ME/XP/Vista/7/8 ³Û
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙÛ
ÿ ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
Compiling...
xHarbour 1.2.3 Intl. (SimpLex) (Build 20130326)
Copyright 1999-2013, <!-- m --><a class="postlink" href="http://www.xharbour.org">http://www.xharbour.org</a><!-- m --> <!-- m --><a class="postlink" href="http://www.harbour-project.org/">http://www.harbour-project.org/</a><!-- m -->
Compiling 'adordd.prg' and generating preprocessed output to 'adordd.ppo'...
100
...
5400
Generating C source output to 'adordd.c'...
Done.
Lines 5387, Functions/Procedures 131, pCodes 17944
Borland C++ 5.82 for Win32 Copyright (c) 1993, 2005 Borland
adordd.c:
Turbo Incremental Link 5.69 Copyright (c) 1997-2005 Borland
Error: Unresolved external '_HB_FUN_USRRDD_RDDDATA' referenced from C:\USERS\JAMES\DOCUMENTS\PROJECTS\ADORDD\ADORDD.OBJ
Error: Unresolved external '_HB_FUN_USRRDD_AREADATA' referenced from C:\USERS\JAMES\DOCUMENTS\PROJECTS\ADORDD\ADORDD.OBJ
Error: Unresolved external '_HB_FUN_UR_SUPER_ERROR' referenced from C:\USERS\JAMES\DOCUMENTS\PROJECTS\ADORDD\ADORDD.OBJ
Error: Unresolved external '_HB_FUN_UR_SUPER_SETFIELDEXTENT' referenced from C:\USERS\JAMES\DOCUMENTS\PROJECTS\ADORDD\ADORDD.OBJ
Error: Unresolved external '_HB_FUN_UR_SUPER_ADDFIELD' referenced from C:\USERS\JAMES\DOCUMENTS\PROJECTS\ADORDD\ADORDD.OBJ
Error: Unresolved external '_HB_FUN_UR_SUPER_OPEN' referenced from C:\USERS\JAMES\DOCUMENTS\PROJECTS\ADORDD\ADORDD.OBJ
Error: Unresolved external '_HB_FUN_UR_SUPER_CLOSE' referenced from C:\USERS\JAMES\DOCUMENTS\PROJECTS\ADORDD\ADORDD.OBJ
Error: Unresolved external '_HB_FUN_UR_SUPER_EVALBLOCK' referenced from C:\USERS\JAMES\DOCUMENTS\PROJECTS\ADORDD\ADORDD.OBJ
Error: Unresolved external '_HB_FUN_USRRDD_GETFUNCTABLE' referenced from C:\USERS\JAMES\DOCUMENTS\PROJECTS\ADORDD\ADORDD.OBJ
* Linking errors *
Process completed, Exit Code 0.
Execution time: 00:10.375
--------------------------------------
|
ADO RDD xHarbour
|
Hello,
You have to link USRRDD.LIB OR HBUSRRDD.LIB in Harbour.
In your main, put REQUEST ADORDD, ADOVERSION
|
ADO RDD xHarbour
|
Lucas,
USRRDD.LIB did it. Thanks!
I sent a couple of hours trying to figure that out. Whew.
James
|
ADO RDD xHarbour
|
Ok, now I am getting another error when trying to run tryadordd.exe. It is an argument error for the function RDDGETINFO().
Any ideas?
James
Application
===========
Path and name: C:\Users\James\Documents\Projects\ADORDD\tryadordd.exe (32 bits)
Size: 3,059,712 bytes
Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20130326)
FiveWin Version: FWHX 15.05
Windows version: 6.2, Build 9200
Time from start: 0 hours 0 mins 0 secs
Error occurred at: 06/30/15, 13:17:25
Error description: Error DBCMD/2019 Argument error: RDDINFO
Stack Calls
===========
Called from: => RDDINFO( 0 )
Called from: adordd.prg => ADOLOCKCONTROL( 5325 )
Called from: tryadordd.prg => MAIN( 116 )
System
======
CPU type: AMD A8-4555M APU with Radeon(tm) HD Graphics 1600 Mhz
Hardware memory: 3271 megs
Free System resources: 90 %
GDI resources: 90 %
User resources: 90 %
Windows total applications running: 3
1 GDI+ Window,
2 GDI+ Window, C:\Windows\WinSxS\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.9600.17415_none_dad8722c5bcc2d
3 Task Switching, C:\Users\James\Documents\Projects\ADORDD\tryadordd.exe
Variables in use
================
Procedure Type Value
==========================
RDDINFO
Param 1: N 5
Param 2: U
Param 3: C "DBFCDX"
Local 1: U
Local 2: U
ADOLOCKCONTROL
Param 1: C "D:\WHATEVER"
Param 2: C "DBFCDX"
Local 1: U
Local 2: U
Local 3: C "D:\WHATEVER\TLOCKS"
MAIN
Local 1: C ""
Local 2: U
Local 3: U
Local 4: U
Local 5: U
Local 6: U
Local 7: U
Linked RDDs
===========
DBF
DBFFPT
DBFBLOB
DBFNTX
ADORDD
DataBases in use
================
Classes in use:
===============
1 ERROR
2 HASHENTRY
3 HBCLASS
4 TOLEAUTO
5 HBOBJECT
6 TREG32
Memory Analysis
===============
380 Static variables
Dynamic memory consume:
Actual Value: 0 bytes
Highest Value: 0 bytes
|
ADO RDD xHarbour
|
OK, here is the line erroring out.
TLOCKS->(DBSETINDEX(aLockCtrl[1]+RDDINFO(RDDI_ORDBAGEXT,,aLockCtrl[2]) ))
I have done a global search and I can't find any .H or .CH files containing the manifest constant RDDI_ORDBAGEXT. So that seems to be the problem. Anyone know which file contains that manifest constant? Or, at least know its value?
James
|
ADO RDD xHarbour
|
Mr Lucas
Can you explain the purpose of
[code=fw:1h2gqrro]<div class="fw" id="{CB}" style="font-family: monospace;"> 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: #ff0000;">"TEMPORARY"</span> <span style="color: #000000;">}</span><br /><br /> SET ADO <span style="color: #00C800;">DEFAULT</span> RECNO FIELD <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"HBRECNO"</span><br /> </div>[/code:1h2gqrro]
and can we use XBROWE() instead of BROWSE() ?
|
ADO RDD xHarbour
|
OK, it's not the manifest constant, it seems to be line 117 of TRYADORDD.PRG
//CONTROL LOCKING IN ADORDD FOR BOTH TABLE AND RECORD DONT PUT FINAL "\"
SET ADO LOCK CONTROL SHAREPATH TO "D:\WHATEVER" RDD TO "DBFCDX"
I changed the "D:\WHATEVER" to "C:\WHATEVER" and created that directory, and I still get the same error.
I am not sure if it is expecting to find the database "test2.mdb" in that directory, or if it is going to create it if it is not found.
At least some of us are going to need some "Getting Started" instructions.
James
|
ADO RDD xHarbour
|
Maybe someone can figure out why even this tiny test program won't run?
James
[code=fw:31it1eta]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #B900B9;">/*<br />Purpose: Simple as possible ADORDD test<br />Author : James Bott<br />Date : 6/30/2015 5:02:35 PM<br /><br />*/</span><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"adordd.ch"</span><br /><br />REQUEST ADORDD, ADOVERSION<br /><br /><span style="color: #00C800;">FUNCTION</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> RddRegister<span style="color: #000000;">(</span><span style="color: #ff0000;">"ADORDD"</span>,<span style="color: #000000;">1</span><span style="color: #000000;">)</span><br /> RddSetDefault<span style="color: #000000;">(</span><span style="color: #ff0000;">"ADORDD"</span><span style="color: #000000;">)</span><br /><br /> SET ADO <span style="color: #00C800;">DEFAULT</span> DATABASE <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"northwind.mdb"</span> ;<br /> <span style="color: #00C800;">SERVER</span> <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"Microsoft.Jet.OleDB.4.0"</span> ;<br /> ENGINE <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"ACCESS"</span><br /><br /> USE CUSTOMERS <span style="color: #0000ff;">ALIAS</span> <span style="color: #ff0000;">"CUSTOMERS"</span><br /> BROWSE<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">Return</span></div>[/code:31it1eta]
|
ADO RDD xHarbour
|
James,
Please try this:
[code=fw:wfra6tee]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br /><span style="color: #B900B9;">/*<br />Purpose: Simple as possible ADORDD test<br />Author : James Bott<br />Date : 6/30/2015 5:02:35 PM<br /><br />*/</span><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"adordd.ch"</span><br /><br />REQUEST ADORDD, ADOVERSION<br /><br /><span style="color: #00C800;">FUNCTION</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> RddRegister<span style="color: #000000;">(</span><span style="color: #ff0000;">"ADORDD"</span>,<span style="color: #000000;">1</span><span style="color: #000000;">)</span><br /> RddSetDefault<span style="color: #000000;">(</span><span style="color: #ff0000;">"ADORDD"</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: #ff0000;">"TEMPORARY"</span> <span style="color: #000000;">}</span><br /><br /> SET ADO <span style="color: #00C800;">DEFAULT</span> RECNO FIELD <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"HBRECNO"</span><br /><br /> SET AUTOPEN OFF <br /><br /> SET ADO FORCE LOCK OFF<br /><br /> SET ADO <span style="color: #00C800;">DEFAULT</span> DATABASE <span style="color: #0000ff;">TO</span> northwind.mdb<span style="color: #ff0000;">" SERVER TO "</span><span style="color: #ff0000;">" ENGINE TO "</span>ACCESS<span style="color: #ff0000;">" USER TO "</span><span style="color: #ff0000;">" PASSWORD TO "</span><span style="color: #ff0000;">"<br /> <br /><br /> USE CUSTOMERS ALIAS "</span>CUSTOMERS<span style="color: #ff0000;">"<br /> BROWSE()<br /><br />Return<br /><br /><br /></span></div>[/code:wfra6tee]
|
ADO RDD xHarbour
|
Dear Mr. Nages,
Glad to hear from you.
For ensuring recno() we created an autoincremental field on each table. With this command is possible to change its name, particulary when the table is not created by DbCreate().
SET ADO TEMPORARY NAMES indicate the temporary indexes and destroyed after connection. So we can issue with ADORDD temporary indexes as:
[code=fw:25kpwhsp]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">ON</span> FIELD->NAME <span style="color: #0000ff;">TO</span> TEMP TEMPORARY<br /><br />or<br /><br /><span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">ON</span> FIELD->CITY <span style="color: #0000ff;">TO</span> TEMP TEMPORARY ADDITIVE<br /><br /> </div>[/code:25kpwhsp]
Here is the english manual:
<!-- m --><a class="postlink" href="https://github.com/AHFERREIRA/adordd/blob/master/01_README.pdf">https://github.com/AHFERREIRA/adordd/bl ... README.pdf</a><!-- m -->
We await your feedback about ADORDD.
Thank you very much.
|
ADO RDD xHarbour
|
And yes, xBrowse() is working too!.
|
ADO RDD xHarbour
|
Lucas,
I still get the same "open" error with your code. I know this is a valid, working database as I can use if from another ADO app I wrote. I would also expect that the customers table already has an autoincrement field since it was (presumably) created by Access as the Northwind.mdb database is the standard Access sample database.
Also the ADORDD code I downloaded from GITHUB yesterday, so it is current as of then.
James
Application
===========
Path and name: C:\Users\James\Documents\Projects\ADORDD\New4.exe (32 bits)
Size: 2,976,768 bytes
Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20130326)
FiveWin Version: FWHX 15.05
Windows version: 6.2, Build 9200
Time from start: 0 hours 0 mins 0 secs
Error occurred at: 07/01/15, 06:40:02
Error description: Error BASE/1081 Argument error: +
Args:
[ 1] = C SELECT * FROM
[ 2] = U
Stack Calls
===========
Called from: source\rdd\usrrdd\rdds\adordd.prg => ADO_OPEN( 0 )
Called from: => DBUSEAREA( 0 )
Called from: New4.prg => MAIN( 42 )
|
ADO RDD xHarbour
|
Lucas,
It would be very helpful if you could post a collection of a working PRG, EXE, and MDB that we could look at and test. Or, just email it to me as a zip attachment, but I am sure others would like to see it too.
I am sure there is a very simple mistake I am making, but I spent over 5 hours on this yesterday with no success.
James
|
ADO RDD xHarbour
|
Lucas,
From your profile it appears that you are using Harbour, not xHarbour. Maybe that is an issue? I thought from the title of this message thread, that the ADORDD was being developed using xHarbour. I am using xHarbour.
James
|
ADO RDD xHarbour
|
James,
Please send me your database and prg file to lucasdebeltran at gmail. com
|
ADO RDD xHarbour
|
Lucas,
Sent to your email.
James
|
ADO RDD xHarbour
|
Dear Mr James,
Here is working fine:
[img:2xpchutt]http://i59.tinypic.com/4kvjg3.png[/img:2xpchutt]
Which OS do you have?.
What error do you get?.
|
ADO RDD xHarbour
|
From the above error, it appears that ADORDD is internally generating an SQL statement "SELECT * FROM " + <tablename> to open the record set.
Instead oRs:Open( <tablename>, oCn, cursortype, locktype, adCmdTable ) // 5th parameter adCmdTable
In that rare occasion when the provider supports "scrollable server-side cursor", then adCmdTableDirect may be used after setting the cursor location to adUseServer and CursorType as adDynamic. In such cases the provider might even support adSeek
In this case we need to adopt workarounds for recordcount()
|
ADO RDD xHarbour
|
Hi Guys,
I'm trying to test ADORDD, but when i compile the adordd.prg, appear these errors:
[code=fw:23y41sq2]<div class="fw" id="{CB}" style="font-family: monospace;"><br />ADORDD.PRG<span style="color: #000000;">(</span><span style="color: #000000;">288</span><span style="color: #000000;">)</span> Error E0020 Incomplete statement or unbalanced delimiters<br />ADORDD.PRG<span style="color: #000000;">(</span><span style="color: #000000;">291</span><span style="color: #000000;">)</span> Error E0020 Incomplete statement or unbalanced delimiters<br />ADORDD.PRG<span style="color: #000000;">(</span><span style="color: #000000;">295</span><span style="color: #000000;">)</span> Error E0010 <span style="color: #00C800;">ENDIF</span> does not <span style="color: #0000ff;">match</span> <span style="color: #00C800;">IF</span><br />ADORDD.PRG<span style="color: #000000;">(</span><span style="color: #000000;">363</span><span style="color: #000000;">)</span> Error E0020 Incomplete statement or unbalanced delimiters<br />ADORDD.PRG<span style="color: #000000;">(</span><span style="color: #000000;">424</span><span style="color: #000000;">)</span> Error E0020 Incomplete statement or unbalanced delimiters<br />ADORDD.PRG<span style="color: #000000;">(</span><span style="color: #000000;">428</span><span style="color: #000000;">)</span> Error E0030 Syntax error <span style="color: #ff0000;">"syntax error at 'END'"</span></div>[/code:23y41sq2]
I'm using FW/Harbour and get the adordd.prg from [url:23y41sq2]https://github.com/AHFERREIRA/adordd[/url:23y41sq2]
|
ADO RDD xHarbour
|
Vilian,
From your errors, it appears that Harbour doesn't support the TRY/CATCH/END commands. Or, maybe you need to #include another file.
I am using xHarbour and I don't get any errors.
James
|
ADO RDD xHarbour
|
Lucas,
[quote:2nzvjcik]Try to put ADORDD.LIB as the first lib.[/quote:2nzvjcik]
Good guess, that worked. Before I had it as the last library.
James
[code=fw:2nzvjcik]<div class="fw" id="{CB}" style="font-family: monospace;">...<br />echo %bcdir%\lib\c0w32.obj + > b32.bc<br />echo adordd.lib + >> b32.bc<br />...<br /> </div>[/code:2nzvjcik]
|
ADO RDD xHarbour
|
Thanks James,
I included the [b:1pdl6vqi]hbcompat.ch[/b:1pdl6vqi], and only rest some warnings:
[code=fw:1pdl6vqi]<div class="fw" id="{CB}" style="font-family: monospace;"><br />adordd.prg<span style="color: #000000;">(</span><span style="color: #000000;">4471</span><span style="color: #000000;">)</span> Warning W0001 Ambiguous reference <span style="color: #ff0000;">'LRET'</span><br />adordd.prg<span style="color: #000000;">(</span><span style="color: #000000;">4476</span><span style="color: #000000;">)</span> Warning W0001 Ambiguous reference <span style="color: #ff0000;">'LRET'</span><br />adordd.prg<span style="color: #000000;">(</span><span style="color: #000000;">4481</span><span style="color: #000000;">)</span> Warning W0001 Ambiguous reference <span style="color: #ff0000;">'LRET'</span><br />fivewin.ch<span style="color: #000000;">(</span><span style="color: #000000;">109</span><span style="color: #000000;">)</span> Warning W0002 Redefinition or duplicate definition <span style="color: #0000ff;">of</span> <span style="color: #00D7D7;">#define</span> CRLF<br />adordd.prg<span style="color: #000000;">(</span><span style="color: #000000;">5442</span><span style="color: #000000;">)</span> Warning W0002 Redefinition or duplicate definition <span style="color: #0000ff;">of</span> <span style="color: #00D7D7;">#define</span> UR_FI_FLAGS<br />adordd.prg<span style="color: #000000;">(</span><span style="color: #000000;">5443</span><span style="color: #000000;">)</span> Warning W0002 Redefinition or duplicate definition <span style="color: #0000ff;">of</span> <span style="color: #00D7D7;">#define</span> UR_FI_STEP<br />adordd.prg<span style="color: #000000;">(</span><span style="color: #000000;">5444</span><span style="color: #000000;">)</span> Warning W0002 Redefinition or duplicate definition <span style="color: #0000ff;">of</span> <span style="color: #00D7D7;">#define</span> UR_FI_SIZE</div>[/code:1pdl6vqi]
How can i solve this? Does it have a library for harbour?
|
ADO RDD xHarbour
|
Lucas,
I am running Win 8.1 x64. I'm using the latest xHarbour and FWH.
The complete error is shown in a previous message. It is failing to open the table.
Please send me your working EXE so I can try it here.
James
|
ADO RDD xHarbour
|
James,
I sent you a zip file with an exe so as to retreive full error.log and check error.
Here you also have it:
<!-- m --><a class="postlink" href="http://rg.to/file/6a40703c481c85f1d406d0da5b61b282/JAMES.zO___.html">http://rg.to/file/6a40703c481c85f1d406d ... zO___.html</a><!-- m -->
|
ADO RDD xHarbour
|
Lucas,
OK, I was linking in adordd.lib and you were using #include "adordd.prg." When I changed to your syntax, it worked. Perhaps I need to move the lib location in the buildx.bat file?
James
|
ADO RDD xHarbour
|
Hello,
Try to put the adordd.lib as the first lib.
Or maybe there is something wrong at the lib.
Glad you get it working.
|
ADO RDD xHarbour
|
Vilian,
I don't know why you are getting the lRet as being ambiguous since it is defined as a LOCAL. They do happen to be within the TRY/END sequence so I wonder if that isn't still an issue.
The other warnings I wouldn't worry about.
You can build your own lib using Borland's TLIB.EXE, or just add the prg to your app.
James
|
ADO RDD xHarbour
|
Vilian,
You can safely ignore such warnings.
They are from functions under development.
|
ADO RDD xHarbour
|
Thanks Lucas,
Now, when i try open a file appear this error:
[b:1jqyzovz](DOS error -2147352567) WINOLE/1007 Operation not allowed when the objeto has closed(0x800A0E78) ADODB.Connection[/b:1jqyzovz]
I'm trying to use ADORDD with [b:1jqyzovz]MariaDb[/b:1jqyzovz].
|
ADO RDD xHarbour
|
Hello,
We tested with Access, MySQL and MSSQL.
With the above, its working pretty good.
|
ADO RDD xHarbour
|
Vilian,
It appears that MariaDB is not yet supported. However, take a look at the ADOOPENCONNECT Method of the ADORDD.PRG and you will see how the various SQL databases are opened. Maybe you can create your own CASE statement for the MariaDB. Let us know if that works.
Alternately, you could just try getting up and running with the ACCESS Northwind.mdb as I have done. Then once you have that figured out you could proceed to trying to get the MariaDB going too.
James
|
ADO RDD xHarbour
|
James,
With MariaDb don´t work. I changed to MySql and now i have this error:
[code=fw:3vkpltpo]<div class="fw" id="{CB}" style="font-family: monospace;"><br /> Error description: <span style="color: #000000;"><span style="color: #000000;">(</span>DOS</span> Error <span style="color: #000000;">-2147352567</span><span style="color: #000000;">)</span> WINOLE/<span style="color: #000000;">1007</span> <span style="color: #000000;">[</span>Microsoft<span style="color: #000000;">]</span><span style="color: #000000;">[</span>ODBC Driver Manager<span style="color: #000000;">]</span> <span style="color: #0000ff;">Name</span> <span style="color: #0000ff;">of</span> database <span style="color: #0000ff;">font</span> not find <span style="color: #000000;">(</span>0x80004005<span style="color: #000000;">)</span>: <span style="color: #000000;">Microsoft</span> OLE DB Provider <span style="color: #00C800;">for</span> ODBC Drivers<br /> Args:<br /> <span style="color: #000000;">[</span> <span style="color: #000000;">1</span><span style="color: #000000;">]</span> = C Driver=<span style="color: #000000;">{</span>mySQL ODBC <span style="color: #000000;">5.3</span> ANSI Driver<span style="color: #000000;">}</span>;server=localhost;Port=<span style="color: #000000;">3306</span>;Option=<span style="color: #000000;">32</span>;database=vfatec;uid=root;pwd=vfatec;<br /><br />Stack Calls<br />===========<br /> Called <span style="color: #0000ff;">from</span>: => TOLEAUTO:<span style="color: #000000;">OPEN</span><span style="color: #000000;">(</span> <span style="color: #000000;">0</span> <span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: \tec2000\SGV90\ADORDD.PRG => ADOOPENCONNECT<span style="color: #000000;">(</span> <span style="color: #000000;">474</span> <span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: \tec2000\SGV90\ADORDD.PRG => ADOGETCONNECT<span style="color: #000000;">(</span> <span style="color: #000000;">5238</span> <span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: \tec2000\SGV90\ADORDD.PRG => ADODEFAULTS<span style="color: #000000;">(</span> <span style="color: #000000;">5218</span> <span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: <span style="color: #000000;">tempresa</span>.prg => TSISTEMA:<span style="color: #00C800;">NEW</span><span style="color: #000000;">(</span> <span style="color: #000000;">400</span> <span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: \tec2000\SGV90\SGV.PRG => START<span style="color: #000000;">(</span> <span style="color: #000000;">175</span> <span style="color: #000000;">)</span><br /> </div>[/code:3vkpltpo]
I need to install anymore thing ?
|
ADO RDD xHarbour
|
Vilian,
It appears to be saying that it is not finding the database. Perhaps the path is not specified or is incorrect.
You should also check your normal connection syntax with that being used in the ADORDD.PRG's ADOOOPENCONNECT() function.
I don't have MySQL installed here so I can't test it. Plus I am running xHarbour not Harbour.
I do suggest using the ACCESS Northwind.mdb to get started. After you get that opened successfully, then you can try other databases. MySQL is supposed to be syntax compatible so it should be easy once you get Northwind.mdb working.
James
|
ADO RDD xHarbour
|
Vilian,
See postings 4, and 5 on page 27 of this message thread on solving issues with Harbour.
James
|
ADO RDD xHarbour
|
James,
Thanks, but we decided make this migration using Tdolphin. It is more easy than I did think <!-- s;) --><img src="{SMILIES_PATH}/icon_wink.gif" alt=";)" title="Wink" /><!-- s;) -->
|
ADO RDD xHarbour
|
Antonio F.,
There is a typo in this SET command from the ado.ch file:
#command SET ADO TEMPORAY NAMES INDEX LIST TO <array> => ListTmpNames( <array>) /* defining temporary index array list of names*/
"TEMPORAY" should be "TEMPORARY". I know this will break backward compatibility, but without it all new code will be causing errors because everyone will think they should be typing "temporary."
Strangely, I note that the spell checker for IE does not flag "TEMPORAY" as misspelled if it is in all caps--only if it is lower case.
Keep up the great work you are doing.
Regards,
James
|
ADO RDD xHarbour
|
Antonio F,
I am attempting to import records from a DBF to an Access table. This crashes:
[code=fw:23s0wrd6]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #B900B9;">/*<br />Purpose: Large file ADORDD test<br />Author : James Bott<br />Date : 7/9/2015 4:52:20 PM<br /><br />*/</span><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"adordd.ch"</span><br /><br />REQUEST ADORDD, ADOVERSION<br /><br /><span style="color: #00C800;">FUNCTION</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> RddRegister<span style="color: #000000;">(</span><span style="color: #ff0000;">"ADORDD"</span>,<span style="color: #000000;">1</span><span style="color: #000000;">)</span><br /> RddSetDefault<span style="color: #000000;">(</span><span style="color: #ff0000;">"ADORDD"</span><span style="color: #000000;">)</span><br /> <br /> SET ADO FORCE LOCK OFF <br /><br /> SET ADO <span style="color: #00C800;">DEFAULT</span> DATABASE <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"northwind.mdb"</span> ;<br /> <span style="color: #00C800;">SERVER</span> <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"Microsoft.Jet.OLEDB.4.0"</span> ;<br /> ENGINE <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"ACCESS"</span><br /> <br /> <span style="color: #0000ff;">SELECT</span> <span style="color: #000000;">0</span><br /> USE PTIME <span style="color: #0000ff;">alias</span> <span style="color: #ff0000;">"ptimeADO"</span> via <span style="color: #ff0000;">"ADORDD"</span><br /> <br /> append <span style="color: #0000ff;">from</span> ptime via <span style="color: #ff0000;">"DBFCDX"</span><br /> <br /> BROWSE<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">nil</span> <br /> </div>[/code:23s0wrd6]
And this is the error:
[code=fw:23s0wrd6]<div class="fw" id="{CB}" style="font-family: monospace;">Application<br />===========<br /> Path and <span style="color: #0000ff;">name</span>: <span style="color: #000000;">C</span>:\Users\James\Documents\Projects\ADORDD\Test5.exe <span style="color: #000000;">(</span><span style="color: #000000;">32</span> bits<span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">Size</span>: <span style="color: #000000;">3</span>,<span style="color: #000000;">003</span>,<span style="color: #000000;">904</span> bytes<br /> Compiler version: <span style="color: #000000;">xHarbour</span> <span style="color: #000000;">1.2</span><span style="color: #000000;">.3</span> Intl. <span style="color: #000000;">(</span>SimpLex<span style="color: #000000;">)</span> <span style="color: #000000;">(</span>Build <span style="color: #000000;">20130326</span><span style="color: #000000;">)</span><br /> FiveWin Version: <span style="color: #000000;">FWHX</span> <span style="color: #000000;">15.05</span><br /> Windows version: <span style="color: #000000;">6.2</span>, Build <span style="color: #000000;">9200</span> <br /><br /> Time <span style="color: #0000ff;">from</span> start: <span style="color: #000000;">0</span> hours <span style="color: #000000;">0</span> mins <span style="color: #000000;">0</span> secs <br /> Error occurred <span style="color: #00C800;">at</span>: <span style="color: #000000;">07</span>/<span style="color: #000000;">09</span>/<span style="color: #000000;">15</span>, <span style="color: #000000;">18</span>:<span style="color: #000000;">17</span>:<span style="color: #000000;">08</span><br /> Error description: <span style="color: #000000;">Error</span> DBCMD/<span style="color: #000000;">1005</span> Argument error: __DBAPP<br /><br />Stack Calls<br />===========<br /> Called <span style="color: #0000ff;">from</span>: => __DBAPP<span style="color: #000000;">(</span> <span style="color: #000000;">0</span> <span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: <span style="color: #000000;">Test5</span>.prg => MAIN<span style="color: #000000;">(</span> <span style="color: #000000;">27</span> <span style="color: #000000;">)</span></div>[/code:23s0wrd6]
The crash is happening at this line:
append from ptime via "DBFCDX"
Without that line it runs fine.
James
|
ADO RDD xHarbour
|
Antonio F,
I have been unable to do any type of APPEND. Either there are bugs in the ADORDD or I am doing something wrong.
APPEND FROM... errors out as shown in my previous message. And, APPEND BLANK errors out in the code below. This means that I cannot get any data into the table using ADORDD. I suspect I am doing something wrong but I don't have a clue what it might be.
Anyone else know? Anyone able to do an APPEND? If so, please provide example code.
[code=fw:387zbdnz]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #B900B9;">/*<br />Purpose: File append test<br />Author : James Bott<br />Date : 7/9/2015 4:52:20 PM<br /><br />*/</span><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"adordd.ch"</span><br /><br />REQUEST ADORDD, ADOVERSION<br /><br /><span style="color: #00C800;">FUNCTION</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #B900B9;">//createTemp()</span><br /><br /> RddRegister<span style="color: #000000;">(</span><span style="color: #ff0000;">"ADORDD"</span>,<span style="color: #000000;">1</span><span style="color: #000000;">)</span><br /> RddSetDefault<span style="color: #000000;">(</span><span style="color: #ff0000;">"ADORDD"</span><span style="color: #000000;">)</span><br /> <br /> SET ADO FORCE LOCK OFF <br /><br /> SET ADO <span style="color: #00C800;">DEFAULT</span> DATABASE <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"northwind.mdb"</span> ;<br /> <span style="color: #00C800;">SERVER</span> <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"Microsoft.Jet.OLEDB.4.0"</span> ;<br /> ENGINE <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"ACCESS"</span><br /> <br /> <span style="color: #B900B9;">// CONTROL LOCKING IN ADORDD FOR BOTH TABLE AND RECORD DONT PUT FINAL "\"</span><br /> <span style="color: #B900B9;">// Including the next line causes an error - JBott</span><br /> <span style="color: #B900B9;">// SET ADO LOCK CONTROL SHAREPATH TO "C:\users\james\documents\projects\adordd" RDD TO "DBFCDX"</span><br /><br /> <span style="color: #B900B9;">// Note: File is empty</span><br /> <span style="color: #0000ff;">SELECT</span> <span style="color: #000000;">0</span><br /> USE PTIME <span style="color: #0000ff;">alias</span> <span style="color: #ff0000;">"ptimeADO"</span> <span style="color: #B900B9;">//via "ADORDD"</span><br /> <br /> <span style="color: #0000ff;">msgInfo</span><span style="color: #000000;">(</span> used<span style="color: #000000;">(</span><span style="color: #000000;">)</span>,<span style="color: #ff0000;">"File open"</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// returns .t.</span><br /> <br /> <span style="color: #0000ff;">msgInfo</span><span style="color: #000000;">(</span>tcharge2,<span style="color: #ff0000;">"TCHARGE2"</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// returns 0.00</span><br /> <br /> append blank <span style="color: #B900B9;">// crashes</span><br /> <span style="color: #0000ff;">msginfo</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"Appended blank record"</span><span style="color: #000000;">)</span><br /> tcharge2:=<span style="color: #000000;">111.11</span><br /> <br /> <br /> <span style="color: #B900B9;">// append from temp via "DBFNTX" // crashes here</span><br /> <br /> BROWSE<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">nil</span> <br /> </div>[/code:387zbdnz]
James
|
ADO RDD xHarbour
|
I note that Antonio Ferreira seems to have disappeared. He hasn't posted anything on this forum since June 30.
Is the ADORDD project now dead?
Does anyone know what happened to him? I hope he has just been too busy.
I am very anxious to get some data into a SQL database, but so far have been unable to do so using the ADORDD. And I have had no response to any of my questions about this here.
Does anyone have sample (working) code to import a DBF? Preferably into an ACCESS database.
Regards,
James
|
ADO RDD xHarbour
|
Hi James,
Antonio F wrote me that he is on holiday in July.
Do you mean to import a dbf file and export it to a sql database in general? (see code below) or with adordd?, another tool is: <!-- m --><a class="postlink" href="http://dbfviewer2000.com">http://dbfviewer2000.com</a><!-- m -->
[code=fw:2i0eum2y]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWin.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"adodef.ch"</span><br /> <br />REQUEST DBFCDX<br /> <br /><span style="color: #00C800;">static</span> oCn<br /> <br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /> <br /><span style="color: #00C800;">function</span> MyTest<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <br /> <span style="color: #00C800;">local</span> oRs<br /> CreateDatabaseIfNotYetExist<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> ConnectWithDatabase<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> FW_AdoImportFromDBF<span style="color: #000000;">(</span> oCn, <span style="color: #ff0000;">"C:<span style="color: #000000;">\P</span>ieter<span style="color: #000000;">\D</span>ev<span style="color: #000000;">\i</span>mport<span style="color: #000000;">\c</span>ustomer.dbf"</span><span style="color: #000000;">)</span><br /> <br /> oRs = TRecSet<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"customer"</span>, oCn <span style="color: #000000;">)</span><br /> <br /> <br /> <br /> <span style="color: #00C800;">if</span> oRs:<span style="color: #000000;">IsOpen</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <br /> XBROWSER oRs <span style="color: #B900B9;">// SETUP oBrw:lIncrFilter := .T. </span><br /> <span style="color: #B900B9;">// SETUP oBrw:bEdit := { | oRec | MyEdit( oRec ) }</span><br /> <span style="color: #B900B9;">// SETUP oBrw:lIncrSearch := .T.</span><br /> <span style="color: #B900B9;">// SETUP oBrw:lWildSeek := .T. </span><br /> <br /> oRs:<span style="color: #000000;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">else</span><br /> MsgAlert<span style="color: #000000;">(</span> <span style="color: #ff0000;">"The recordset could not be opened"</span> <span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"Check that you have REQUEST DBFCDX"</span> <span style="color: #000000;">)</span> <br /> <span style="color: #00C800;">endif</span><br /> <br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /> <br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">FUNCTION</span> CloseDatabase<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oCn:<span style="color: #000000;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span> <br /><br /><span style="color: #00C800;">FUNCTION</span> ConnectWithDatabase<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> ADOCONNECT oCn <span style="color: #0000ff;">TO</span> MYSQL <span style="color: #00C800;">SERVER</span> localhost DATABASE <database> USER root PASSWORD <password> <span style="color: #B900B9;">// PASSWORD ... </span><br /> <br /> <span style="color: #00C800;">if</span> oCn == <span style="color: #00C800;">nil</span> .or. oCn:<span style="color: #000000;">State</span> < <span style="color: #000000;">1</span><br /> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"Connect failed"</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /> <span style="color: #00C800;">endif</span> <br /> <br /> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"Connection Open"</span> <span style="color: #000000;">)</span><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span> <br /> </div>[/code:2i0eum2y]
|
ADO RDD xHarbour
|
James,
To create an Access database:
FW_CreateMdb( "test.mdb" )
To connect to it:
oCon = FW_OpenAdoConnection( "test.mdb" )
To create a table:
[code=fw:16ywtw60]<div class="fw" id="{CB}" style="font-family: monospace;">FWAdoCreateTable<span style="color: #000000;">(</span> <span style="color: #ff0000;">"tableName"</span>, aFields, oCon, .T. <span style="color: #000000;">)</span></div>[/code:16ywtw60]
Where aFields is the array that you get from DBStruct()
|
ADO RDD xHarbour
|
Pieter and Antonio,
I have already successfully created a table in the ACCESS database. Now I want to import data from a DBF to that table. The problem is that both APPEND BLANK and APPEND FROM error out. With a working RDD I should just be able to do:
use customer alias "cust"
append from SAMPLE.DBF via "DBFCDX"
But this isn't working. (See also my previous posts with the exact sample code I am trying to use.)
Regards,
James
|
ADO RDD xHarbour
|
[url=http://postimage.org/:2ilsszh6][img:2ilsszh6]http://s14.postimg.org/6g14x3jpd/error1.png[/img:2ilsszh6][/url:2ilsszh6]
[url=http://postimage.org/:2ilsszh6]image url[/url:2ilsszh6]
I got this error when I pressed new from browse window.
This works:
APPEND BLANK
REPLACE FIELD->FIRST WITH "Pieter2"
This does not work:
APPEND FROM customer2.dbf via "DBFCDX"
[code=fw:2ilsszh6]<div class="fw" id="{CB}" style="font-family: monospace;">Application<br />===========<br /> Path and <span style="color: #0000ff;">name</span>: <span style="color: #000000;">C</span>:\Pieter\adorddtest\adorddtest.exe <span style="color: #000000;">(</span><span style="color: #000000;">32</span> bits<span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">Size</span>: <span style="color: #000000;">2</span>,<span style="color: #000000;">769</span>,<span style="color: #000000;">408</span> bytes<br /> Compiler version: <span style="color: #000000;">xHarbour</span> <span style="color: #000000;">1.2</span><span style="color: #000000;">.3</span> Intl. <span style="color: #000000;">(</span>SimpLex<span style="color: #000000;">)</span> <span style="color: #000000;">(</span>Build <span style="color: #000000;">20150213</span><span style="color: #000000;">)</span><br /> FiveWin Version: <span style="color: #000000;">FWHX</span> <span style="color: #000000;">15.01</span><br /> Windows version: <span style="color: #000000;">6.2</span>, Build <span style="color: #000000;">9200</span> <br /><br /> Time <span style="color: #0000ff;">from</span> start: <span style="color: #000000;">0</span> hours <span style="color: #000000;">0</span> mins <span style="color: #000000;">1</span> secs <br /> Error occurred <span style="color: #00C800;">at</span>: <span style="color: #000000;">07</span>/<span style="color: #000000;">20</span>/<span style="color: #000000;">15</span>, <span style="color: #000000;">14</span>:<span style="color: #000000;">46</span>:<span style="color: #000000;">29</span><br /> Error description: <span style="color: #000000;">Error</span> DBCMD/<span style="color: #000000;">1005</span> Argument error: __DBAPP<br /><br />Stack Calls<br />===========<br /> Called <span style="color: #0000ff;">from</span>: => __DBAPP<span style="color: #000000;">(</span> <span style="color: #000000;">0</span> <span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: <span style="color: #000000;">adorddtest</span>.prg => MAIN<span style="color: #000000;">(</span> <span style="color: #000000;">18</span> <span style="color: #000000;">)</span><br /><br />System<br />======<br /> CPU type: <span style="color: #000000;">Intel</span><span style="color: #000000;">(</span>R<span style="color: #000000;">)</span> Pentium<span style="color: #000000;">(</span>R<span style="color: #000000;">)</span> CPU N3540 @ <span style="color: #000000;">2</span>.16GHz <span style="color: #000000;">2166</span> Mhz<br /> Hardware memory: <span style="color: #000000;">3500</span> megs<br /><br /> Free System resources: <span style="color: #000000;">90</span> %<br /> GDI resources: <span style="color: #000000;">90</span> %<br /> User resources: <span style="color: #000000;">90</span> %<br /><br /> Windows total applications running: <span style="color: #000000;">5</span><br /> <span style="color: #000000;">1</span> , <br /> <span style="color: #000000;">2</span> , C:\Windows\SYSTEM32\SHLWAPI.dll <br /> <span style="color: #000000;">3</span> , C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_5<span style="color: #000000;">.82</span><span style="color: #000000;">.9600</span>.17810_none_7c5b6 <br /> <span style="color: #000000;">4</span> DDE <span style="color: #00C800;">Server</span> <span style="color: #0000ff;">Window</span>, C:\Windows\SYSTEM32\OLE32.DLL <br /> <span style="color: #000000;">5</span> Tussen taken schakelen, C:\Pieter\adorddtest\adorddtest.exe <br /><br />Variables in use<br />================<br /> Procedure Type Value<br /> ==========================<br /> __DBAPP<br /> Param <span style="color: #000000;">1</span>: C <span style="color: #ff0000;">"customer2.dbf"</span><br /> Param <span style="color: #000000;">2</span>: A Len: <span style="color: #000000;">0</span><br /> Param <span style="color: #000000;">3</span>: U <br /> Param <span style="color: #000000;">4</span>: U <br /> Param <span style="color: #000000;">5</span>: U <br /> Param <span style="color: #000000;">6</span>: U <br /> Param <span style="color: #000000;">7</span>: L .F.<br /> Param <span style="color: #000000;">8</span>: C <span style="color: #ff0000;">"DBFCDX"</span><br /> Param <span style="color: #000000;">9</span>: U <br /> Param <span style="color: #000000;">10</span>: U <br /> <span style="color: #00C800;">Local</span> <span style="color: #000000;">1</span>: U <br /> <span style="color: #00C800;">Local</span> <span style="color: #000000;">2</span>: L .T.<br /> MAIN<br /><br />Linked RDDs<br />===========<br /> DBF<br /> DBFFPT<br /> DBFBLOB<br /> DBFNTX<br /> ADORDD<br /><br />DataBases in use<br />================<br /><br /> <span style="color: #000000;">1</span>: => CUSTOMER RddName: <span style="color: #000000;">ADORDD</span><br /> ==============================<br /> RecNo RecCount BOF EOF<br /> <span style="color: #000000;">1</span> <span style="color: #000000;">500</span> .F. .F.<br /><br /> Indexes in use TagName<br /><br /> Relations in use<br /><br />Classes in use:<br />===============<br /> <span style="color: #000000;">1</span> ERROR<br /> <span style="color: #000000;">2</span> HASHENTRY<br /> <span style="color: #000000;">3</span> HBCLASS<br /> <span style="color: #000000;">4</span> TOLEAUTO<br /> <span style="color: #000000;">5</span> HBOBJECT<br /> <span style="color: #000000;">6</span> TREG32<br /><br />Memory Analysis<br />===============<br /> <span style="color: #000000;">261</span> <span style="color: #00C800;">Static</span> variables<br /><br /> Dynamic memory consume:<br /> Actual Value: <span style="color: #000000;">0</span> bytes<br /> Highest Value: <span style="color: #000000;">0</span> bytes<br /></div>[/code:2ilsszh6]
[code=fw:2ilsszh6]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"adordd.ch"</span><br /><br /> REQUEST ADORDD, ADOVERSION<br /><br /> <span style="color: #00C800;">FUNCTION</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> RddRegister<span style="color: #000000;">(</span><span style="color: #ff0000;">"ADORDD"</span>,<span style="color: #000000;">1</span><span style="color: #000000;">)</span><br /> RddSetDefault<span style="color: #000000;">(</span><span style="color: #ff0000;">"ADORDD"</span><span style="color: #000000;">)</span><br /> <br /> SET ADO FORCE LOCK OFF <span style="color: #B900B9;">// Required!</span><br /> <br /> SET ADO <span style="color: #00C800;">DEFAULT</span> DATABASE <span style="color: #0000ff;">TO</span> <database> <span style="color: #00C800;">SERVER</span> <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"localhost"</span> ENGINE <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"MYSQL"</span> USER <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"root"</span> PASSWORD <span style="color: #0000ff;">TO</span> <password><br /> <br /> USE CUSTOMER<br /> <span style="color: #B900B9;">//APPEND BLANK</span><br /> <span style="color: #B900B9;">//REPLACE FIELD->FIRST WITH "Pieter" </span><br /> <span style="color: #B900B9;">//APPEND FROM customer2.dbf via "DBFCDX"</span><br /> BROWSE<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:2ilsszh6]
|
ADO RDD xHarbour
|
Pieter,
The field HBRECNO has to be added to every table. It is an auto-increment field.
Search this forum topic for HBRECNO for more information. I still do not really understand its purpose, but it is needed, nor do I have the exact syntax for adding it to existing SQL databases. Maybe someone else can show us how.
James
|
ADO RDD xHarbour
|
The file() function does not seem to be working.
In the tryadordd.prg this function is used like this:
if !FILE("table1;northwind.mdb")
It always returns .F. even when the table exists. I also tried it with the preceding \ syntax (that is used elsewhere in the example program):
if !FILE("table1";\northwind.mdb")
It always returns .F. also.
And I do wonder about having to include the database name. If we have to do this then it is not syntax compatible with existing FW code. We would have to change all calls to File() in our programs. Or, does it use an existing default database if no database is specified? I also tried that:
if !FILE("Table1")
Which also returns .F. even when the table exists.
Comments anyone?
Regards
James
|
ADO RDD xHarbour
|
Ok, some of the errors I have been reporting were due to another buildx.bat file that was in the path which was not linking in all three of the LIBs needed for the ADORDD. My bad.
I tried appending from a dbf to a SQL table (in an ACCESS) and it worked until it crashed at record 548. I am including the error log below. I'm at a loss at to what the problem might be.
The file I am trying to import has slightly more than 26000 records.
James
[code=fw:2kbgf7s5]<div class="fw" id="{CB}" style="font-family: monospace;">Application<br />===========<br /> Path and <span style="color: #0000ff;">name</span>: <span style="color: #000000;">C</span>:\Users\James\Documents\Projects\ADORDD\Test8.exe <span style="color: #000000;">(</span><span style="color: #000000;">32</span> bits<span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">Size</span>: <span style="color: #000000;">2</span>,<span style="color: #000000;">985</span>,<span style="color: #000000;">984</span> bytes<br /> Compiler version: <span style="color: #000000;">xHarbour</span> <span style="color: #000000;">1.2</span><span style="color: #000000;">.3</span> Intl. <span style="color: #000000;">(</span>SimpLex<span style="color: #000000;">)</span> <span style="color: #000000;">(</span>Build <span style="color: #000000;">20141106</span><span style="color: #000000;">)</span><br /> FiveWin Version: <span style="color: #000000;">FWHX</span> <span style="color: #000000;">15.05</span><br /> Windows version: <span style="color: #000000;">6.2</span>, Build <span style="color: #000000;">9200</span> <br /><br /> Time <span style="color: #0000ff;">from</span> start: <span style="color: #000000;">0</span> hours <span style="color: #000000;">0</span> mins <span style="color: #000000;">48</span> secs <br /> Error occurred <span style="color: #00C800;">at</span>: <span style="color: #000000;">07</span>/<span style="color: #000000;">27</span>/<span style="color: #000000;">15</span>, <span style="color: #000000;">22</span>:<span style="color: #000000;">43</span>:<span style="color: #000000;">27</span><br /> Error description: <span style="color: #000000;">Error</span> ADODB.Connection/<span style="color: #000000;">0</span> S_OK: <span style="color: #000000;">EXECUTE</span><br /> Args:<br /> <span style="color: #000000;">[</span> <span style="color: #000000;">1</span><span style="color: #000000;">]</span> = C <span style="color: #0000ff;">UPDATE</span> PTIME SET <span style="color: #000000;">[</span>REF<span style="color: #000000;">]</span> = <span style="color: #ff0000;">'38739#'</span>C<span style="color: #ff0000;">' WHERE [HBRECNO] = 548<br /><br />Stack Calls<br />===========<br /> Called from: => TOLEAUTO:EXECUTE( 0 )<br /> Called from: adordd.prg => ADO_PUTVALUE( 1513 )<br /> Called from: => __DBAPP( 0 )<br /> Called from: Test8.prg => MAIN( 52 )<br /><br />System<br />======<br /> CPU type: AMD A8-4555M APU with Radeon(tm) HD Graphics 1600 Mhz<br /> Hardware memory: 3271 megs<br /><br /> Free System resources: 90 %<br /> GDI resources: 90 %<br /> User resources: 90 %<br /><br /> Windows total applications running: 3<br /> 1 GDI+ Window, <br /> 2 GDI+ Window, C:<span style="color: #000000;">\W</span>indows<span style="color: #000000;">\W</span>inSxS<span style="color: #000000;">\x</span>86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.9600.17415_none_dad8722c5bcc2d <br /> 3 Task Switching, C:<span style="color: #000000;">\U</span>sers<span style="color: #000000;">\J</span>ames<span style="color: #000000;">\D</span>ocuments<span style="color: #000000;">\P</span>rojects<span style="color: #000000;">\A</span>DORDD<span style="color: #000000;">\T</span>est8.exe <br /><br />Variables in use<br />================<br /> Procedure Type Value<br /> ==========================<br /> TOLEAUTO:EXECUTE<br /> Param 1: C "UPDATE PTIME SET [REF] = '</span><span style="color: #000000;">38739</span>#<span style="color: #ff0000;">'C'</span> <span style="color: #0000ff;">WHERE</span> <span style="color: #000000;">[</span>HBRECNO<span style="color: #000000;">]</span> = <span style="color: #000000;">548</span><span style="color: #ff0000;">"<br /> Local 1: U <br /> Local 2: C "</span>ADODB.Connection<span style="color: #ff0000;">"<br /> ADO_PUTVALUE<br /> Param 1: N 1<br /> Param 2: N 9<br /> Param 3: C "</span><span style="color: #ff0000;">'38739#'</span>C<span style="color: #ff0000;">'"<br /> Local 1: A Len: 37<br /> Local 2: O Class: TOLEAUTO<br /> Local 3: N 548<br /> Local 4: A Len: 6<br /> Local 5: U <br /> Local 6: U <br /> __DBAPP<br /> Param 1: C "ptime"<br /> Param 2: A Len: 0<br /> Param 3: U <br /> Param 4: U <br /> Param 5: U <br /> Param 6: U <br /> Param 7: L .F.<br /> Param 8: C "DBFNTX"<br /> Param 9: U <br /> Param 10: U <br /> MAIN<br /><br />Linked RDDs<br />===========<br /> DBF<br /> DBFFPT<br /> DBFBLOB<br /> DBFNTX<br /> ADORDD<br /><br />DataBases in use<br />================<br /><br /> 1: PTIME1 RddName: ADORDD<br /> ==============================<br /> RecNo RecCount BOF EOF<br /> 548 548 .F. .F.<br /><br /> Indexes in use TagName<br /><br /> Relations in use<br /><br />Classes in use:<br />===============<br /> 1 ERROR<br /> 2 HASHENTRY<br /> 3 HBCLASS<br /> 4 TOLEAUTO<br /> 5 VTWRAPPER<br /> 6 HBOBJECT<br /> 7 TREG32<br /><br />Memory Analysis<br />===============<br /> 368 Static variables<br /><br /> Dynamic memory consume:<br /> Actual Value: 0 bytes<br /> Highest Value: 0 bytes</span></div>[/code:2kbgf7s5]
|
ADO RDD xHarbour
|
[quote="James Bott":9nhhq69c]Pieter,
The field HBRECNO has to be added to every table. It is an auto-increment field.
Search this forum topic for HBRECNO for more information. I still do not really understand its purpose, but it is needed, nor do I have the exact syntax for adding it to existing SQL databases. Maybe someone else can show us how.
James[/quote:9nhhq69c]
James, thanks, adding a field HBRENCO, solves the problem, when I press new in the window. However sometimes the window crashes, when I try to modify a record.
Have a nice day.
Pieter
|
ADO RDD xHarbour
|
Pieter,
Thanks for the response. In my case the table already has the HBRECNO field so that is not the issue. Today I will try a different database and try checking the integrity of the original one.
Perhaps you can post your error log when yours crashes.
James
|
ADO RDD xHarbour
|
Hello, I am new to the forum and downloaded the ADORDD code.
I did several tests and several changes.
url off my fork
<!-- m --><a class="postlink" href="https://github.com/maromano/adordd">https://github.com/maromano/adordd</a><!-- m -->
I created
ADO VIRTUAL DELETE SET ON / OFF
ADO SET DEFAULT DELETED FIELD TO cname
SET ADO FIELDDELETED TABLES LIST TO array
take a look at TRYADORDD that even do several tests APPEND FROM VIA DBFCDX <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->
|
ADO RDD xHarbour
|
Antonio,
[quote:2123b8gs]FWAdoCreateTable( "tableName", aFields, oCon, .T. )[/quote:2123b8gs]
Please, what is the last parameter for this function example above?
Also, is there a place I can find documentation for all the ADO functions?
James
|
ADO RDD xHarbour
|
Pieter or anyone:
Is there way to not import deleted records from a DBF, or do we need to PACK the database before importing?
Maybe we can just do:
APPEND FROM ... FOR ! DELETED()
James
|
ADO RDD xHarbour
|
James,
You can review all FWH ADO functions source code in FWH\source\function\adofuncs.prg
In FWAdoCreateTable() the last parameter is lAddAutoInc. As far as I understand it, it means to automatically create an auto incremental ID field.
I started a page in the wiki for the FWH ADO functions but it is not completed yet:
[url:3aa0weyn]http://wiki.fivetechsoft.com/doku.php?id=fwh_ado_api[/url:3aa0weyn]
|
ADO RDD xHarbour
|
Hi , James
In my tests the append from work via dbfcdx
Download my code and test.
Just did tests with ACCESS .
|
ADO RDD xHarbour
|
[quote="James Bott":1gerpj9k]Pieter or anyone:
Is there way to not import deleted records from a DBF, or do we need to PACK the database before importing?
Maybe we can just do:
APPEND FROM ... FOR ! DELETED()
James[/quote:1gerpj9k]
James
With my code if you use
ADO VIRTUAL SET DELETE ON
and let SET DELETED OFF,
qdo import via dbfcdx HBDELETED will see a column in the new table that will TRUE (-1 ) for deleted records and false ( 0) for non deleted .
The name of the column you choose to
ADO SET DEFAULT DELETED FIELD TO cname .
See the TRYADORDD
|
ADO RDD xHarbour
|
Maromano,
Thanks for your responses. I'm sure that your deleted functions will be useful.
I wrote a custom database class that actually reuses deleted records so the DBFs never need compacting. However, right now I am not sure if this can be used with SQL tables since they require an auto-increment field over which we have no control. This is something I will have to investigate so I will put it on my ToDo list.
James
|
ADO RDD xHarbour
|
[quote="James Bott":1dmh9z7e]Pieter or anyone:
Is there way to not import deleted records from a DBF, or do we need to PACK the database before importing?
Maybe we can just do:
APPEND FROM ... FOR ! DELETED()
James[/quote:1dmh9z7e]
From XHarbour reference guide FROM APPEND:
[quote:1dmh9z7e]Deleted records: Records in an import database file that are marked for deletion are ignored when
SET DELETED is set to ON. These records are not imported. With SET DELETED OFF, all records
matching the import scope are imported and the deleted flag is set accordingly[/quote:1dmh9z7e]
I tried to test this, but I cannot get this working because the following code does not work also:
[code=fw:1dmh9z7e]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"adordd.ch"</span><br /><br /> REQUEST ADORDD, ADOVERSION<br /><br /> <span style="color: #00C800;">FUNCTION</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> RddRegister<span style="color: #000000;">(</span><span style="color: #ff0000;">"ADORDD"</span>,<span style="color: #000000;">1</span><span style="color: #000000;">)</span><br /> RddSetDefault<span style="color: #000000;">(</span><span style="color: #ff0000;">"ADORDD"</span><span style="color: #000000;">)</span><br /> <br /> SET ADO FORCE LOCK OFF <span style="color: #B900B9;">// Required!</span><br /> <br /> SET ADO <span style="color: #00C800;">DEFAULT</span> DATABASE <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"testdb1"</span> <span style="color: #00C800;">SERVER</span> <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"localhost"</span> ENGINE <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"MYSQL"</span> USER <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"root"</span> PASSWORD <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"password"</span><br /> <br /> USE CUSTOMER <span style="color: #B900B9;">//connect with customer sqltable (with hbrecno instead of id)</span><br /> <span style="color: #B900B9;">//APPEND BLANK</span><br /> <span style="color: #B900B9;">//REPLACE FIELD->FIRST WITH "Pieter2" </span><br /> APPEND <span style="color: #0000ff;">FROM</span> customer2 via <span style="color: #ff0000;">"DBFCDX"</span> <span style="color: #B900B9;">//gives an error. //I also tried APPEND FROM customer2.dbf via "DBFCDX"</span><br /> <br /> BROWSE<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <br /> <span style="color: #00C800;">Return</span> ni</div>[/code:1dmh9z7e]
[code=fw:1dmh9z7e]<div class="fw" id="{CB}" style="font-family: monospace;">Application<br />===========<br /> Path and <span style="color: #0000ff;">name</span>: <span style="color: #000000;">C</span>:\Pieter\adorddtest\adorddtest.exe <span style="color: #000000;">(</span><span style="color: #000000;">32</span> bits<span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">Size</span>: <span style="color: #000000;">2</span>,<span style="color: #000000;">769</span>,<span style="color: #000000;">408</span> bytes<br /> Compiler version: <span style="color: #000000;">xHarbour</span> <span style="color: #000000;">1.2</span><span style="color: #000000;">.3</span> Intl. <span style="color: #000000;">(</span>SimpLex<span style="color: #000000;">)</span> <span style="color: #000000;">(</span>Build <span style="color: #000000;">20150213</span><span style="color: #000000;">)</span><br /> FiveWin Version: <span style="color: #000000;">FWHX</span> <span style="color: #000000;">15.01</span><br /> Windows version: <span style="color: #000000;">6.2</span>, Build <span style="color: #000000;">9200</span> <br /><br /> Time <span style="color: #0000ff;">from</span> start: <span style="color: #000000;">0</span> hours <span style="color: #000000;">0</span> mins <span style="color: #000000;">1</span> secs <br /> Error occurred <span style="color: #00C800;">at</span>: <span style="color: #000000;">07</span>/<span style="color: #000000;">30</span>/<span style="color: #000000;">15</span>, <span style="color: #000000;">09</span>:<span style="color: #000000;">42</span>:<span style="color: #000000;">04</span><br /> Error description: <span style="color: #000000;">Error</span> DBCMD/<span style="color: #000000;">1005</span> Argument error: __DBAPP<br /><br />Stack Calls<br />===========<br /> Called <span style="color: #0000ff;">from</span>: => __DBAPP<span style="color: #000000;">(</span> <span style="color: #000000;">0</span> <span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: <span style="color: #000000;">adorddtest</span>.prg => MAIN<span style="color: #000000;">(</span> <span style="color: #000000;">18</span> <span style="color: #000000;">)</span><br /><br />System<br />======<br /> CPU type: <span style="color: #000000;">Intel</span><span style="color: #000000;">(</span>R<span style="color: #000000;">)</span> Pentium<span style="color: #000000;">(</span>R<span style="color: #000000;">)</span> CPU N3540 @ <span style="color: #000000;">2</span>.16GHz <span style="color: #000000;">2166</span> Mhz<br /> Hardware memory: <span style="color: #000000;">3500</span> megs<br /><br /> Free System resources: <span style="color: #000000;">90</span> %<br /> GDI resources: <span style="color: #000000;">90</span> %<br /> User resources: <span style="color: #000000;">90</span> %<br /><br /> Windows total applications running: <span style="color: #000000;">4</span><br /> <span style="color: #000000;">1</span> , <br /> <span style="color: #000000;">2</span> , C:\Windows\SYSTEM32\SHLWAPI.dll <br /> <span style="color: #000000;">3</span> DDE <span style="color: #00C800;">Server</span> <span style="color: #0000ff;">Window</span>, C:\Windows\SYSTEM32\OLE32.DLL <br /> <span style="color: #000000;">4</span> Tussen taken schakelen, C:\Pieter\adorddtest\adorddtest.exe <br /><br />Variables in use<br />================<br /> Procedure Type Value<br /> ==========================<br /> __DBAPP<br /> Param <span style="color: #000000;">1</span>: <span style="color: #000000;">C</span> <span style="color: #ff0000;">"customer2"</span><br /> Param <span style="color: #000000;">2</span>: <span style="color: #000000;">A</span> Len: <span style="color: #000000;">0</span><br /> Param <span style="color: #000000;">3</span>: <span style="color: #000000;">U</span> <br /> Param <span style="color: #000000;">4</span>: <span style="color: #000000;">U</span> <br /> Param <span style="color: #000000;">5</span>: <span style="color: #000000;">U</span> <br /> Param <span style="color: #000000;">6</span>: <span style="color: #000000;">U</span> <br /> Param <span style="color: #000000;">7</span>: <span style="color: #000000;">L</span> .F.<br /> Param <span style="color: #000000;">8</span>: <span style="color: #000000;">C</span> <span style="color: #ff0000;">"DBFCDX"</span><br /> Param <span style="color: #000000;">9</span>: <span style="color: #000000;">U</span> <br /> Param <span style="color: #000000;">10</span>: <span style="color: #000000;">U</span> <br /> <span style="color: #00C800;">Local</span> <span style="color: #000000;">1</span>: <span style="color: #000000;">U</span> <br /> <span style="color: #00C800;">Local</span> <span style="color: #000000;">2</span>: <span style="color: #000000;">L</span> .T.<br /> MAIN<br /><br />Linked RDDs<br />===========<br /> DBF<br /> DBFFPT<br /> DBFBLOB<br /> DBFNTX<br /> ADORDD<br /><br />DataBases in use<br />================<br /><br /> <span style="color: #000000;">1</span>: => CUSTOMER RddName: <span style="color: #000000;">ADORDD</span><br /> ==============================<br /> RecNo RecCount BOF EOF<br /> <span style="color: #000000;">1</span> <span style="color: #000000;">501</span> .F. .F.<br /><br /> Indexes in use TagName<br /><br /> Relations in use<br /><br />Classes in use:<br />===============<br /> <span style="color: #000000;">1</span> ERROR<br /> <span style="color: #000000;">2</span> HASHENTRY<br /> <span style="color: #000000;">3</span> HBCLASS<br /> <span style="color: #000000;">4</span> TOLEAUTO<br /> <span style="color: #000000;">5</span> HBOBJECT<br /> <span style="color: #000000;">6</span> TREG32<br /><br />Memory Analysis<br />===============<br /> <span style="color: #000000;">261</span> <span style="color: #00C800;">Static</span> variables<br /><br /> Dynamic memory consume:<br /> <span style="color: #000000;">Actual</span> Value: <span style="color: #000000;">0</span> bytes<br /> Highest Value: <span style="color: #000000;">0</span> bytes<br /></div>[/code:1dmh9z7e]
Pieter
|
ADO RDD xHarbour
|
[quote="pieter":3vs5riui]
I tried to test this, but I cannot get this working because the following code does not work also:
[code=fw:3vs5riui]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"adordd.ch"</span><br /><br /> REQUEST ADORDD, ADOVERSION<br /><br /> <span style="color: #00C800;">FUNCTION</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> RddRegister<span style="color: #000000;">(</span><span style="color: #ff0000;">"ADORDD"</span>,<span style="color: #000000;">1</span><span style="color: #000000;">)</span><br /> RddSetDefault<span style="color: #000000;">(</span><span style="color: #ff0000;">"ADORDD"</span><span style="color: #000000;">)</span><br /> <br /> SET ADO FORCE LOCK OFF <span style="color: #B900B9;">// Required!</span><br /> <br /> SET ADO <span style="color: #00C800;">DEFAULT</span> DATABASE <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"testdb1"</span> <span style="color: #00C800;">SERVER</span> <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"localhost"</span> ENGINE <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"MYSQL"</span> USER <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"root"</span> PASSWORD <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"password"</span><br /> <br /> USE CUSTOMER <span style="color: #B900B9;">//connect with customer sqltable (with hbrecno instead of id)</span><br /> <span style="color: #B900B9;">//APPEND BLANK</span><br /> <span style="color: #B900B9;">//REPLACE FIELD->FIRST WITH "Pieter2" </span><br /> APPEND <span style="color: #0000ff;">FROM</span> customer2 via <span style="color: #ff0000;">"DBFCDX"</span> <br /> <br /> BROWSE<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <br /> <span style="color: #00C800;">Return</span> ni</div>[/code:3vs5riui]
[/quote:3vs5riui]
In my tests using ADORDD I put a REQUEST DBFCDX and did not show any error. But I tested with ACCESS .
[code=fw:3vs5riui]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"adordd.ch"</span><br /><br /> *********************<br /> REQUEST DBFCDX<br /> *********************<br /> REQUEST ADORDD, ADOVERSION<br /><br /> <span style="color: #00C800;">FUNCTION</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> RddRegister<span style="color: #000000;">(</span><span style="color: #ff0000;">"ADORDD"</span>,<span style="color: #000000;">1</span><span style="color: #000000;">)</span><br /> RddSetDefault<span style="color: #000000;">(</span><span style="color: #ff0000;">"ADORDD"</span><span style="color: #000000;">)</span><br /> <br /> SET ADO FORCE LOCK OFF <span style="color: #B900B9;">// Required!</span><br /> <br /> SET ADO <span style="color: #00C800;">DEFAULT</span> DATABASE <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"testdb1"</span> <span style="color: #00C800;">SERVER</span> <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"localhost"</span> ENGINE <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"MYSQL"</span> USER <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"root"</span> PASSWORD <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"password"</span><br /> <br /> USE CUSTOMER <span style="color: #B900B9;">//connect with customer sqltable (with hbrecno instead of id)</span><br /> <span style="color: #B900B9;">//APPEND BLANK</span><br /> <span style="color: #B900B9;">//REPLACE FIELD->FIRST WITH "Pieter2" </span><br /> APPEND <span style="color: #0000ff;">FROM</span> customer2 via <span style="color: #ff0000;">"DBFCDX"</span> <span style="color: #B900B9;">//gives an error. //I also tried APPEND FROM customer2.dbf via "DBFCDX"</span><br /> <br /> BROWSE<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <br /> <span style="color: #00C800;">Return</span> ni</div>[/code:3vs5riui]
See my TRYADORDD. I do not use FiveWin.
You need to create two folders , DADOS and LOCKS in the current folder of the executable to work. And having a DBF called IMPORTS.DBF.
[code=fw:3vs5riui]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br /><span style="color: #B900B9;">//2015 AHF - Antonio H. Ferreira <disal.antonio.ferreira@gmail.com></span><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"adordd.ch"</span> <br /><br /><br /> <span style="color: #00C800;">FUNCTION</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <br /> Request DBFCDX<br /> <br /> <span style="color: #00C800;">LOCAL</span> cSql :=<span style="color: #ff0000;">""</span><br /> SET EXCLUSIVE OFF<br /><br /><br /><br /><br /> REQUEST ADORDD, ADOVERSION, RECSIZE<br /> RddRegister<span style="color: #000000;">(</span><span style="color: #ff0000;">"ADORDD"</span>,<span style="color: #000000;">1</span><span style="color: #000000;">)</span><br /> RddSetDefault<span style="color: #000000;">(</span><span style="color: #ff0000;">"ADORDD"</span><span style="color: #000000;">)</span><br /> <br /><br /><br /> <span style="color: #B900B9;">/* NOTES<br /><br /> SET ADO TABLES INDEX LIST TO = indexes without of any clipper like expression only to be used by SQL<br /><br /> SET ADODBF TABLES INDEX LIST TO = indexes with the clipper like expressions needed by the app for its evaluations.<br /><br /> When we use &(indexkey(0)) we cant evaluate a index expression in ADO TABLES "name+dDate+nValue" we will get an error but we can issues a sql select like that.<br /> Thus we need the ADODBF expression "name+DTOS(dDate)+STR(nValue) to do it.<br /><br /> The ADO indexes are for queries the ADODBF are for the normal clipper expressions to allow its evaluation.<br /><br /> ARRAY SPEC FOR BOTH CASES:<br /> ATTENTION ALL MUST BE UPPERCASE<br /> { {"TABLE1",{"FIRST","FIRST"} }, {"TABLE2" ,{"CODID","CODID"}} }<br /><br /> temporary index names<br /> temporary indexes are not included here they are create on fly and added to temindex list array<br /> they are only valid through the duration of the application<br /> the temp index name is auto given by adordd<br /><br /> SET ADO TEMPORAY NAMES INDEX LIST TO {"TMP","TEMP"}<br /><br /> each table autoinc field used as recno<br /><br /> SET ADO FIELDRECNO TABLES LIST TO {{"TABLE1","HBRECNO"},{"TABLE2","HBRECNO"}}<br /><br /> default table autoinc field used as recno<br /><br /> SET ADO DEFAULT RECNO FIELD TO "HBRECNO"<br /><br /> SET AUTOPEN ON //might be OFF if you wish<br /> SET AUTORDER TO 1 // first index opened can be other<br /><br /> set default parameters to adordd if you do not USE COMMAND or dont pretend to include this info<br /> set it here<br /><br /> SET ADO DEFAULT DATABASE TO "test2.mdb" SERVER TO "ACCESS" ENGINE TO "ACESS" ;<br /> USER TO "" PASSWORD TO ""<br /><br /> SET DBF TABLE TCONTROL ALL LOCKING RECORD AND TABLE IN ADORDD<br /><br /> DEFAULTS TO PATH WHERE APP IS RUNING<br /> SET ADO LOCK CONTROL SHAREPATH TO "C:" RDD TO "DBFCDX"<br /> DISABLE CONTOL LOCK<br /> SET ADO FORCE LOCK OFF /ON<br /><br />/* THE ONLY CHANGES IN YOUR APP CODE END HERE! (SHOULD) */</span><br /><br /><br /><span style="color: #B900B9;">/* T R I A L S<br /> PEASE READ THIS CAREFULLY!<br /><br /> PLEASE REMEMBER THAT ALTHOUGH ADORDD STILL AND MIGHT WORK WITHOUT ANY AUTOINC FIELD AS RECNO<br /> RESULT WILL BE UNPREDICTABLE IN SOME CIRCUNSTANCES OR ERROR MIGHT OCCOUR.<br /> THE FINAL RELEASE WIL NOT WORK WITHOUT SUCH A FIELD<br /><br /> INDEXES WITH DATES IN SOME BROWSE WITHIN A DATE SCOPE RECORD MOVEMENT HAS STILL SOME PROBLEMS<br /><br /> WHEN YOU DELETE A RECORD YOU CANT ACCESS IT ANYMORE. THUS CODE LIKE THIS IS ILLEGAL:<br /><br /> DELETE RECORD<br /> BLANKREC<br /><br /> THIS MUST BE CHANGED TO<br /><br /> IF RDDNAME() = "ADORDD"<br /> BLANKREC<br /> DELETE RECORD<br /> ELSE<br /> DELETE RECORD<br /> BLANKREC<br /> ENDIF<br /><br /> YOU CAN OPEN A TABLE ALSO WITH ANEW CONNECTION<br /> USE "CTABLE@ CON SRING" ALIAS "TABLE"<br /><br /> ANY INDEX FUNCTION OR VARIABLES MUST BE EVALUAED BEFORE SENT TO ADO<br /><br /> BESIDES THESE CHANGES APP SHOULD RUN WITHOUT ANY CODE LOGIC CHANGE<br /><br /><br /> PLEASE REPORT ANY BUGS! THANKS! */</span><br /> <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;">"TABLE1"</span>,<span style="color: #000000;">{</span><span style="color: #ff0000;">"FIRST"</span>,<span style="color: #ff0000;">"FIRST"</span><span style="color: #000000;">}</span> <span style="color: #000000;">}</span>, <span style="color: #000000;">{</span><span style="color: #ff0000;">"TABLE2"</span> ,<span style="color: #000000;">{</span><span style="color: #ff0000;">"CODID"</span>,<span style="color: #ff0000;">"CODID"</span><span style="color: #000000;">}</span><span style="color: #000000;">}</span> <span style="color: #000000;">}</span><br /> SET ADODBF 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;">"TABLE1"</span>,<span style="color: #000000;">{</span><span style="color: #ff0000;">"FIRST"</span>,<span style="color: #ff0000;">"FIRST"</span><span style="color: #000000;">}</span> <span style="color: #000000;">}</span>, <span style="color: #000000;">{</span><span style="color: #ff0000;">"TABLE2"</span> ,<span style="color: #000000;">{</span><span style="color: #ff0000;">"CODID"</span>,<span style="color: #ff0000;">"CODID"</span><span style="color: #000000;">}</span><span style="color: #000000;">}</span> <span style="color: #000000;">}</span><br /> SET ADO TEMPORARY 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 /> SET ADO FIELDRECNO TABLES LIST <span style="color: #0000ff;">TO</span> <span style="color: #000000;">{</span><span style="color: #000000;">{</span><span style="color: #ff0000;">"TABLE1"</span>,<span style="color: #ff0000;">"HBRECNO"</span><span style="color: #000000;">}</span>,<span style="color: #000000;">{</span><span style="color: #ff0000;">"TABLE2"</span>,<span style="color: #ff0000;">"HBRECNO"</span><span style="color: #000000;">}</span><span style="color: #000000;">}</span><br /> SET ADO <span style="color: #00C800;">DEFAULT</span> RECNO FIELD <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"HBRECNO"</span><br /> SET AUTOPEN <span style="color: #0000ff;">ON</span> <span style="color: #B900B9;">//might be OFF if you wish</span><br /> SET AUTORDER <span style="color: #0000ff;">TO</span> <span style="color: #000000;">1</span> <span style="color: #B900B9;">// first index opened can be other</span><br /> <br /> SET ADO FORCE LOCK <span style="color: #0000ff;">ON</span> <span style="color: #B900B9;">// Changed default to OFF</span><br /> <br /> <span style="color: #B900B9;">//CONTROL LOCKING IN ADORDD FOR BOTH TABLE AND RECORD DONT PUT FINAL "\"</span><br /> SET ADO LOCK CONTROL SHAREPATH <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"LOCKS"</span> RDD <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"DBFCDX"</span><br /> <br /> <br /> <span style="color: #B900B9;">// NEW FEATURES -- MAROMANO</span><br /> SET ADO VIRTUAL DELETE <span style="color: #0000ff;">ON</span> <span style="color: #B900B9;">/* DELETE LIKE DBF ?*/</span><br /> SET ADO <span style="color: #00C800;">DEFAULT</span> DELETED FIELD <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"HBDELETED"</span> <span style="color: #B900B9;">/* defining the default name for DELETED field*/</span><br /> SET ADO FIELDDELETED TABLES LIST <span style="color: #0000ff;">TO</span> <span style="color: #000000;">{</span><span style="color: #000000;">{</span><span style="color: #ff0000;">"TABLE1"</span>,<span style="color: #ff0000;">"HBDELETED"</span><span style="color: #000000;">}</span>,<span style="color: #000000;">{</span><span style="color: #ff0000;">"TABLE2"</span>,<span style="color: #ff0000;">"HBDELETED"</span><span style="color: #000000;">}</span><span style="color: #000000;">}</span><br /> <br /> SET DELETED OFF<br /> <br /> <span style="color: #00C800;">IF</span> <span style="color: #000000;">(</span>NewDB := !FILE<span style="color: #000000;">(</span> <span style="color: #ff0000;">"DADOS<span style="color: #000000;">\t</span>est2.mdb"</span> <span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> <span style="color: #B900B9;">//need to include complete path defaults to SET ADO DEFAULT DATABA</span><br /> DbCreate<span style="color: #000000;">(</span><span style="color: #ff0000;">"table1;DADOS<span style="color: #000000;">\t</span>est2.mdb;ACCESS;Marco_Note"</span>, ;<br /> <span style="color: #000000;">{</span><span style="color: #000000;">{</span> <span style="color: #ff0000;">"CODID"</span>, <span style="color: #ff0000;">"C"</span>, <span style="color: #000000;">10</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">}</span>,;<br /> <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>,;<br /> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"HBRECNO"</span>, <span style="color: #ff0000;">"+"</span>, <span style="color: #000000;">10</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 /> <br /> <span style="color: #00C800;">endif</span><br /><br /> <span style="color: #B900B9;">//need to include complete path</span><br /> SET ADO <span style="color: #00C800;">DEFAULT</span> DATABASE <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"DADOS<span style="color: #000000;">\t</span>est2.mdb"</span> <span style="color: #00C800;">SERVER</span> <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"MARCO_NOTE"</span> ENGINE <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"ACCESS"</span> USER <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">""</span> PASSWORD <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">""</span><br /> <br /> <span style="color: #00C800;">if</span> hb_adoRddExistsTable<span style="color: #000000;">(</span> <span style="color: #ff0000;">"table1"</span><span style="color: #000000;">)</span> .and. NewDB<br /> <br /> <br /> SELE <span style="color: #000000;">0</span><br /> USE table1 <span style="color: #0000ff;">ALIAS</span> <span style="color: #ff0000;">"TEST1"</span><br /> <br /> APPEND BLANK<br /> test1->First := <span style="color: #ff0000;">"HOMER si no Homer"</span><br /> test1->Last := <span style="color: #ff0000;">"Simpson"</span><br /> test1->Age := <span style="color: #000000;">45</span><br /> test1->codid := <span style="color: #ff0000;">"0001"</span><br /> <br /> APPEND BLANK<br /> test1->First := <span style="color: #ff0000;">"Lara"</span><br /> test1->Last := <span style="color: #ff0000;">"Croft si no"</span><br /> test1->Age := <span style="color: #000000;">32</span><br /> test1->codid := <span style="color: #ff0000;">"0002"</span><br /> test1-><span style="color: #000000;">(</span>dbcommit<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span> <br /> <span style="color: #00C800;">endif</span><br /> <br /> <span style="color: #00C800;">if</span> !hb_adoRddExistsTable<span style="color: #000000;">(</span> <span style="color: #ff0000;">"table2"</span><span style="color: #000000;">)</span> <br /> <span style="color: #B900B9;">//need to include complete path defaults to SET ADO DEFAULT DATABA</span><br /> DbCreate<span style="color: #000000;">(</span> <span style="color: #ff0000;">"table2;DADOS<span style="color: #000000;">\t</span>est2.mdb;ACCESS;Marco_Note"</span>, ;<br /> <span style="color: #000000;">{</span> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"CODID"</span>, <span style="color: #ff0000;">"C"</span>, <span style="color: #000000;">10</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"ADDRESS"</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;">"PHONE"</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;">"EMAIL"</span>, <span style="color: #ff0000;">"C"</span>, <span style="color: #000000;">100</span>,<span style="color: #000000;">0</span> <span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"HBRECNO"</span>, <span style="color: #ff0000;">"+"</span>, <span style="color: #000000;">10</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 /> <br /> SELE <span style="color: #000000;">0</span><br /> USE table2 <span style="color: #0000ff;">ALIAS</span> <span style="color: #ff0000;">"TEST2"</span><br /> <br /> APPEND BLANK<br /> test2->address := <span style="color: #ff0000;">"742 Evergreen Terrace"</span><br /> test2->phone := <span style="color: #ff0000;">"01 2920002"</span><br /> test2->email := <span style="color: #ff0000;">"homer@homersimpson.com"</span><br /> test2->codid := <span style="color: #ff0000;">"0001"</span><br /> <br /> APPEND BLANK<br /> test2->address := <span style="color: #ff0000;">"Raymond Street"</span><br /> test2->phone := <span style="color: #ff0000;">"0039 29933003"</span><br /> test2->email := <span style="color: #ff0000;">"lara@laracroft.com"</span><br /> test2->codid := <span style="color: #ff0000;">"0002"</span><br /> test2-><span style="color: #000000;">(</span>dbcommit<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span> <br /> <br /><br /> <span style="color: #00C800;">if</span> !hb_adoRddExistsTable<span style="color: #000000;">(</span> <span style="color: #ff0000;">"table3"</span><span style="color: #000000;">)</span> <br /> <span style="color: #B900B9;">//need to include complete path defaults to SET ADO DEFAULT DATABA</span><br /> DbCreate<span style="color: #000000;">(</span> <span style="color: #ff0000;">"table3;DADOS<span style="color: #000000;">\t</span>est2.mdb"</span>, ;<br /> <span style="color: #000000;">{</span> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"CODID"</span>, <span style="color: #ff0000;">"C"</span>, <span style="color: #000000;">10</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"ADDRESS"</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;">"PHONE"</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;">"EMAIL"</span>, <span style="color: #ff0000;">"C"</span>, <span style="color: #000000;">100</span>,<span style="color: #000000;">0</span> <span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"HBRECNO"</span>, <span style="color: #ff0000;">"+"</span>, <span style="color: #000000;">10</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 /> <br /><br /><br /> CLOSE ALL<br /> <br /><br /><br /> SELE <span style="color: #000000;">0</span><br /> USE table1 <span style="color: #0000ff;">ALIAS</span> <span style="color: #ff0000;">"TEST1"</span><br /> <br /> APPEND BLANK<br /> test1->First := <span style="color: #ff0000;">"A HOMER si no Homer "</span><br /> test1->Last := <span style="color: #ff0000;">"A Simpson delete"</span><br /> test1->Age := <span style="color: #000000;">45</span><br /> test1->codid := <span style="color: #ff0000;">"0001"</span> <br /> <br /> SELE <span style="color: #000000;">0</span><br /> USE table2 <span style="color: #0000ff;">ALIAS</span> <span style="color: #ff0000;">"TEST2"</span> <br /><br /> <span style="color: #B900B9;">//LOCKING TRIAL</span><br /> GOTO <span style="color: #000000;">1</span><br /><br /> <span style="color: #00C800;">IF</span> DBRLOCK<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"TABLE 2 RECORD 1 LOCKED! START ANOTHER "</span>+;<br /> <span style="color: #ff0000;">"INSTANCE OF APP BEFORE CLOSING THIS MESSAGE"</span>+;<br /> <span style="color: #ff0000;">" CHECK LOCK!"</span><span style="color: #000000;">)</span><br /> UNLOCK<br /><br /> <span style="color: #00C800;">ELSE</span><br /> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"TABLE 2 COULD NOT LOCK RECORD 1"</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> skip <span style="color: #000000;">1</span><br /><br /> <span style="color: #00C800;">IF</span> DBRLOCK<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"TABLE 2 RECORD 2 LOCKED! START ANOTHER "</span>+;<br /> <span style="color: #ff0000;">"INSTANCE OF APP BEFORE CLOSING THIS MESSAGE"</span>+;<br /> <span style="color: #ff0000;">" CHECK LOCK!"</span><span style="color: #000000;">)</span><br /> UNLOCK<br /><br /> <span style="color: #00C800;">ELSE</span><br /> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"TABLE 2 COULD NOT LOCK RECORD 2"</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> GO TOP<br /><br /> SELE TEST1<br /> GO TOP<br /> <br /> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"BROWSE DEFAULT ORDER TABLE1"</span><span style="color: #000000;">)</span><br /> Browse<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <br /> GO BOTTOM<br /> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"BLOCKING AND DELETING LAST RECORD"</span><span style="color: #000000;">)</span><br /> <br /> <span style="color: #00C800;">IF</span> DBRLOCK<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> DELETE<br /> UNLOCK<br /><br /> <span style="color: #00C800;">ELSE</span><br /> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"TABLE 1 COULD NOT LOCK RECORD 1"</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> GO TOP<br /> <br /> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"BROWSE DEFAULT ORDER TABLE1 AFTER DELETE"</span><span style="color: #000000;">)</span><br /> Browse<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <br /> GO TOP<br /> <br /> set DELETED <span style="color: #0000ff;">ON</span><br /> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"BROWSE DEFAULT ORDER TABLE1 AFTER DELETE (DELETED ON)"</span><span style="color: #000000;">)</span><br /> Browse<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <br /> set DELETED OFF<br /><br /><br /> SELE TEST2<br /> GO TOP<br /> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"BROWSE DEFAULT ORDER TABLE2"</span><span style="color: #000000;">)</span><br /> Browse<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> SELE TEST1<br /> SET RELATION <span style="color: #0000ff;">TO</span> CODID INTO TEST2<br /> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"SET RELATION TO CODID FROM TABLE1 TO TABLE2"</span><span style="color: #000000;">)</span><br /> GO TOP<br /> <span style="color: #00C800;">DO</span> <span style="color: #00C800;">WHILE</span> !EOF<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"Name "</span>+TEST1->FIRST+<span style="color: #ff0000;">" Address "</span>+TEST2->ADDRESS<span style="color: #000000;">)</span><br /> DBSKIP<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDDO</span><br /><br /> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"BROWSE TABLE1"</span><span style="color: #000000;">)</span><br /> BROWSE<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"CHANGE ORDER CREATE INDEX ON LAST TABLE1"</span><span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">ON</span> LAST <span style="color: #0000ff;">TO</span> TMP<br /> SET <span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">TO</span> TMP<br /><br /> BROWSE<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> cSql := <span style="color: #ff0000;">"CREATE VIEW CONTACTS AS SELECT TABLE1.FIRST, TABLE1.LAST,"</span>+;<br /> <span style="color: #ff0000;">"TABLE1.AGE, TABLE2.ADDRESS, TABLE2.EMAIL "</span>+;<br /> <span style="color: #ff0000;">"FROM TABLE1 LEFT OUTER JOIN TABLE2 ON TABLE1.CODID = TABLE2.CODID"</span><br /> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"RUNING SQL "</span>+cSql<span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">TRY</span><br /> hb_GetAdoConnection<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #000000;">EXECUTE</span><span style="color: #000000;">(</span>cSql<span style="color: #000000;">)</span><br /> CATCH<br /> ADOSHOWERROR<span style="color: #000000;">(</span> hb_GetAdoConnection<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> END<br /><br /> SELE <span style="color: #000000;">0</span><br /> USE CONTACTS<br /> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"BROWSING VIEW CONTACTS"</span><span style="color: #000000;">)</span><br /> BROWSE<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">ON</span> ADDRESS <span style="color: #0000ff;">TO</span> TMP2<br /> SET <span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">TO</span> TMP2<br /> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"INDEXED BY ADRESS"</span><span style="color: #000000;">)</span><br /> BROWSE<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #B900B9;">//WORKING DIRECTLY WITH RECORDSET IN ANOTHER AREA</span><br /> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"GET RECORDSET FOR TABLE TEST1 "</span>+STR<span style="color: #000000;">(</span><span style="color: #0000ff;">SELECT</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"TEST1"</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /> oRs := hb_adoRddGetRecordSet<span style="color: #000000;">(</span><span style="color: #0000ff;">SELECT</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"TEST1"</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /><br /> oRs:<span style="color: #000000;">close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> aa := <span style="color: #ff0000;">"SELECT * FROM "</span>+hb_adoRddGetTableName<span style="color: #000000;">(</span> <span style="color: #0000ff;">SELECT</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"TEST1"</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span>+ <span style="color: #ff0000;">" WHERE FIRST = 'Lara'"</span><br /><br /> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"NEW SELECT FOR RECORDSET TEST1 "</span>+AA<span style="color: #000000;">)</span><br /> oRs:<span style="color: #000000;">open</span><span style="color: #000000;">(</span>aa,hb_adoRddGetConnection<span style="color: #000000;">(</span><span style="color: #0000ff;">SELECT</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"TEST1"</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"CURRENT WORKAREA "</span>+<span style="color: #0000ff;">ALIAS</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"BROWSE RECORDSET ALIAS TEST1"</span><span style="color: #000000;">)</span><br /> TEST1-><span style="color: #000000;">(</span>BROWSE<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> <br /> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"DELETING TABLE IMPORTS IF EXISTS"</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">if</span> hb_adoRddExistsTable<span style="color: #000000;">(</span> <span style="color: #ff0000;">"IMPORTS"</span><span style="color: #000000;">)</span><br /> cSql := <span style="color: #ff0000;">"DROP TABLE IMPORTS"</span><br /> <span style="color: #00C800;">TRY</span><br /> hb_GetAdoConnection<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #000000;">EXECUTE</span><span style="color: #000000;">(</span>cSql<span style="color: #000000;">)</span><br /> CATCH<br /> ADOSHOWERROR<span style="color: #000000;">(</span> hb_GetAdoConnection<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> END<br /> <span style="color: #00C800;">endif</span><br /> <br /> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"GET TABLE IMPORTS STRUCTURE VIA DBFCDX"</span><span style="color: #000000;">)</span> <br /> <span style="color: #0000ff;">select</span> <span style="color: #000000;">0</span><br /> USE IMPORTS <span style="color: #0000ff;">ALIAS</span> IMP VIA <span style="color: #ff0000;">"DBFCDX"</span><br /> aStru := dbstruct<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> use<br /> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"CREATING TABLE IMPORTS VIA ADO WITH STRUCTURE"</span><span style="color: #000000;">)</span><br /> DbCreate<span style="color: #000000;">(</span> <span style="color: #ff0000;">"IMPORTS;DADOS<span style="color: #000000;">\t</span>est2.mdb"</span>, ;<br /> aStru , <span style="color: #ff0000;">"ADORDD"</span> <span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"OPEN TABLE IMPORTS VIA ADO AND APPEND FROM DBF VIA DBFCDX "</span><span style="color: #000000;">)</span> <br /> use IMPORTS <span style="color: #0000ff;">alias</span> ADOIMP<br /> APPEND <span style="color: #0000ff;">FROM</span> IMPORTS via <span style="color: #ff0000;">"DBFCDX"</span><br /> <br /> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"BROWSE ADO IMPORTS TABLE"</span><span style="color: #000000;">)</span><br /> browse<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"DOES TABLE1 EXISTS ON DB ?"</span>+ValToCharacter<span style="color: #000000;">(</span>hb_adoRddExistsTable<span style="color: #000000;">(</span> <span style="color: #ff0000;">"Table1"</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"DOES TABLE3 EXISTS ON DB ?"</span>+ValToCharacter<span style="color: #000000;">(</span>hb_adoRddExistsTable<span style="color: #000000;">(</span> <span style="color: #ff0000;">"Table3"</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"DOES TABLE4 EXISTS ON DB ?"</span>+ValToCharacter<span style="color: #000000;">(</span>hb_adoRddExistsTable<span style="color: #000000;">(</span> <span style="color: #ff0000;">"Table4"</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"DOES IMPORTS EXISTS ON DB ?"</span>+ValToCharacter<span style="color: #000000;">(</span>hb_adoRddExistsTable<span style="color: #000000;">(</span> <span style="color: #ff0000;">"IMPORTS"</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> <br /> <br /> cSql := <span style="color: #ff0000;">"DROP VIEW CONTACTS"</span><br /> <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"RUNING SQL "</span>+cSql<span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">TRY</span><br /> hb_GetAdoConnection<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #000000;">EXECUTE</span><span style="color: #000000;">(</span>cSql<span style="color: #000000;">)</span><br /> CATCH<br /> ADOSHOWERROR<span style="color: #000000;">(</span> hb_GetAdoConnection<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> END<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><br /> </div>[/code:3vs5riui]
|
ADO RDD xHarbour
|
DROP TABLE
Using ADORDD or the ADO functions, is there any way to drop a table?
I know you can ZAP a table but this doesn't zero out the auto-increment fields. The table is empty but the auto-increment fields start at the last number that was used. I see that this is a good thing, but for testing I need to drop the table then re-create it so I can start auto-increment fields with 1.
OK, I can erase the entire database (mbd) but then I have to recreate all the tables (that is what I am doing now).
I don't see a drop table function in adofuncs.prg or in adordd.prg.
James
|
ADO RDD xHarbour
|
Maromano,
In your tests have you been able to do an APPEND FROM... with several thousand records?
I have tried my code twice and it crashed at 548 records once, and 1354 records once (after rebooting). So, I suspect this has something to do with memory. Both APPEND FROM tests were using the same database for importing.
This is a show-stopper for doing testing on large databases.
James
|
ADO RDD xHarbour
|
James,
[quote="James Bott":36fptfam]DROP TABLE
Using ADORDD or the ADO functions, is there any way to drop a table?
I know you can ZAP a table but this doesn't zero out the auto-increment fields. The table is empty but the auto-increment fields start at the last number that was used. I see that this is a good thing, but for testing I need to drop the table then re-create it so I can start auto-increment fields with 1.
OK, I can erase the entire database (mbd) but then I have to recreate all the tables (that is what I am doing now).
I don't see a drop table function in adofuncs.prg or in adordd.prg.
James[/quote:36fptfam]
What about TRUNCATE TABLE? It erases all data from table and reset the auto-increment fields.
|
ADO RDD xHarbour
|
Kleyber,
Thanks, I did not know about TRUNCATE TABLE.
However, I just looked at adofuncs.prg and TRUNCATE does not seem to be supported.
Regards,
James
|
ADO RDD xHarbour
|
James:
TRUNCATE TABLE is an ADO command, here is a sample
[code=fw:2eb0r4ib]<div class="fw" id="{CB}" style="font-family: monospace;"><br /> cCmdSql := <span style="color: #ff0000;">"TRUNCATE TABLE "</span> + cTabNam<br /><br /> <span style="color: #00C800;">TRY</span><br /> oApp:<span style="color: #000000;">oCon</span>:<span style="color: #000000;">Execute</span><span style="color: #000000;">(</span>cCmdSql<span style="color: #000000;">)</span><br /> CATCH oError<br /> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"La tabla "</span> + cTabNam + <span style="color: #ff0000;">" NO pudo ser limpiada"</span>,oApp:<span style="color: #000000;">cAplicacion</span><span style="color: #000000;">)</span><br /> ShowError<span style="color: #000000;">(</span>oError<span style="color: #000000;">)</span><br /> END<br /> </div>[/code:2eb0r4ib]
Regards
|
ADO RDD xHarbour
|
Armando,
Thanks, I will give it a try.
James
|
ADO RDD xHarbour
|
I am having trouble with AdoCreateTableSQL(). It errors out.
Here is the section of my code:
[code=fw:pnxmh7wb]<div class="fw" id="{CB}" style="font-family: monospace;"> <span style="color: #B900B9;">// Read structure of DBF </span><br /> aFields := dbstruct<span style="color: #000000;">(</span> <span style="color: #ff0000;">"ptime"</span><span style="color: #000000;">)</span><br /> aFields := aadd<span style="color: #000000;">(</span> aFields, <span style="color: #000000;">{</span> <span style="color: #ff0000;">"HBRECNO"</span>, <span style="color: #ff0000;">"+"</span>, <span style="color: #000000;">10</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// New field (required)</span><br /><br /> <span style="color: #B900B9;">// Create SQL table</span><br /> lAddAutoInc:=.f. <span style="color: #B900B9;">// already added autoinc field above</span><br /> FW_AdoCreateTableSQL<span style="color: #000000;">(</span> <span style="color: #ff0000;">"ptime"</span>, aFields, oCon, lAddAutoInc <span style="color: #000000;">)</span></div>[/code:pnxmh7wb]
And here is the error:
[code=fw:pnxmh7wb]<div class="fw" id="{CB}" style="font-family: monospace;">Application<br />===========<br /> Path and <span style="color: #0000ff;">name</span>: <span style="color: #000000;">C</span>:\Users\James\Documents\Projects\ADORDD\Test8.exe <span style="color: #000000;">(</span><span style="color: #000000;">32</span> bits<span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">Size</span>: <span style="color: #000000;">2</span>,<span style="color: #000000;">987</span>,<span style="color: #000000;">008</span> bytes<br /> Compiler version: <span style="color: #000000;">xHarbour</span> <span style="color: #000000;">1.2</span><span style="color: #000000;">.3</span> Intl. <span style="color: #000000;">(</span>SimpLex<span style="color: #000000;">)</span> <span style="color: #000000;">(</span>Build <span style="color: #000000;">20141106</span><span style="color: #000000;">)</span><br /> FiveWin Version: <span style="color: #000000;">FWHX</span> <span style="color: #000000;">15.05</span><br /> Windows version: <span style="color: #000000;">6.2</span>, Build <span style="color: #000000;">9200</span> <br /><br /> Time <span style="color: #0000ff;">from</span> start: <span style="color: #000000;">0</span> hours <span style="color: #000000;">0</span> mins <span style="color: #000000;">6</span> secs <br /> Error occurred <span style="color: #00C800;">at</span>: <span style="color: #000000;">08</span>/<span style="color: #000000;">02</span>/<span style="color: #000000;">15</span>, <span style="color: #000000;">13</span>:<span style="color: #000000;">14</span>:<span style="color: #000000;">04</span><br /> Error description: <span style="color: #000000;">Error</span> BASE/<span style="color: #000000;">1604</span> Argument error: <span style="color: #00C800;">SWITCH</span><br /> Args:<br /> <span style="color: #000000;">[</span> <span style="color: #000000;">1</span><span style="color: #000000;">]</span> = C <br /><br />Stack Calls<br />===========<br /> Called <span style="color: #0000ff;">from</span>: .\source\<span style="color: #00C800;">function</span>\ADOFUNCS.PRG => ADOCREATECOLSQL<span style="color: #000000;">(</span> <span style="color: #000000;">741</span> <span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: .\source\<span style="color: #00C800;">function</span>\ADOFUNCS.PRG => FW_ADOCREATETABLESQL<span style="color: #000000;">(</span> <span style="color: #000000;">709</span> <span style="color: #000000;">)</span><br /> Called <span style="color: #0000ff;">from</span>: <span style="color: #000000;">Test8</span>.prg => MAIN<span style="color: #000000;">(</span> <span style="color: #000000;">51</span> <span style="color: #000000;">)</span><br /><br />System<br />======<br /> CPU type: <span style="color: #000000;">AMD</span> A8-4555M APU with Radeon<span style="color: #000000;">(</span>tm<span style="color: #000000;">)</span> HD Graphics <span style="color: #000000;">1600</span> Mhz<br /> Hardware memory: <span style="color: #000000;">3271</span> megs<br /><br /> Free System resources: <span style="color: #000000;">90</span> %<br /> GDI resources: <span style="color: #000000;">90</span> %<br /> User resources: <span style="color: #000000;">90</span> %<br /><br /> Windows total applications running: <span style="color: #000000;">3</span><br /> <span style="color: #000000;">1</span> GDI+ <span style="color: #0000ff;">Window</span>, <br /> <span style="color: #000000;">2</span> GDI+ <span style="color: #0000ff;">Window</span>, C:\Windows\WinSxS\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1<span style="color: #000000;">.1</span><span style="color: #000000;">.9600</span>.17415_none_dad8722c5bcc2d <br /> <span style="color: #000000;">3</span> Task Switching, C:\Users\James\Documents\Projects\ADORDD\Test8.exe <br /><br />Variables in use<br />================<br /> Procedure Type Value<br /> ==========================<br /> ADOCREATECOLSQL<br /> Param <span style="color: #000000;">1</span>: C <span style="color: #ff0000;">"+"</span><br /> Param <span style="color: #000000;">2</span>: N <span style="color: #000000;">0</span><br /> <span style="color: #00C800;">Local</span> <span style="color: #000000;">1</span>: C <span style="color: #ff0000;">" [+]"</span><br /> <span style="color: #00C800;">Local</span> <span style="color: #000000;">2</span>: U <br /> <span style="color: #00C800;">Local</span> <span style="color: #000000;">3</span>: C <span style="color: #ff0000;">""</span><br /> <span style="color: #00C800;">Local</span> <span style="color: #000000;">4</span>: U <br /> <span style="color: #00C800;">Local</span> <span style="color: #000000;">5</span>: U <br /> FW_ADOCREATETABLESQL<br /> Param <span style="color: #000000;">1</span>: C <span style="color: #ff0000;">"ptime"</span><br /> Param <span style="color: #000000;">2</span>: A Len: <span style="color: #000000;">4</span><br /> Param <span style="color: #000000;">3</span>: O <span style="color: #00C800;">Class</span>: <span style="color: #000000;">TOLEAUTO</span><br /> Param <span style="color: #000000;">4</span>: L .F.<br /> <span style="color: #00C800;">Local</span> <span style="color: #000000;">1</span>: A Len: <span style="color: #000000;">4</span><br /> <span style="color: #00C800;">Local</span> <span style="color: #000000;">2</span>: U <br /> <span style="color: #00C800;">Local</span> <span style="color: #000000;">3</span>: U <br /> <span style="color: #00C800;">Local</span> <span style="color: #000000;">4</span>: N <span style="color: #000000;">2</span><br /> <span style="color: #00C800;">Local</span> <span style="color: #000000;">5</span>: U <br /> <span style="color: #00C800;">Local</span> <span style="color: #000000;">6</span>: N <span style="color: #000000;">0</span><br /> MAIN<br /> <span style="color: #00C800;">Local</span> <span style="color: #000000;">1</span>: L .F.<br /> <span style="color: #00C800;">Local</span> <span style="color: #000000;">2</span>: C <span style="color: #ff0000;">"Northwind.mdb"</span><br /><br />Linked RDDs<br />===========<br /> DBF<br /> DBFFPT<br /> DBFBLOB<br /> DBFNTX<br /> ADORDD<br /><br />DataBases in use<br />================<br /><br />Classes in use:<br />===============<br /> <span style="color: #000000;">1</span> ERROR<br /> <span style="color: #000000;">2</span> HASHENTRY<br /> <span style="color: #000000;">3</span> HBCLASS<br /> <span style="color: #000000;">4</span> TOLEAUTO<br /> <span style="color: #000000;">5</span> HBOBJECT<br /> <span style="color: #000000;">6</span> TREG32<br /><br />Memory Analysis<br />===============<br /> <span style="color: #000000;">368</span> <span style="color: #00C800;">Static</span> variables<br /><br /> Dynamic memory consume:<br /> Actual Value: <span style="color: #000000;">0</span> bytes<br /> Highest Value: <span style="color: #000000;">0</span> bytes</div>[/code:pnxmh7wb]
I am using the Northwind.mdb of Access.
Ideas, anyone?
James
|
ADO RDD xHarbour
|
Ignore my previous message--I found a couple of errors, and now it is working.
James
|
ADO RDD xHarbour
|
Armando,
I tried your "truncate table.." command but it errors out, and I don't have your showErrror( ) function so I don't know what the error is. Any ideas? Does the table need to be locked or something?
James
|
ADO RDD xHarbour
|
Armando,
OK, I just changed the command to DROP TABLE...and that worked. Problem solved.
Thanks,
James
|
ADO RDD xHarbour
|
James:
Cool !
Regards
|
ADO RDD xHarbour
|
Speed Test Results
Using the new ADORDD and a local drive.
Success at last. I have been able to import a large number of records from a DBF into a SQL table in an ACCESS database using the APPEND FROM command.
Appending 26,191 records with 31 fields from a DBF into an ACCESS table: 18 minutes.
Appending the same records from a DBF into a DBF: 1 second
Hmm, are all SQL databases that slow?
James
|
ADO RDD xHarbour
|
James,
Maybe append is slow but other operations are very fast <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
|
ADO RDD xHarbour
|
James, Antonio,
Im back from holidays and Im glad to see that more people is using ADORDD.
New functionalities have been added by maromano and Ill give it a look asap.
Im using adordd with MySql and I dont have any speed issues.
Normally to import dbf files I use :
[code=fw:3au5yc9n]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #0000ff;">SELECT</span> <span style="color: #000000;">0</span><br />USE XTABLE <span style="color: #0000ff;">ALIAS</span> XTABLEX VIA DBFCDX<br />DBGOTOP<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />COPY <span style="color: #0000ff;">TO</span> XTABLE <span style="color: #00C800;">WHILE</span> !EOF<span style="color: #000000;">(</span><span style="color: #000000;">)</span> VIA <span style="color: #ff0000;">"ADORDD"</span><br /> </div>[/code:3au5yc9n]
This is quite fast not the times James is getting with ACCESS with APPEND FROM.
Lucas report me some issues with copy to. Ill will give it a look asap.
Please note that when source area its not a adordd the copy to or append from its not controlled by adordd but by the source area rdd only the replaces and appends are done by adordd.
Please check ado_trans() in adordd.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.