topic stringlengths 1 63 | text stringlengths 1 577k ⌀ |
|---|---|
dbf file extension | Richard, thank you.
Regards,
Otto |
dbf file extension | Hi,
ADS can be the solution CRYPT the tables, with or without dictionary
regards
Marcelo |
dbf file extension | Hi All !
If you did to hide your file , how to get the files, with this function :
use .... to open dbffile
file(..... to check if file exist
fread(....to open file
regards
Fafi |
dbf file extension | USE will open hidden files
FILE( .. ) can not see hidden files. But DIRECTORY( *.*, "H" ) lists hidden files also. So hiding a file is not a reliable solution.
FOPEN( .. ) . I guess will open hidden files also. |
dbf file extension | Hi Otto
Firstly, to answer your question:
Yes I am using xHarbour/FiveLinux as my main development platform now. I am still using .dbf files too.
I have used SQL before (and wrote a development environment that used it not only to store data, but also to store the program itself as metadata to be served up as dynamic web pages). But I'm not a fan of SQL which was initially developed as an ad hoc reporting tool more than a means of data access for programs which it has become. If you want a true OO view of things SQL "fights" you because queries are only efficient when done as joins.
.dbf files lack some nice features that databases such as SQL server bring, but walking xBase indexes allows for code that is more OO than SQL.
If you hide your data files you should only have to do it once at setup time. Hiding files is by no means a complete defence, but then again nothing is. I always felt that if you make it not so obvious how to fiddle, then only the fairly knowledgable person will get in, and they mostly know enough to not do any harm. If they do, then it is more realistic to take appropriate action from education to disciplinary action.
Regards
Doug
(xProgrammer) |
dbf file extension | Hi Otto
If the problem is an Excel user accessing important files just maybe we are on the wrong tack.
If his/her prying is of no value then he/she should be stomped on.
But if there is some purpose to his/her fiddling then maybe the answer is to provide a way for him/her to download the information he/she needs from your program in a format that suits him/her.
Sometimes killing them with kindness is the best answer.
Plus then they have no excuse for fiddling.
Regards
Doug
(xProgrammer) |
dbf file extension | [quote:9e0v22zw]Yes, you can open them using the extension that you want or use RddInfo( RDDI_TABLEEXT, ".abc" ) so it will be used by default.
#define RDDI_TABLEEXT 5 /* Default data file's file extension */
#define RDDI_MEMOEXT 6 /* Default memo file's file extension */
#define RDDI_ORDBAGEXT 7 /* Default multi tag index's file extension */
#define RDDI_ORDEREXT 8 /* default single tag index's file extension */
#define RDDI_ORDSTRUCTEXT 9 /* default single tag index's file extension */[/quote:9e0v22zw]
Does someone know how to change the default memo file's file extension and index's file extension for a single dbf-file.
Thanks in advance
Otto |
dbf file extension | Change the extension with the above functions. Open the table and again use the same functions to restore original extensions |
dbf file extension | Hello Mr. Rao,
thank you for your help.
Best regards,
Otto |
dbf to Xml | is there a function to create a xml from a dbf ? |
dbf to Xml | Silvio,
If you need to do it in a non programmatically way, then you can use i.e. OpenOffice calc to open the DBF and save it as XML:
[url=http://imageshack.us:1z9zwqwp][img:1z9zwqwp]http://img242.imageshack.us/img242/5546/capturecl5.png[/img:1z9zwqwp][/url:1z9zwqwp]
If you want to do it programmatically, then it is easy to do it as the XML format is very easy. Here you have an example for a RSS XML:
[code:1z9zwqwp]
<?xml version='1.0' encoding='UTF-8'?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
<title>Sources</title>
<link>http://www.fivetechsoft.com/news</link>
<description>Dynamic news reader</description>
<item>
<title>News</title>
<link>News</link>
<description>News sources</description>
<pubDate>23 Jan 2009 10:04 am</pubDate>
</item>
<item>
<title>Tech</title>
<link>Tech</link>
<description>Tech sources</description>
<pubDate>23 Jan 2009 10:04 am</pubDate>
</item>
</channel>
</rss>
[/code:1z9zwqwp]
as you can see, you can easily generate a XML from a DBF, with the structure that better fits to your needs. Here I am openning the previous XML file using Internet Explorer:
[url=http://imageshack.us:1z9zwqwp][img:1z9zwqwp]http://img509.imageshack.us/img509/796/capturevy5.png[/img:1z9zwqwp][/url:1z9zwqwp] |
dbf to Xml | Also try the following sample:
[code:2dcanasl]#define adOpenForwardOnly 0
#define adOpenKeyset 1
#define adOpenDynamic 2
#define adOpenStatic 3
#define adLockReadOnly 1
#define adLockPessimistic 2
#define adLockOptimistic 3
#define adLockBatchOptimistic 4
#define adPersistXML 1
FUNCTION MAIN()
LOCAL oRs := CREATEOBJECT( "ADODB.Recordset" )
FERASE( "TEST.XML" )
oRs:Open( "SELECT * FROM Test", "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=e:\xharbour; Extended Properties=DBASE III", adOpenForwardOnly, adLockReadOnly )
oRs:Save( "TEST.XML", adPersistXML )
oRs:Close()
RETURN NIL[/code:2dcanasl]
EMG |
dbf to Xml | thanks to all
and How I can make with a prg ( xharbour and fwh) to converte a XML to a DBF ? |
dbf to Xml | Hello Silvio,
Timm (<!-- m --><a class="postlink" href="http://www.reportdesigner.info/">http://www.reportdesigner.info/</a><!-- m -->) has a XML-reader class for download on his homepage.
Regards,
Otto |
dbf to Xml | [code:3fxc5ved]FUNCTION MAIN()
LOCAL oStream, oRs
oStream = CREATEOBJECT( "ADODB.Stream" )
oStream:Open()
oStream:WriteText( MEMOREAD( "TEST.XML" ) )
oStream:Position = 0
oRs = CREATEOBJECT( "ADODB.Recordset" )
oRs:Open( oStream )
oStream:Close()
WHILE !oRs:EOF
? oRs:Fields( "Last" ):Value, oRs:Fields( "First" ):Value
oRs:MoveNext()
ENDDO
oRs:Close()
INKEY( 0 )
RETURN NIL[/code:3fxc5ved]
EMG |
dbf to Xml | I must Know the fields of archive ?
I have these on the top of this archive
I have a sample XML
look it pls
[code:1qmsg2wp] <?xml version="1.0" standalone="yes" ?>
- <DATAPACKET Version="2.0">
- <METADATA>
- <FIELDS>
<FIELD attrname="ICLSSESMATID" fieldtype="i4" required="true" />
<FIELD attrname="IMATID" fieldtype="i4" required="true" />
<FIELD attrname="SMATLDESC" fieldtype="string" WIDTH="100" />
<FIELD attrname="SMATSDESC" fieldtype="string" WIDTH="50" />
<FIELD attrname="SMATCODUSER" fieldtype="string" WIDTH="3" />
<FIELD attrname="SMATCODMIN" fieldtype="string" WIDTH="4" />
<FIELD attrname="ICMPSCAID" fieldtype="i4" required="true" />
<FIELD attrname="ISCAID" fieldtype="i4" />
<FIELD attrname="ICMPSCATASS" fieldtype="i4" required="true" />
<FIELD attrname="ICMPSCAINMEDIA" fieldtype="i4" required="true" />
<FIELD attrname="SCMPLDESC" fieldtype="string" WIDTH="100" />
<FIELD attrname="SCMPSDESC" fieldtype="string" WIDTH="50" />
<FIELD attrname="SSCADESC" fieldtype="string" required="true" WIDTH="100" />
<FIELD attrname="ISITID" fieldtype="i4" required="true" />
<FIELD attrname="ICLSSESID" fieldtype="i4" required="true" />
<FIELD attrname="IANAID" fieldtype="i4" />
<FIELD attrname="IANSID" fieldtype="i4" required="true" />
<FIELD attrname="ICLSID" fieldtype="i4" required="true" />
<FIELD attrname="IMATRMAID" fieldtype="i4" required="true" />
<FIELD attrname="IMATINMEDIA" fieldtype="i4" />
<FIELD attrname="ICMPSCAORDINE" fieldtype="i4" required="true" />
<FIELD attrname="IMATRMAPSTORDINE" fieldtype="i4" />
</FIELDS>
<PARAMS LCID="0" />
</METADATA>
- <ROWDATA>
<ROW ICLSSESMATID="1001870" IMATID="1000016" SMATLDESC="DIRITTO" SMATSDESC="DIRITTO" SMATCODUSER="DIR" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026695" ICLSSESID="1000260" IANAID="1013018" IANSID="38" ICLSID="1001036" IMATRMAID="1000016" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="7" />
<ROW ICLSSESMATID="1001870" IMATID="1000016" SMATLDESC="DIRITTO" SMATSDESC="DIRITTO" SMATCODUSER="DIR" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026696" ICLSSESID="1000260" IANAID="1013067" IANSID="38" ICLSID="1001036" IMATRMAID="1000016" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="7" />
<ROW ICLSSESMATID="1001870" IMATID="1000016" SMATLDESC="DIRITTO" SMATSDESC="DIRITTO" SMATCODUSER="DIR" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026700" ICLSSESID="1000260" IANAID="1011698" IANSID="38" ICLSID="1001036" IMATRMAID="1000016" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="7" />
<ROW ICLSSESMATID="1001870" IMATID="1000016" SMATLDESC="DIRITTO" SMATSDESC="DIRITTO" SMATCODUSER="DIR" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026702" ICLSSESID="1000260" IANAID="1013669" IANSID="38" ICLSID="1001036" IMATRMAID="1000016" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="7" />
<ROW ICLSSESMATID="1001870" IMATID="1000016" SMATLDESC="DIRITTO" SMATSDESC="DIRITTO" SMATCODUSER="DIR" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026703" ICLSSESID="1000260" IANAID="1014974" IANSID="38" ICLSID="1001036" IMATRMAID="1000016" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="7" />
<ROW ICLSSESMATID="1001870" IMATID="1000016" SMATLDESC="DIRITTO" SMATSDESC="DIRITTO" SMATCODUSER="DIR" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026704" ICLSSESID="1000260" IANAID="1014996" IANSID="38" ICLSID="1001036" IMATRMAID="1000016" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="7" />
<ROW ICLSSESMATID="1001870" IMATID="1000016" SMATLDESC="DIRITTO" SMATSDESC="DIRITTO" SMATCODUSER="DIR" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026705" ICLSSESID="1000260" IANAID="1015284" IANSID="38" ICLSID="1001036" IMATRMAID="1000016" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="7" />
<ROW ICLSSESMATID="1001870" IMATID="1000016" SMATLDESC="DIRITTO" SMATSDESC="DIRITTO" SMATCODUSER="DIR" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026707" ICLSSESID="1000260" IANAID="1016926" IANSID="38" ICLSID="1001036" IMATRMAID="1000016" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="7" />
<ROW ICLSSESMATID="1001870" IMATID="1000016" SMATLDESC="DIRITTO" SMATSDESC="DIRITTO" SMATCODUSER="DIR" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026714" ICLSSESID="1000260" IANAID="1022398" IANSID="38" ICLSID="1001036" IMATRMAID="1000016" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="7" />
<ROW ICLSSESMATID="1001870" IMATID="1000016" SMATLDESC="DIRITTO" SMATSDESC="DIRITTO" SMATCODUSER="DIR" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026715" ICLSSESID="1000260" IANAID="1023089" IANSID="38" ICLSID="1001036" IMATRMAID="1000016" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="7" />
<ROW ICLSSESMATID="1001870" IMATID="1000016" SMATLDESC="DIRITTO" SMATSDESC="DIRITTO" SMATCODUSER="DIR" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026946" ICLSSESID="1000260" IANAID="1019047" IANSID="38" ICLSID="1001036" IMATRMAID="1000016" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="7" />
<ROW ICLSSESMATID="1001870" IMATID="1000016" SMATLDESC="DIRITTO" SMATSDESC="DIRITTO" SMATCODUSER="DIR" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1027245" ICLSSESID="1000260" IANAID="1024723" IANSID="38" ICLSID="1001036" IMATRMAID="1000016" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="7" />
<ROW ICLSSESMATID="1001870" IMATID="1000016" SMATLDESC="DIRITTO" SMATSDESC="DIRITTO" SMATCODUSER="DIR" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1027247" ICLSSESID="1000260" IANAID="1024725" IANSID="38" ICLSID="1001036" IMATRMAID="1000016" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="7" />
<ROW ICLSSESMATID="1001871" IMATID="1000035" SMATLDESC="ECONOMIA POLITICA" SMATSDESC="ECONOMIA POLITICA" SMATCODUSER="ECO" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026695" ICLSSESID="1000260" IANAID="1013018" IANSID="38" ICLSID="1001036" IMATRMAID="1000035" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="8" />
<ROW ICLSSESMATID="1001871" IMATID="1000035" SMATLDESC="ECONOMIA POLITICA" SMATSDESC="ECONOMIA POLITICA" SMATCODUSER="ECO" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026696" ICLSSESID="1000260" IANAID="1013067" IANSID="38" ICLSID="1001036" IMATRMAID="1000035" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="8" />
<ROW ICLSSESMATID="1001871" IMATID="1000035" SMATLDESC="ECONOMIA POLITICA" SMATSDESC="ECONOMIA POLITICA" SMATCODUSER="ECO" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026700" ICLSSESID="1000260" IANAID="1011698" IANSID="38" ICLSID="1001036" IMATRMAID="1000035" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="8" />
<ROW ICLSSESMATID="1001871" IMATID="1000035" SMATLDESC="ECONOMIA POLITICA" SMATSDESC="ECONOMIA POLITICA" SMATCODUSER="ECO" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026702" ICLSSESID="1000260" IANAID="1013669" IANSID="38" ICLSID="1001036" IMATRMAID="1000035" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="8" />
<ROW ICLSSESMATID="1001871" IMATID="1000035" SMATLDESC="ECONOMIA POLITICA" SMATSDESC="ECONOMIA POLITICA" SMATCODUSER="ECO" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026703" ICLSSESID="1000260" IANAID="1014974" IANSID="38" ICLSID="1001036" IMATRMAID="1000035" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="8" />
<ROW ICLSSESMATID="1001871" IMATID="1000035" SMATLDESC="ECONOMIA POLITICA" SMATSDESC="ECONOMIA POLITICA" SMATCODUSER="ECO" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026704" ICLSSESID="1000260" IANAID="1014996" IANSID="38" ICLSID="1001036" IMATRMAID="1000035" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="8" />
<ROW ICLSSESMATID="1001871" IMATID="1000035" SMATLDESC="ECONOMIA POLITICA" SMATSDESC="ECONOMIA POLITICA" SMATCODUSER="ECO" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026705" ICLSSESID="1000260" IANAID="1015284" IANSID="38" ICLSID="1001036" IMATRMAID="1000035" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="8" />
<ROW ICLSSESMATID="1001871" IMATID="1000035" SMATLDESC="ECONOMIA POLITICA" SMATSDESC="ECONOMIA POLITICA" SMATCODUSER="ECO" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026707" ICLSSESID="1000260" IANAID="1016926" IANSID="38" ICLSID="1001036" IMATRMAID="1000035" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="8" />
<ROW ICLSSESMATID="1001871" IMATID="1000035" SMATLDESC="ECONOMIA POLITICA" SMATSDESC="ECONOMIA POLITICA" SMATCODUSER="ECO" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026714" ICLSSESID="1000260" IANAID="1022398" IANSID="38" ICLSID="1001036" IMATRMAID="1000035" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="8" />
<ROW ICLSSESMATID="1001871" IMATID="1000035" SMATLDESC="ECONOMIA POLITICA" SMATSDESC="ECONOMIA POLITICA" SMATCODUSER="ECO" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026715" ICLSSESID="1000260" IANAID="1023089" IANSID="38" ICLSID="1001036" IMATRMAID="1000035" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="8" />
<ROW ICLSSESMATID="1001871" IMATID="1000035" SMATLDESC="ECONOMIA POLITICA" SMATSDESC="ECONOMIA POLITICA" SMATCODUSER="ECO" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026946" ICLSSESID="1000260" IANAID="1019047" IANSID="38" ICLSID="1001036" IMATRMAID="1000035" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="8" />
<ROW ICLSSESMATID="1001871" IMATID="1000035" SMATLDESC="ECONOMIA POLITICA" SMATSDESC="ECONOMIA POLITICA" SMATCODUSER="ECO" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1027245" ICLSSESID="1000260" IANAID="1024723" IANSID="38" ICLSID="1001036" IMATRMAID="1000035" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="8" />
<ROW ICLSSESMATID="1001871" IMATID="1000035" SMATLDESC="ECONOMIA POLITICA" SMATSDESC="ECONOMIA POLITICA" SMATCODUSER="ECO" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1027247" ICLSSESID="1000260" IANAID="1024725" IANSID="38" ICLSID="1001036" IMATRMAID="1000035" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="8" />
<ROW ICLSSESMATID="1001872" IMATID="1000003" SMATLDESC="STORIA" SMATSDESC="STORIA" SMATCODUSER="STO" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026695" ICLSSESID="1000260" IANAID="1013018" IANSID="38" ICLSID="1001036" IMATRMAID="1000003" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="3" />
<ROW ICLSSESMATID="1001872" IMATID="1000003" SMATLDESC="STORIA" SMATSDESC="STORIA" SMATCODUSER="STO" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026696" ICLSSESID="1000260" IANAID="1013067" IANSID="38" ICLSID="1001036" IMATRMAID="1000003" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="3" />
<ROW ICLSSESMATID="1001872" IMATID="1000003" SMATLDESC="STORIA" SMATSDESC="STORIA" SMATCODUSER="STO" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026700" ICLSSESID="1000260" IANAID="1011698" IANSID="38" ICLSID="1001036" IMATRMAID="1000003" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="3" />
</ROWDATA>
</DATAPACKET>[/code:1qmsg2wp]
I cut some lines because "Your message contains 839705 characters. The maximum number of allowed characters is 60000" |
dbf to Xml | [code:1yy98pht]FUNCTION MAIN()
LOCAL oStream, oRs
LOCAL i
oStream = CREATEOBJECT( "ADODB.Stream" )
oStream:Open()
oStream:WriteText( MEMOREAD( "TEST.XML" ) )
oStream:Position = 0
oRs = CREATEOBJECT( "ADODB.Recordset" )
oRs:Open( oStream )
oStream:Close()
WHILE !oRs:EOF
FOR i = 0 TO oRs:Fields:Count - 1
? oRs:Fields( i ):Value
NEXT
?
oRs:MoveNext()
ENDDO
oRs:Close()
INKEY( 0 )
RETURN NIL[/code:1yy98pht]
EMG |
dbf to Xml | Otto,
> Timm (<!-- m --><a class="postlink" href="http://www.reportdesigner.info/">http://www.reportdesigner.info/</a><!-- m -->) has a XML-reader class for download on his homepage.
Is it free ?
If yes, could you please copy its source code here ? thanks <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) --> |
dbf to Xml | Antonio,
The download link is titled as freeware.
Best regards,
Otto
<!-- m --><a class="postlink" href="http://www.reportdesigner.info/">http://www.reportdesigner.info/</a><!-- m -->
[img:3sg8rkuq]http://www.atzwanger-software.com/fw/easyreport.jpg[/img:3sg8rkuq] |
dbf to Xml | Dear OTTO, Antonio
the class XML of <!-- m --><a class="postlink" href="http://www.reportdesigner.info/">http://www.reportdesigner.info/</a><!-- m --> is not free !!!!!!!!!!!!!!!!!
I cannot see the source class but only the lib and iclude files. |
dbf to Xml | Hi Silvio
A function for converting dbf to xml is pretty easy - I don't have my code to hand but could look it out.
You have two choices to make.
You can either use (x)Harbour's built in XML class or just write out as text.
You can either include the structure information as well (great if you then want to reconstruct elsewhere) or just the data contents.
For contents you can just iterate through the records and within each record through the fields and if just writing out as text output "<" + FieldName(i) + ">" + Str( FieldValue(i) + "</" + FieldName(i) + ">". (Some obvious efficiency improvements available if you are handling huge amounts of data.)
Prime with "<record>", add "</record><record>" between records and append "</record>" at the end
If you want to include the structure you can use something like
<xml>
<table>
<tname>Example</tname>
<structure>
<field>
<fname>Surname</fname>
<ftype>C</ftype>
<flen>32</flen>
<fdec>0</fdec>
</field>
<field>
<fname>DOB</fname>
<ftype>D</ftype>
<flen>8</flen>
<fdec>0</fdec>
</field>
</structure>
</table>
<data>
</data>
</xml>
Then it is easy to write a function to reconstruct the table and add the data to the newly created table. This can be very useful as you can use a text editor to modify the data - sometimes doing search and replace etc. before reconstructing it.
This was amongst the first code I wrote when starting out with xHarbour as I needed it to get data into my system. So it wasn't OO. But if I were writing such functionality today it would be. I'm sure a coder of your stature doesn't need my code but if you do want to see it I can look it out. |
dbf to Xml | What's wrong with my sample using ADO?
EMG |
dbf to Xml | Hi
Maybe?
[url:wvzg2l99]http://forums.fivetechsupport.com/viewtopic.php?f=6&t=4116[/url:wvzg2l99]
[url:wvzg2l99]http://forums.fivetechsupport.com/viewtopic.php?f=6&t=4144[/url:wvzg2l99]
Saludos
Ernesto |
dbf to Xml | Hi Enrico
I implied nothing wrong with your solution - but we don't all work in environments with ADO and its quite simple to do natively in (x)Harbour.
In programming there are often multiple ways to achieve a required outcome, and the best way is often site/environment specific. Personally I prefer solutions that make no or minimal assumptions about the operating system and installed software base in which they operate.
This forum is for the free exchange of ideas and I think works best when there is a range of ideas/approaches discussed and members can take away those ideas that are of greatest value to them. |
dbf to Xml | Hi all,
Is there any Sample PRG available demonstrating how to convert a DBf to XML programatically using Native FWH xHarbour without using ADO. Mr.Enrico has already provided a sample above in this thread showing the conversion using ADO
Is there any class available to convert a DBF to XML.
Regards
Anser |
dbf to Xml | Anser,
this function may help you
[code=fw:3ache1lr]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #B900B9;">/*<br />/ Dbf2Xml. Utilidad de conversion de ficheros DBF a XML<br />/ mediante transformacion XSL con salida HTML<br />/ (C) 2003. Joaquim Ferrer Godoy<br />/ Inicio: 16-07-2003 */</span><br /><span style="color: #00D7D7;">#define</span> CRLF chr<span style="color: #000000;">(</span><span style="color: #000000;">13</span><span style="color: #000000;">)</span>+chr<span style="color: #000000;">(</span><span style="color: #000000;">10</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">function</span> main<span style="color: #000000;">(</span> cDbf, cXmlOut <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> aStruc, aNomFields<br /> <span style="color: #00C800;">local</span> nHandle<br /> cXmlOut := <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> cXmlOut = <span style="color: #00C800;">NIL</span>, cDbf, cXmlOut <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">if</span> cDbf = <span style="color: #00C800;">NIL</span><br /> ? <span style="color: #ff0000;">"Es necesario indicar el nombre del archivo DBF"</span><br /> <span style="color: #00C800;">return</span><span style="color: #000000;">(</span> .f. <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /><br /> <span style="color: #00C800;">if</span> !file<span style="color: #000000;">(</span> cDbf + <span style="color: #ff0000;">".dbf"</span> <span style="color: #000000;">)</span><br /> ? <span style="color: #ff0000;">"No existe el archivo DBF especificado"</span><br /> <span style="color: #00C800;">return</span><span style="color: #000000;">(</span> .f. <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /><br /> USE <span style="color: #000000;">(</span> cDbf <span style="color: #000000;">)</span> <span style="color: #00C800;">NEW</span> <span style="color: #0000ff;">ALIAS</span> <span style="color: #ff0000;">"_temp_"</span><br /><br /> <span style="color: #B900B9;">//Obtener la lista de campos</span><br /> aStruc := dbstruct<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> aNomFields := <span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /> aeval<span style="color: #000000;">(</span> aStruc, <span style="color: #000000;">{</span>|a| aadd<span style="color: #000000;">(</span> aNomFields, a<span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #B900B9;">// Proceso de escritura del archivo de salida XML</span><br /> ? <span style="color: #ff0000;">"Generando XML : "</span> + cXmlOut<br /> nHandle := fcreate<span style="color: #000000;">(</span> cXmlOut + <span style="color: #ff0000;">".xml"</span> <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'<?xml version="1.0" encoding="ISO8859-1" ?>'</span> + CRLF <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">"<DATABASE>"</span> + CRLF <span style="color: #000000;">)</span><br /> _temp_-><span style="color: #000000;">(</span> dbgotop<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">do</span> <span style="color: #00C800;">while</span> !_temp_-><span style="color: #000000;">(</span> eof<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">"<RECORD>"</span> + CRLF <span style="color: #000000;">)</span><br /> aeval<span style="color: #000000;">(</span> aNomFields, <span style="color: #000000;">{</span>|cField, nPos| ;<br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">"<"</span> + cField + <span style="color: #ff0000;">">"</span> +;<br /> Val2Char<span style="color: #000000;">(</span> _temp_-><span style="color: #000000;">(</span> fieldget<span style="color: #000000;">(</span> nPos <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> + ;<br /> <span style="color: #ff0000;">"</"</span> + cField + <span style="color: #ff0000;">">"</span> + CRLF <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">"</RECORD>"</span> + CRLF <span style="color: #000000;">)</span><br /> _temp_-><span style="color: #000000;">(</span> dbskip<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">enddo</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">"</DATABASE>"</span> + CRLF <span style="color: #000000;">)</span><br /> fclose<span style="color: #000000;">(</span> nHandle <span style="color: #000000;">)</span><br /> _temp_-><span style="color: #000000;">(</span> dbclosearea<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #B900B9;">// Proceso de escritura del archivo de salida XSL</span><br /> <span style="color: #B900B9;">// XSL realizara la transformacion del XML</span><br /> ? <span style="color: #ff0000;">"Generando XSL : "</span> + cXmlOut<br /> nHandle := fcreate<span style="color: #000000;">(</span> cXmlOut + <span style="color: #ff0000;">".xsl"</span> <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">"<?xml version='1.0'?>"</span> + CRLF <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">'</span> + CRLF <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'<xsl:template match="/">'</span> + CRLF <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'<html>'</span> + CRLF <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'<body>'</span> + CRLF <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'<table border="1" cellpadding="2" bgcolor="#f1f1f1" width="100%">'</span> + CRLF <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'<tr>'</span> + CRLF <span style="color: #000000;">)</span><br /> aeval<span style="color: #000000;">(</span> aNomFields, <span style="color: #000000;">{</span>|cField| ;<br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">"<th>"</span> + cField + <span style="color: #ff0000;">"</th>"</span> + CRLF <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'</tr>'</span> + CRLF <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'<xsl:for-each select="DATABASE/RECORD">'</span> + CRLF <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'<tr>'</span> + CRLF <span style="color: #000000;">)</span><br /> aeval<span style="color: #000000;">(</span> aNomFields, <span style="color: #000000;">{</span>|cField| ;<br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'<td><xsl:value-of select="'</span> + ;<br /> cField + <span style="color: #ff0000;">'"/></td>'</span> + CRLF <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'</tr>'</span> + CRLF <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'</xsl:for-each>'</span> + CRLF <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'</table>'</span> + CRLF <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'</body>'</span> + CRLF <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'</html>'</span> + CRLF <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'</xsl:template>'</span> + CRLF <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'</xsl:stylesheet>'</span> + CRLF <span style="color: #000000;">)</span><br /> fclose<span style="color: #000000;">(</span> nHandle <span style="color: #000000;">)</span><br /><br /> <span style="color: #B900B9;">// Proceso de escritura del archivo de salida HTML</span><br /> ? <span style="color: #ff0000;">"Generando HTML: "</span> + cXmlOut<br /> nHandle := fcreate<span style="color: #000000;">(</span> cXmlOut + <span style="color: #ff0000;">".htm"</span> <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'<html>'</span> + CRLF <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'<head>'</span> + CRLF <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'<title>Dbf2XML : '</span> + cXmlOut + <span style="color: #ff0000;">'</title>'</span> + CRLF <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'<style>'</span> + CRLF <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'TH{font-family:verdana;font-size:12px}'</span> + CRLF <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'TD{font-family:verdana;font-size:10px}'</span> + CRLF <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'</style>'</span> + CRLF <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'</head>'</span> + CRLF <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'<body>'</span> + CRLF <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'<script language="javascript">'</span> + CRLF <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'var xml = new ActiveXObject("Microsoft.XMLDOM")'</span> + CRLF <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'xml.async = false'</span> + CRLF <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'xml.load("'</span> + cXmlOut + <span style="color: #ff0000;">'.xml")'</span> + CRLF <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'var xsl = new ActiveXObject("Microsoft.XMLDOM")'</span> + CRLF <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'xsl.async = false'</span> + CRLF <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'xsl.load("'</span> + cXmlOut + <span style="color: #ff0000;">'.xsl")'</span> + CRLF <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'document.write(xml.transformNode(xsl))'</span> + CRLF <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'</script>'</span> + CRLF <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'</body>'</span> + CRLF <span style="color: #000000;">)</span><br /> fwrite<span style="color: #000000;">(</span> nHandle, <span style="color: #ff0000;">'</html>'</span> + CRLF <span style="color: #000000;">)</span><br /> fclose<span style="color: #000000;">(</span> nHandle <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">return</span><span style="color: #000000;">(</span> .t. <span style="color: #000000;">)</span><br /><br /><span style="color: #B900B9;">//--------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">static</span> func Val2Char<span style="color: #000000;">(</span> uVar <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> cChar<br /> <span style="color: #00C800;">local</span> cType := valtype<span style="color: #000000;">(</span> uVar <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">do</span> <span style="color: #00C800;">case</span><br /> <span style="color: #00C800;">case</span> cType == <span style="color: #ff0000;">"N"</span><br /> cChar := rtrim<span style="color: #000000;">(</span> str<span style="color: #000000;">(</span> uVar <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">case</span> cType == <span style="color: #ff0000;">"D"</span><br /> cChar := dtos<span style="color: #000000;">(</span> uVar <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">case</span> cType == <span style="color: #ff0000;">"L"</span><br /> cChar := <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> uVar, <span style="color: #ff0000;">".T."</span>, <span style="color: #ff0000;">".F."</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">otherwise</span><br /> cChar := uVar <span style="color: #B900B9;">// Caracter</span><br /> <span style="color: #00C800;">endcase</span><br /><br /><span style="color: #00C800;">return</span><span style="color: #000000;">(</span> rtrim<span style="color: #000000;">(</span> cChar <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /> </div>[/code:3ache1lr] |
dbf to Xml | Thank you Mr.Stefan
Regards
Anser |
dbf to Xml | >Is there any class available to convert a DBF to XML.
There is another DBF to XML conversion program on my website here:
[url:mqo0bx7k]http://www.goIntellitech.com/program.htm[/url:mqo0bx7k]
Regards,
James |
dbf to Xml | Dear Mr.James,
Thank you for the information. Very useful code
Regards
Anser |
dbf to Xml | Enrico,
When I try to run your XML to DBF code (using ADO), I get the following error:
Error description: Error ADODB.Recordset/6 DISP_E_UNKNOWNNAME: OPEN
Args:
[ 1] = O Object
Stack Calls
===========
Called from: source\rtl\win32ole.prg => TOLEAUTO:OPEN(0)
Called from: XML2DBF3.prg => MAIN(24)
It is happening at this line of your code:
oStream:Open()
The oStream object is getting defined as an object. Any ideas?
Regards,
James |
dbf to Xml | Can you send to my private email the XML file you are testing?
Be patient as I will probably can't answer in the next days.
EMG |
dbf to Xml | Enrico,
It doesn't have anything to do with the XML file as the code hasn't tried to open the file yet. Here is the only code that has been executed:
[code=fw:2c3lank3]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">FUNCTION</span> MAIN<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">LOCAL</span> oStream, oRs<br /><br /> oStream = CREATEOBJECT<span style="color: #000000;">(</span> <span style="color: #ff0000;">"ADODB.Stream"</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">msgInfo</span><span style="color: #000000;">(</span> valtype<span style="color: #000000;">(</span> oStream <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// returns "O"</span><br /><br /> oStream:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span></div>[/code:2c3lank3]
It is erroring out on the Open() method. The error appears to be saying that there is no "Open" method.
No worries about a timely reply. I don't need this right away.
Regards,
James |
dbf to Xml | Mr James
Your code is working perfect for me. ( on XP )
I am not getting any errors.
MsgInfo( oStream:State ) --> returns 1 ( 1 for opened )
Will you please check again ? |
dbf to Xml | Rao,
>MsgInfo( oStream:State ) --> returns 1
oStream:State is returning 0 for me (under XP Pro, SP3).
This is my concern and that of others. Even though oStream is showing as an object, apparently the needed components are not installed on my computer. If you are creating an application for a single site, then perhaps using ADO is a good choice. But, if you are writing applications for use on many sites, then ADO is going to cause you a great deal of tech support. This is the reason many of us do not use ADO.
James |
dbf to Xml | Mr James
I agree with you.
But to the best of my knowledge and experience, ADO is working on all PCs with XP, with the *default* installation. This is my experience with an organization with about 500 XPs and also that of my friends here.
In fact I am surprised why it is not working on your XP or some other XPs. May be my exposure is limited. |
dbf to Xml | Rao,
After reading your comments about it working on all your XP PCs, I took another look.
My mistake! I had not looked at the line number of the error, and I assumed it was erroring out on:
oStream:Open()
But, in fact, it was erroring out on:
oRS:Open( oStream )
But, I still don't know why I am getting this error:
Error ADODB.Recordset/6 DISP_E_UNKNOWNNAME: OPEN
I have checked and oRs is an object type, but the error message is indicating that it doesn't have an Open() method.
Perhaps it IS a problem with the sample XML file I was using as Enrico suggested. I don't remember where I got this file, and I don't know what format ADODB is expecting.
Can you send me a sample XML file that is working for you? Send it to:
jbott at compuserve dot com
Thanks,
James |
dbf to Xml | Just sent.
EMG |
dbf to Xml | Enrico,
If you sent it to me, I didn't get it. Please try again.
James |
dbf to Xml | Please download it from here:
[url:ddq4snmp]http://www.emagsoftware.it/testxml.zip[/url:ddq4snmp]
EMG |
dbf to Xml | Enrico,
Thanks, I have the file and it is working with the demo program you supplied.
However, your program does not actually create a DBF. Do you have an example of how to read the field information and use it to create a DBF?
It seems there are a numberr of different formats that XML data may in. This makes it difficult to have a generic program to read data files in XML. This has nothing to do with your example, it is just an observation.
James |
dbf to Xml | [quote="James Bott":7d3bf67y]However, your program does not actually create a DBF. Do you have an example of how to read the field information and use it to create a DBF?[/quote:7d3bf67y]
I haven't a sample at hand, sorry.
EMG |
dbf to array | What is the best way to fill an array from a dbf-file (a kind of recordset).
Thanks in advance
Otto |
dbf to array | I am using :
[code:32kgs9jn]
# include "Common.ch"
# DEFINE MAAKBLCK(cvar) &("{||"+cvar+"}")
# DEFINE MAAKINDBLCK(var,indexorde) var := &("{||"+INDEXKEY(indexorde)+"}")
*********************************************************************************************************
PROC ReadDbf(Arr,ArrColBlock,cFilter, uFrom , uTo , cOrder )
***************************************************************
// ArrColBlock may be nil (all fields are selected) , array from fieldnames or Codeblocks
LOCAL bFilt , IndBlck , HlpArr[0] , el
LOCAL j
LOCAL GehOrd
LOCAL Hlp
LOCAL aStruct := DbStruct() , aFields[0]
Aeval(aStruct , {|x|AADD(aFields,x[1])})
CursorWait()
Arr := {}
IF IsCharacter(cFilter)
bFilt := MAAKBLCK(cFilter)
ELSEIF IsBlock(cFilter)
bFilt := cFilter
END
IF IsNil(ArrColBlock) .OR. ! IsArray(ArrColBlock)
ArrColBlock := {}
FOR j := 1 TO FCOUNT()
AADD(ArrColBlock,FIELDBLOCK(FIELD(j)))
NEXT
END
FOR EACH el IN ArrColBlock
IF IsCharacter(el) .AND. ASCAN(aFields, UPPER(el)) > 0
el := FIELDBLOCK(el)
END
IF ! IsBlock(el)
Msginfo("Wrong column " + LTRIM(STR(Hb_EnumIndex()))
RETURN
END
NEXT
IF (IsCharacter(cOrder) .OR. IsNumber(cOrder)) .AND. OrdSetFocus() <> cOrder
GehOrd := OrdSetFocus(cOrder)
END
IF IndexOrd() > 0
MAAKINDBLCK(IndBlck,indexord())
IF ! IsNil(uFrom)
IF IsBlock(uFrom)
uFrom := EVAL(uFrom)
END
DBSEEK(uFrom,.T.)
ELSE
GO TOP
END
IF ! IsNil(uTo)
IF IsBlock(uTo)
uTo := EVAL(uTo)
END
END
ELSE
IF ! IsNil(uFrom) .AND. IsNumber(uFrom)
IndBlck := {||RECNO()}
IF !( !IsNil(uTo) .AND. IsNumber(uTo) )
uTo := LASTREC()
END
DBGOTO(uFrom)
ELSE
GO TOP
END
END
DO WHIL ! EOF() .AND. IIF(! IsNil(uTo) .AND. IsBlock(IndBlck), EVAL(indBlck) <= uTo , .T. )
IF ! IsBlock(bFilt) .OR. EVAL(bFilt)
ASIZE(hlparr,0)
FOR EACH el IN ArrColBlock
hlp := EVAL(el)
AADD(hlparr , Hlp) //EVAL(el:bData))
NEXT
AADD(arr,ACLONE(hlparr))
END
SKIP
ENDD
IF ! IsNil(GehOrd)
OrdSetFocus(GehOrd)
END
CursorArrow()
RETURN
[/code:32kgs9jn] |
dbf to array | [code:hdnggqzm]FUNCTION MAIN()
LOCAL aArray := {}
LOCAL i
USE TEST
WHILE !EOF()
AADD( aArray, {} )
FOR i = 1 TO FCOUNT()
AADD( ATAIL( aArray ), FIELDGET( i ) )
NEXT
SKIP
ENDDO
CLOSE
// here you have the filled array
RETURN NIL[/code:hdnggqzm]
EMG |
dbf to array | But if you really want a sort of recordset then you should create a class.
EMG |
dbf to csv | Hello,
i want to convert a DBF to CSV.
Is this possible?
I am using xbrowse, where I can convert the database to Excel at the moment.
Thank you for your answers,
Kind regard,
Iris |
dbf to csv | Hello Iris,
Welcome to these forums. Its a honor to have you here and to meet you again (this time virtually) <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
It seems as Uwe from these forums has developed a tool that does what you need:
<!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?f=3&t=25040&start=0#p136139">viewtopic.php?f=3&t=25040&start=0#p136139</a><!-- l -->
Surely Uwe may provide it to you. He uses to provide the source code of his great tools
Please send my best regards to all your family |
dbf to csv | [code=fw:7e4ujuxl]<div class="fw" id="{CB}" style="font-family: monospace;"> USE STATES<br /> COPY <span style="color: #0000ff;">TO</span> STATES.CSV DELIMITED<br /> </div>[/code:7e4ujuxl] |
dbf to csv | Dear Antonio and dear Mr. Rao,
thank you very much for your quick answers.
I really appreciate the forum, it helps me a lot.
Normally I am just a "reader" and I find the answers in existing topics.
Antonio, it would be great to meet you again in Sillian one time <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
Best regards,
Iris |
dbf2sql de kleyber | amigos del foro
No se si alguien me pudiera proporcionar la ultima version de dbf2sql de kleyber porque los links ya no funcionan
Muchas gracias de antemano |
dbf2sql de kleyber | <!-- m --><a class="postlink" href="http://www.tkinformidia.net/crbst_7.html">http://www.tkinformidia.net/crbst_7.html</a><!-- m --> |
dbf2sql de kleyber | Ruben, aDutheil
Muchas gracias
Saludos |
dbfcdx.rdd | Hola a todos
tengo un archivo dbfcdx.rdd y quiero probarlo en harbour en reemplazo del driver nativo (dbfcdx)
Ahora bien, todos los drivers rdd vienen incluidos en una *.lib desde la que los usamos con el REQUEST DBFCDX y el RDDSETDEFAULT()
pero yo no tengo una *.lib, solo el dbfcdx.rdd !
es posible reemplazar el driver de Harbour usando este archivo ?
De ser asi, como se hace ?
Muchas gracias!!!! |
dbfntx very slow with 2+ users | My applications that utilize DBFNTX run really fast with one user and really slow with 2 or more users logged in at the same time.
Has anyone experienced this?
Harbour 3.2.0
BCC 5.82
Fivewin version 13.02
Thanks in Advance.
don |
dbfntx very slow with 2+ users | Yes I do.
How many indexes do you have?.
Since when are you suffering this?. |
dbfntx very slow with 2+ users | Lucas,
It is quite normal that ntx is becoming slower if the number of users is increasing.
For each index, a ntx-file is created. If you open a DBF-file with its ntx-files, every file takes a file handle.
In my application, I open 38 different files with at least 7 indexes per file. This means (1 x 38) + (7 x 38) = 304 file handles per user.
If you have 5 users, that means 1520 file handles on your server.
I experienced too that my application was becoming slower and slower.
I changed to CDX indexing. For 1 DBF-file, only 1 CDX-file is opened. In my excample that would mean 74 file handles per user.
If you have 5 users, that means 370 file handles on your server.
After having made the change, my application ran fine again.
Your antivirus can also be the cause of slowing down your application. Try it out with the antivirus disabled. I had this problem with some old versions of Norton. The current versions are OK.
Hope to have helped you. |
dbfntx very slow with 2+ users | Hello,
Thank you very much. Yes, I switched to DBFCDX many years ago.
Now I use CDX with various Tags and only one .cdx file per dbf, but in Network, with 3 or more users it is quite slow.
We are now moving to ADO and the problem has gone away <!-- s;) --><img src="{SMILIES_PATH}/icon_wink.gif" alt=";)" title="Wink" /><!-- s;) -->.
With ADS there was an increase on speed, but not very very much.
I did not find what was the problem with > 3 users and DBF to be such slow. With ADO and Access, for example, same network and a database of 8.000 records the speed is almost like the local PC.
Harbour leaders are not very much interested on Windows, so they don´t pay many attention on those issues, and it is hard to trace the problem. |
dbfntx very slow with 2+ users | Lucas,
search for SMB on the forum.
What OS do you use.
Best regards,
Otto |
dbfntx very slow with 2+ users | Otto,
Windows XP and Windows 7 mostly.
I do not use mapped drives, just \\server\folder, so I taought SMB was not the cause:
<!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?f=3&t=21740&p=115743&hilit=smb#p115743">viewtopic.php?f=3&t=21740&p=115743&hilit=smb#p115743</a><!-- l -->
Interesting post also:
<!-- m --><a class="postlink" href="https://en.wikipedia.org/wiki/Server_Message_Block">https://en.wikipedia.org/wiki/Server_Message_Block</a><!-- m -->
Do you know if Harbour function OS_NetRegOK() disables SMB?.
Thank you. |
dbfntx very slow with 2+ users | Hello,
xHarbour created this function, later adopted by Harbour, that disables SMB 2.0.
I tried some time ago with Little Luck.
Here it is. It may help you:
[code=fw:1zeas53m]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"directry.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"hbwin.ch"</span><br /><br /><span style="color: #B900B9;">/* NOTE: To change any of these registry settings<br /> Administrator rights are required by default in Windows. [vszakats] */</span><br /><br /><span style="color: #00C800;">FUNCTION</span> win_osNetRegOk<span style="color: #000000;">(</span> lSetIt, lDoVista <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">LOCAL</span> bRetVal := .T.<br /> <span style="color: #00C800;">LOCAL</span> cKeySrv<br /> <span style="color: #00C800;">LOCAL</span> cKeyWks<br /><br /> hb_default<span style="color: #000000;">(</span> @lSetIt, .F. <span style="color: #000000;">)</span><br /> hb_default<span style="color: #000000;">(</span> @lDoVista, .T. <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">IF</span> ! lDoVista .AND. hb_osIsWinVista<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #B900B9;">/* do nothing */</span><br /> ELSEIF hb_osIsWin9x<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> bRetVal := win_regQuery<span style="color: #000000;">(</span> WIN_HKEY_LOCAL_MACHINE, <span style="color: #ff0000;">"System<span style="color: #000000;">\C</span>urrentControlSet<span style="color: #000000;">\S</span>ervices<span style="color: #000000;">\V</span>xD<span style="color: #000000;">\V</span>REDIR"</span>, <span style="color: #ff0000;">"DiscardCacheOnOpen"</span>, <span style="color: #000000;">1</span>, lSetIt <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ELSE</span><br /> cKeySrv := <span style="color: #ff0000;">"System<span style="color: #000000;">\C</span>urrentControlSet<span style="color: #000000;">\S</span>ervices<span style="color: #000000;">\L</span>anmanServer<span style="color: #000000;">\P</span>arameters"</span><br /> cKeyWks := <span style="color: #ff0000;">"System<span style="color: #000000;">\C</span>urrentControlSet<span style="color: #000000;">\S</span>ervices<span style="color: #000000;">\L</span>anmanWorkStation<span style="color: #000000;">\P</span>arameters"</span><br /><br /> <span style="color: #00C800;">IF</span> lSetIt<br /> lSetIt := ! hb_osIsWinNT<span style="color: #000000;">(</span><span style="color: #000000;">)</span> .OR. wapi_IsUserAnAdmin<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #B900B9;">/* Server settings */</span><br /> bRetVal := bRetVal .AND. win_regQuery<span style="color: #000000;">(</span> WIN_HKEY_LOCAL_MACHINE, cKeySrv, <span style="color: #ff0000;">"CachedOpenLimit"</span>, <span style="color: #000000;">0</span>, lSetIt <span style="color: #000000;">)</span><br /> bRetVal := bRetVal .AND. win_regQuery<span style="color: #000000;">(</span> WIN_HKEY_LOCAL_MACHINE, cKeySrv, <span style="color: #ff0000;">"EnableOpLocks"</span>, <span style="color: #000000;">0</span>, lSetIt <span style="color: #000000;">)</span> <span style="color: #B900B9;">/* Q124916 */</span><br /> bRetVal := bRetVal .AND. win_regQuery<span style="color: #000000;">(</span> WIN_HKEY_LOCAL_MACHINE, cKeySrv, <span style="color: #ff0000;">"EnableOpLockForceClose"</span>, <span style="color: #000000;">1</span>, lSetIt <span style="color: #000000;">)</span><br /> bRetVal := bRetVal .AND. win_regQuery<span style="color: #000000;">(</span> WIN_HKEY_LOCAL_MACHINE, cKeySrv, <span style="color: #ff0000;">"SharingViolationDelay"</span>, <span style="color: #000000;">0</span>, lSetIt <span style="color: #000000;">)</span><br /> bRetVal := bRetVal .AND. win_regQuery<span style="color: #000000;">(</span> WIN_HKEY_LOCAL_MACHINE, cKeySrv, <span style="color: #ff0000;">"SharingViolationRetries"</span>, <span style="color: #000000;">0</span>, lSetIt <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">IF</span> hb_osIsWinVista<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #B900B9;">/* If SMB2 is enabled turning off oplocks does not work, so SMB2 is required to be turned off on Server. */</span><br /> bRetVal := bRetVal .AND. win_regQuery<span style="color: #000000;">(</span> WIN_HKEY_LOCAL_MACHINE, cKeySrv, <span style="color: #ff0000;">"SMB2"</span>, <span style="color: #000000;">0</span>, lSetIt <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #B900B9;">/* Workstation settings */</span><br /> bRetVal := bRetVal .AND. win_regQuery<span style="color: #000000;">(</span> WIN_HKEY_LOCAL_MACHINE, cKeyWks, <span style="color: #ff0000;">"UseOpportunisticLocking"</span>, <span style="color: #000000;">0</span>, lSetIt <span style="color: #000000;">)</span><br /> bRetVal := bRetVal .AND. win_regQuery<span style="color: #000000;">(</span> WIN_HKEY_LOCAL_MACHINE, cKeyWks, <span style="color: #ff0000;">"EnableOpLocks"</span>, <span style="color: #000000;">0</span>, lSetIt <span style="color: #000000;">)</span><br /> bRetVal := bRetVal .AND. win_regQuery<span style="color: #000000;">(</span> WIN_HKEY_LOCAL_MACHINE, cKeyWks, <span style="color: #ff0000;">"EnableOpLockForceClose"</span>, <span style="color: #000000;">1</span>, lSetIt <span style="color: #000000;">)</span><br /> bRetVal := bRetVal .AND. win_regQuery<span style="color: #000000;">(</span> WIN_HKEY_LOCAL_MACHINE, cKeyWks, <span style="color: #ff0000;">"UtilizeNtCaching"</span>, <span style="color: #000000;">0</span>, lSetIt <span style="color: #000000;">)</span><br /> bRetVal := bRetVal .AND. win_regQuery<span style="color: #000000;">(</span> WIN_HKEY_LOCAL_MACHINE, cKeyWks, <span style="color: #ff0000;">"UseLockReadUnlock"</span>, <span style="color: #000000;">0</span>, lSetIt <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">IF</span> hb_osIsWinVista<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> bRetVal := bRetVal .AND. win_regQuery<span style="color: #000000;">(</span> WIN_HKEY_LOCAL_MACHINE, cKeyWks, <span style="color: #ff0000;">"FileInfoCacheLifetime"</span>, <span style="color: #000000;">0</span>, lSetIt <span style="color: #000000;">)</span><br /> bRetVal := bRetVal .AND. win_regQuery<span style="color: #000000;">(</span> WIN_HKEY_LOCAL_MACHINE, cKeyWks, <span style="color: #ff0000;">"FileNotFoundCacheLifetime"</span>, <span style="color: #000000;">0</span>, lSetIt <span style="color: #000000;">)</span><br /> bRetVal := bRetVal .AND. win_regQuery<span style="color: #000000;">(</span> WIN_HKEY_LOCAL_MACHINE, cKeyWks, <span style="color: #ff0000;">"DirectoryCacheLifetime"</span>, <span style="color: #000000;">0</span>, lSetIt <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #00C800;">IF</span> hb_osIsWin2K<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> bRetVal := bRetVal .AND. win_regQuery<span style="color: #000000;">(</span> WIN_HKEY_LOCAL_MACHINE, <span style="color: #ff0000;">"System<span style="color: #000000;">\C</span>urrentControlSet<span style="color: #000000;">\S</span>ervices<span style="color: #000000;">\M</span>RXSmb<span style="color: #000000;">\P</span>arameters"</span>, <span style="color: #ff0000;">"OpLocksDisabled"</span>, <span style="color: #000000;">1</span>, lSetIt <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #00C800;">RETURN</span> bRetVal<br /> </div>[/code:1zeas53m]
We are very happy with ADO, as it offers to use MSSQL, MySQL, Access, etc with same code.
In the mean time, we are still suffering with DBFS. |
dbfntx very slow with 2+ users | I have a Harbour / Fivewin application that uses MSSQL tables via Mediator (3rd party RDD from OTS software).
Does ADO provide MSSQL and MySQL seamlessly using harbour RDD database "regular" commands, like USE, SKIP, SEEK, DELETE, PACK, COPY, etc. and regular function calls like dbskip, dbdelete, dbpack, dbappend, etc. ??
if yes, is the conversion path relatively seamless (within reason of course)? |
dbfntx very slow with 2+ users | Don,
ADO does not work like a RDD, please take a look at samples\adoxbr01.prg.
I did not get Mediator working not a reply from OTC, so that´s why I choose SQLRDD, but it did not work as expected.
Your problem happens with DBF stand alone or with Mediator?. |
dbfntx very slow with 2+ users | That's an odd topic.
for reading files either individually or especially en masse Mediator is faster than DBF, especially with 2+ users.
If I use sql commands like SELECT * etc, Mediator is very fast.
the coding is 99% harbour compatiable using conventional programming syntax.
i've had good luck with Mediator for about 5 years now.
But, Mediator's updating of tables is much slower than dbf updating. especially when cycling thru a large file. almost 2 times longer.
I suspect tons of logging on the server side slows it down. in these cases, I found it was better to rewrite the code from a do while loop to selecting a temporary result set and working with sql commands.
so, for processes that have lots of database updates it's much faster to run in DBF mode than Mediator with one user at a time. as more users get added my guess is the difference gap would close but I can't be certain of this as I've not tested it.
we have applications that run on mediator RDD and and others that use dbfntx RDD.
There are always multi user configurations, many times across a wan. in the wan cases, we require terminal server or citrix metaframe. this actually makes the .dbf system run better because everything is housed on a huge virtual server with lot's of horsepower. the users see better performance in these cases.
I was just wondering if it might be time to investigate other routes to MSSQL. |
dbfntx very slow with 2+ users | Don
[quote:145f9q6b]
I was just wondering if it might be time to investigate other routes to MSSQL.
[/quote:145f9q6b]
The short answer to your statement above is YES! .. I started using ADO ( sqloledb, or Ms Jet ) many years ago and I never looked back. With recent versions of FiveWin they have created a set of FW_Ado .. functions that simplify the connection strings and recordsets data fetches.
For those that have used the tData class .. using ADO is a very similar class... here is the FW Wiki
<!-- m --><a class="postlink" href="http://wiki.fivetechsoft.com/doku.php?id=ado-related_stuffs">http://wiki.fivetechsoft.com/doku.php?i ... ted_stuffs</a><!-- m -->
I know you are probably not looking forward to the re-writing of your MS Sql \Mediator database code.. however, once you do, you will find the code is very portable between Ms Sql Server ( and express ), MS Access and Oracle... just re-compile with a different connection string and ( in most cases ) your code stays the same.
As far as dbfcdx, dbfntx .. the day of the DOS file handle is sunsetting.
Rick Lipkin |
dbfntx very slow with 2+ users | I am also experiencing the same issue.
There are 2 PC's ie [b:x1wamsug]PC1[/b:x1wamsug] and [b:x1wamsug]PC2[/b:x1wamsug].
The application and data reside on PC1. For eg on D Drive ie D:\MyApp
The operating system used on both the PC's are Windows 10
The problem occurs ONLY when the second user uses the Application irrespective of whether it is used from the PC1 or PC2
The D Drive of PC1 is shared and accessed from PC2
If the application is NOT open in PC1 then there is NO performance ISSUE on PC2
If the application is OPEN in PC1 then the performance is too poor on PC2 ie extremely slow.
[b:x1wamsug][u:x1wamsug]Already tried the following:-[/u:x1wamsug][/b:x1wamsug]
Disabled Antivirus, Excluded the App Folder from Antivirus Scan
Applied the command [b:x1wamsug]netsh interface tcp set global autotuninglevel=highlyrestricted[/b:x1wamsug]
Disabled [b:x1wamsug]Remote Differential Compression API support[/b:x1wamsug]
Tried disabling SMB2.
Instead of using the Mapped drive, I tried using the UNC path too ie \\PcName\SharedDrive\MyApp\MyDBF.DBF, unfortunately, didn't make any noticeable difference
On the main PC, tried tweaking the performance options and changed [i:x1wamsug]"Adjust for best performance of Background Services"[/i:x1wamsug]
Searched the forum, did not find a solution that could solve this issue.
I am wondering what solutions are used by others ? Is there anything that I missed to try ?
It is a very old app, for the time being, unable to move to SQL from DBF |
dbfntx very slow with 2+ users | Perhaps <!-- m --><a class="postlink" href="https://groups.google.com/g/comp.lang.xharbour/c/DPt-VaADDdw">https://groups.google.com/g/comp.lang.x ... Pt-VaADDdw</a><!-- m --> |
dbfntx very slow with 2+ users | hi,
i saw Comments about SMB ...
many of these Comment are "outdate", while for SMB1, and not valid when using Windows 10 / 11
Note : it is NOT recommend to use "older" OS than Windows 10 any more
only some older NAS will still use SMB1. change your NAS <!-- s:!: --><img src="{SMILIES_PATH}/icon_exclaim.gif" alt=":!:" title="Exclamation" /><!-- s:!: -->
---
SMB1 should be DISABLE and SMB2 ENABLE which is default under Windows 10 / 11 !
to check it run Rowershell and type
[code=fw:2b944hz5]<div class="fw" id="{CB}" style="font-family: monospace;">Get-SmbServerConfiguration</div>[/code:2b944hz5]
now look for
[quote:2b944hz5]EnableSMB1Protocol : False
EnableSMB2Protocol : True[/quote:2b944hz5]
---
are you using "Drive-Letter" or UNC-Path <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
when using "Drive-Letter" it work with LANmanager and UDP Port 135-139
have a look at Server / Network / Ports if there is Traffic on this Ports
if YES than you still working with OLD SMB1 and all it´s Problem <!-- s:roll: --><img src="{SMILIES_PATH}/icon_rolleyes.gif" alt=":roll:" title="Rolling Eyes" /><!-- s:roll: -->
do NOT use OLD SMB1 "Hack" on Windows 10 / 11 <!-- s:!: --><img src="{SMILIES_PATH}/icon_exclaim.gif" alt=":!:" title="Exclamation" /><!-- s:!: -->
---
since SMB2 we have a "Local Cache" which can made Problem when use "Local" Action
this is e.g. with "temporary" Action like INDEX ON or FERASE(localfile)
btw.
Question : does FiveWin "lock" Index like Xbase++ do <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
read here what is recommend for SMB2 when work with "temporary" Local Action
[url:2b944hz5]https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-7/ff686200(v=ws.10)?redirectedfrom=MSDN[/url:2b944hz5]
DISABLE under HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Lanman[b:2b944hz5]Workstation[/b:2b944hz5]\Parameters
[code=fw:2b944hz5]<div class="fw" id="{CB}" style="font-family: monospace;">FileInfoCacheLifetime<br />FileNotFoundCacheLifetime<br />DirectoryCacheLifetime<br /> </div>[/code:2b944hz5]and set all 3 to 0 ( Zero ) on Workstation ( on Server only when using RDP )
---
General "File-Based" System will slow down when SMB switch from "Single Exclusive" to "Opportunistic lock".
Programmer like to "open" as much as possible and "leave" all "open" ...
that you can do with Single User App but it is not recommend in Network
under SQL you do not have "direct" Access to Data, Wifi can "lost Connection".
in older Network it was slow to open a DBF, read/write and close it. but that have change
very slow are TBrowse & Co which use a "Skipper" to navigate.
Spezial when using FILTER without SCOPE / Index it can very slow on big Database and make much Traffic
btw. same with SQL when not using LIMIT
so do use Resource only when need and avoid "Stand-by" of open Database when not need |
dbfntx very slow with 2+ users | [quote="Jimmy":lfz0hj2g]i saw Comments about SMB ...
many of these Comment are "outdate", while for SMB1, and not valid when using Windows 10 / 11
Note : it is NOT recommended to use "older" OS than Windows 10 any more[/quote:lfz0hj2g]
True
[quote="Jimmy":lfz0hj2g]are you using "Drive-Letter" or UNC-Path <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: --> [/quote:lfz0hj2g]
I was using a drive letter, now, I changed to UNC Path. Unfortunately, I did not see any noticeable difference in the speed
[quote="Jimmy":lfz0hj2g]Programmer like to "open" as much as possible and "leave" all "open" ...
that you can do with Single User App but it is not recommend in Network[/quote:lfz0hj2g]
I open DBF files ONLY when it is necessary and CLOSE after usage, never kept open the whole time
[quote="Jimmy":lfz0hj2g]do NOT use OLD SMB1 "Hack" on Windows 10 / 11 <!-- s:!: --><img src="{SMILIES_PATH}/icon_exclaim.gif" alt=":!:" title="Exclamation" /><!-- s:!: -->[/quote:lfz0hj2g]
Noted
Thank you |
dbfntx very slow with 2+ users | [quote="don lowenstein"]I have a Harbour / Fivewin application that uses MSSQL tables via Mediator (3rd party RDD from OTS software).
Don,
where can I found a trial version or pricing of Mediator? |
dbfntx very slow with 2+ users | I found in this url
[url:1mkqshes]http://www.otc.pl/download/default.aspx?l=2[/url:1mkqshes]
but virustotal says is not safe
<!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: --> |
dbfntx very slow with 2+ users | If any of you are using filters this will be incredibly slow over a network. You need to use scopes instead.
Also, as someone else mentioned, you need to open only the databases needed for the routine, then close them when done. |
dbfntx very slow with 2+ users | Hello James,
Thank you.
If there is no stored index, what is the best way to create one that you can use scope.
Best regards,
Otto |
dbfntx very slow with 2+ users | Otto,
[quote:2drlw2pk]If there is no stored index, what is the best way to create one that you can use scope.[/quote:2drlw2pk]
Well, creating an index and using a filter (once) will take about the same amount of time because you have to read the entire database either way. Actually, when creating an index you have to not only read the entire database, you also have to write the field to the index for each record too.
Are you using a temporary dbf? Or, explain more about what you need to do. Is there a reason you can't have an existing index?
Below are the results of a speed test I did some time back.
- 1,000,000 record database
- 20,543 records match criteria (state="CA")
- Time for filter 23.13 seconds
- Time for scope 0.32 seconds
Thus filtering took 23.13 / 0.32 = 72 times longer than a scope.
And the winner is, scopes! |
dbfntx very slow with 2+ users | Gentleman ... you all may be overlooking your network infrastructure .. especially if you are doing peer to peer. Check your router and switches .. if they are old .. replace them .. I noticed a BIG improvement in our peer to peer application when we upgraded our ISP router with a dual band 2g\5g ( with built in wireless ) .. I have a 5g wireless in my laptop and when I connect to the 5g side of the new router .. it made a BIG difference.
Rick Lipkin |
dbfntx very slow with 2+ users | in my workplace I use two different pc
my personal dell vostro 16 GB i7 SDD and a fujitsu i5 8 GB and HD
microsoft windows server virtalualized (vmware)
If I perform lanspeedtest.exe the speed is very fast and similar
But if I work with my program in dell is very very fast while in fujitsu the speed some operations are slow, others are faster.
I use dbfcdx
it almost seems that processor speed is essential for data access and not just network speed
which in my opinion shouldn't be that influential
The question is When I execute
SELECT 0
USE n:\hse\customers // very fast
SET INDEX TO n:\hse\customers // not so fast
The index is open and read in its entirety?
And then loaded into the memory? |
dbfntx very slow with 2+ users | Marco,
SSD is the point for DBF speed.
Why don't you use RDP?
This way you have a local system.
Best regards,
Otto |
dbfntx very slow with 2+ users | hi,
if you need more than 3 Second, even over Network, it is "too long"
SET FILTER is slow when not use SCOPE before ... it is like SQL without LIMIT
---
SCOPE need Index and SCOPETOP / SCOPEBOTTOM begin on left Side
if you have a FILTER to search "in String" like
[code=fw:140p5v75]<div class="fw" id="{CB}" style="font-family: monospace;"> <span style="color: #ff0000;">"ABC"</span> $ CUSTOMER->NAME</div>[/code:140p5v75]
you can Speed-Up when use Index and OrdWildSeek()
[code=fw:140p5v75]<div class="fw" id="{CB}" style="font-family: monospace;"> ORDSETFOCUS<span style="color: #000000;">(</span> <span style="color: #ff0000;">"ALLETELNO"</span> <span style="color: #000000;">)</span><br /> GO TOP<br /> <span style="color: #00C800;">DO</span> <span style="color: #00C800;">WHILE</span> ORDWILDSEEK<span style="color: #000000;">(</span> <span style="color: #ff0000;">"*"</span> + ALLTRIM<span style="color: #000000;">(</span> cSeek <span style="color: #000000;">)</span> + <span style="color: #ff0000;">"*"</span>, .T. <span style="color: #000000;">)</span> <span style="color: #B900B9;">// harbour have 2nd Parameter</span><br /> cTEXT := XPPTEL->NAME1 <br /> AADD<span style="color: #000000;">(</span> aPhone, <span style="color: #000000;">{</span> cTEXT, RECNO<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDDO</span><br /> </div>[/code:140p5v75]
---
"File-Based" System need SMB, else you can not "share" a File
"Drive Letter" use LanManager which can "redirect" Port 139 to 445
SMB2 is using UNC-Path and you do not need "Authentification" every Time
so avoid Traffic on UDP Ports 135-139 which use "old" SMB1 (with all those Problems)
p.s. on many SQL Server UDP-Ports are "blocked" by Admin for "Security" |
dbfntx very slow with 2+ users | Otto,
my local volume C: is SSD
but dbf tables are in a server volume |
dbfntx very slow with 2+ users | Hallo Marco,
Is your program a hobby application or is it in for professional use?
If it is for professional use, then I suggest you buy a SSD for your server and then run your program remotely.
Then you will have a professional system. How many users do you have?
File sharing and the fact that your data is also on the client is also a big security issue.
You have to install the appropriate GPO to prevent a remote client from doing certain things, but then you have a real system for professional use.
And you also are prepared for development into a web app.
With best regards,
Otto |
dbfntx very slow with 2+ users | Dear Otto
>Is your program a hobby application or is it in for professional use?
professional use
> If it is for professional use, then I suggest you buy a SSD for your server and then run your program remotely.
soon we will change the server my program run on a mapped volume
> Then you will have a professional system. How many users do you have?
~ 20
> File sharing and the fact that your data is also on the client is also a big security issue.
Yes I Know
it would be nice if there was a product like APOLLO that allows me not to change anything (the dbf tables)
in my program my users are used to working in this way and it would be practical to change they work with eyes closed |
dbfntx very slow with 2+ users | Marco, you can use your program as it is, just remotely.
So many problems disappear with it.
No installation on the client PCs.
Data backup in one central place.
No mapped drives.
Client can be a smartphone, a tablet, a Mac or AndroidPC or all Windows versions.
Plan a weekend in the Dolomites and I will show you how we do it.
With best regards,
Otto |
dbfntx very slow with 2+ users | [quote="Otto":165e07xx]Marco, you can use your program as it is, just remotely.
So many problems disappear with it.
No installation on the client PCs.
Data backup in one central place.
No mapped drives.
Client can be a smartphone, a tablet, a Mac or AndroidPC or all Windows versions.
Plan a weekend in the Dolomites and I will show you how we do it.
With best regards,
Otto[/quote:165e07xx]
Are there youtube files how it is done ? Or documentation ?
We have talked about it before, but still ... not operational |
dbfntx very slow with 2+ users | Hello Marc,
I can offer you the same as Marco.
Spend a weekend in Tirol and I show you our system and my mod harbour programs.
Best regards,
Otto |
dbfntx very slow with 2+ users | hi Marc,
did you know LetoDb or NetIO for harbour <!-- s:idea: --><img src="{SMILIES_PATH}/icon_idea.gif" alt=":idea:" title="Idea" /><!-- s:idea: -->
it is still using DBF but it work over TCP/IP as Client/Server
so you get no SMB Problem and have no direct File Access. |
dbfntx very slow with 2+ users | Jimmy,
>> did you know LetoDb or NetIO for harbour <!-- s:idea: --><img src="{SMILIES_PATH}/icon_idea.gif" alt=":idea:" title="Idea" /><!-- s:idea: -->
Where can I download some documentation? |
dbfntx very slow with 2+ users | Dear Otto,
thank for you invitation <!-- s8) --><img src="{SMILIES_PATH}/icon_cool.gif" alt="8)" title="Cool" /><!-- s8) --> |
dbfntx very slow with 2+ users | [quote="Jimmy":73ba451g]hi Marc,
did you know LetoDb or NetIO for harbour <!-- s:idea: --><img src="{SMILIES_PATH}/icon_idea.gif" alt=":idea:" title="Idea" /><!-- s:idea: -->
it is still using DBF but it work over TCP/IP as Client/Server
so you get no SMB Problem and have no direct File Access.[/quote:73ba451g]
No, I will look for info about them.
I also have no idea about the SMB problem (no idea what SMB is (look into it)
I Also have a peer to peer 4 users. Put a SSD as harddrives and network cards of 1.000 mb
So, folowing all the tips that show up here... |
dbfntx very slow with 2+ users | Marco,
I have used many systems also LetoDb.
These are all just workarounds.
There is a request to the server and then the data is transferred to the client.
It is different with RDP. Only the changed pixels of the screen are transferred.
You, and especially if you are a small company, should use RDP.
All your problems will disappear with it.
[b:29xd08yk]And another warning.[/b:29xd08yk]
The young generation of business managers replaces all desktop programs with web applications.
The dangerous thing for us desktop program vendors is that we don't even get informed.
They look for a new program and then send you an email where they thank you for your years of cooperation and ask for your understanding.
Although mod harbour makes it relatively easy for us to change and update our programs, it is a lot of work in detail.
With RDP, you practically have similar behavior to web applications.
You can get used to the new way of thinking without much effort.
Best regards,
Otto
My mod harbour diary
[url:29xd08yk]https://mybergland.com/fwforum/kassabuch/kassabuchmenu.html[/url:29xd08yk] |
dbfntx very slow with 2+ users | hi Marc,
[quote="Marc Venken":3cwv11ip]
I also have no idea about the SMB problem (no idea what SMB is (look into it)
[/quote:3cwv11ip]
read here about Opportunistic locks (oplocks)
[url:3cwv11ip]https://docs.microsoft.com/en-US/windows/win32/fileio/opportunistic-locks[/url:3cwv11ip]
this Paper is about : "What's New in SMB"
Applies To: Windows 7, Windows Server 2008 R2 (SMB-2)
[url:3cwv11ip]https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/ff625695(v=ws.10)?redirectedfrom=MSDN[/url:3cwv11ip]
---
SMB-2 also have a "Local Cache" which is used e.g. INDEX ON even when Index is on Server
so you need to "disable" it
[img:3cwv11ip]https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-7/ff686200(v=ws.10)?redirectedfrom=MSDN[/img:3cwv11ip]
---
Speed depend on "Cache" and if "Cache" is invalid than you get Data Corruption ( most Index )
when only 1 User access File it will be no Problem with "Cache"
but when 2nd User access same File you need "to share Cache" too
---
most Problem i have in Network of Customer are Antivirus Apps
also Speed are "lost" while Antivirus App does "sniff" what is transfer
disable Antivirus from DATA Folder does Speed-up a lot ... but "Security" is lost <!-- s:!: --><img src="{SMILIES_PATH}/icon_exclaim.gif" alt=":!:" title="Exclamation" /><!-- s:!: --> |
dbfntx very slow with 2+ users | hi Marco,
[quote="MarcoBoschi":3ia79sa3]Where can I download some documentation?[/quote:3ia79sa3]
LetoDB [url:3ia79sa3]https://www.kresin.ru/en/letodb.html[/url:3ia79sa3]
NetIO is Part of harbour Constribution
[url:3ia79sa3]https://github.com/harbour/core/blob/master/contrib/hbnetio/utils/hbnetio/hbnetio.prg[/url:3ia79sa3]
to read
[url:3ia79sa3]http://harbourlanguage.blogspot.com/2010/04/harbour-netio.html[/url:3ia79sa3]
MiniGUI Extended Version (use BCC) have Sample with Demo Source
[url:3ia79sa3]http://hmgextended.com/files/CONTRIB/hmg-22.03-setup.exe[/url:3ia79sa3] |
dbfntx very slow with 2+ users | Otto,
when you say
> You, and especially if you are a small company, should use RDP.
> All your problems will disappear with it.
but license for 1 user costs about 150 euros
And the server the server must be sized appropriately I don't remember how much ram each user ...
In my opinion in a local area network if it were programmatically optimized the index management (DBFCDX)
maybe the file/server architecture is still the winning choice
each user uses the power of his own client pc
Security is perhaps the only problem.
In my opinion is in a local network if it were programmatically optimized index management (DBFCDX)
maybe the file/server architecture is still the winning choice
Each user uses the power of his own client pc and do not use the pc as a terminal in wich the only used program is mstc.exe
then deciding how important is security in a particular scenario is another matter
last but not least if I change my program that user use eyes wide shut they kill me |
dbfntx very slow with 2+ users | Marco,
>but license for 1 user costs about 150 euros
That's why I asked you if it was a[b:yjfeu9uh] hobby application or for professional use[/b:yjfeu9uh].
I am posting some screens here.
Please note that FIVEWIN programs need very little memory.
Outlook is the biggest consumer here.
But you don't have to use Outlook in the RDP session.
We do it because we have a document management included in
WINHOTEL and you can simply drag and drop emails into WINHOTEL.
[b:yjfeu9uh]Please understand that all the clients use the full power the server has.
Also, if you access with a smartphone or a tablet, you have the speed of the server![/b:yjfeu9uh]
I wish you a happy Easter.
Best regards,
Otto
[img:yjfeu9uh]https://mybergland.com/fwforum/rdpcpuram.jpg[/img:yjfeu9uh] |
dbfntx very slow with 2+ users | Hello friends,
I add 2 more photos to my post.
On the screenshot you can see the memory consumption of the [b:wtwzdc4v]APACHE server with mod harbour[/b:wtwzdc4v].
And then quite interesting the hardware.
Above is the SERVERBOOK we put in operation in [b:wtwzdc4v]2013[/b:wtwzdc4v] and it was in use [b:wtwzdc4v]24 hours 365 days[/b:wtwzdc4v] a year [b:wtwzdc4v]without ever problems[/b:wtwzdc4v].
Since it was still an i5 and had WINDOWS SERVER 2012 installed, we have now commissioned a new i7 SERVERBOOK with WINDOWS 2019 Server - the small one below.
Here is also mod harbour installed and [b:wtwzdc4v]WINHOTEL Desktop accesses the same databases as WINHOTEL online.[/b:wtwzdc4v]
The SERVERBOOK is a fully professional SERVER. Even a UPS is built in.
Best regards,
Otto
[img:wtwzdc4v]https://mybergland.com/fwforum/sb_neu.jpg[/img:wtwzdc4v]
[img:wtwzdc4v]https://mybergland.com/fwforum/sb_neu2.jpg[/img:wtwzdc4v] |
dbfntx very slow with 2+ users | Otto,
Please provide a link to "Serverbook", a web search for "serverbook" only turns up a paper notebook.
James |
dbfntx very slow with 2+ users | Hello James,
Glad you like the idea. SERVERBOOK is our trademark.
We use HP PRO book as hardware for years.
Meanwhile, we have some Powershell scripts to do then all settings software based.
Now also including mod harbour and APACHE.
Best regards,
Otto
PS: By the way, the website was created by Ruth with mod harbour.
[url:1xsdg3nb]https://winhotel.space/winhotel_webpage/megamenu.prg?page_id=1518[/url:1xsdg3nb] |
dbfs on Network : wich performance method? | Dear friends,
I wish to ask what is the best way to manage archives in a network for an application I need to create.
Until now I have limited myself to open the archives in an exclusive way because I have left the problem of the network.
I have made applications up until now that were needed for me or my friends for personal use.
Now I need to create something but with the archives in a network so that all the operators can interact with the same archives and at the same time
for example: make an invoice at the same time another user does it
But there are problems because asking friends in the forum and other people who work with fwh.
Some are oriented to use the class tdatabase others instead open archives in a shared way, another friend sent me a very special modified tdatabase class.
I really can not figure out which way I can use so even because I would like to fix already from now those props
that I will need for a tomorrow for my next applications so as to use the archives for apps that require the network and for apps that do not they necessarily need to use them in a network
In ancient times I used the class of Manuel Esposito (gather / scatter) but I have so many problems for a simple shirting program
and after this bad experience I preferred not to deal with the topic of the network
I would especially like someone to show me which performance method to use according to his personal working experiences,
which class to use if there is a need for a class and to have small examples to try, to open, modify, delete, search, print and save a record
I thank you in advance |
dbfs on Network : wich performance method? | Silvio,
Here is an example. This is fully network compatible. Open a file object with one line of code. Databases are open in shared mode, buffered, optimistic locking, no dealing with aliases workareas, etc.
Use this with the customer.dbf file you recently sent me and/or change it slightly to work with any database.
[code=fw:zmchlsuz]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #B900B9;">/*<br />Purpose : Showing how to build database object classes<br /> Also shows inheritance from a base class <br />Program : <br />Author : James Bott, <!-- e --><a href="mailto:jbott@compuserve.com">jbott@compuserve.com</a><!-- e --><br />Date : 10/29/2018 11:42:51 AM<br />Company : Intellitech<br />Copyright: Copyright © 2018 Intellitech. All rights reserved.<br />Language : Fivewin/xHarbour<br />Updated : <br />Notes :<br /><br />*/</span><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><br /><span style="color: #00C800;">Function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Local</span> oCustomers<br /> <span style="color: #00C800;">Local</span> oInvoices <br /> <br /> REQUEST DBFCDX<br /> rddsetdefault<span style="color: #000000;">(</span> <span style="color: #ff0000;">"DBFCDX"</span> <span style="color: #000000;">)</span><br /> SET EXCLUSIVE OFF<br /> SET<span style="color: #000000;">(</span>_SET_AUTOPEN, .T. <span style="color: #000000;">)</span> <span style="color: #B900B9;">// Auto open cdx-index files </span><br /> <br /> BuildIndexes<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <br /> oCustomers := TCustomers<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><br /> <br /> oCustomers:<span style="color: #000000;">skip</span><span style="color: #000000;">(</span><span style="color: #000000;">10</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">msgInfo</span><span style="color: #000000;">(</span>oCustomers:<span style="color: #000000;">last</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// Shows Farley</span><br /> <br /> oCustomers:<span style="color: #000000;">last</span> := <span style="color: #ff0000;">"Farley 2"</span> <span style="color: #B900B9;">// change</span><br /> oCustomers:<span style="color: #000000;">save</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// save</span><br /> <span style="color: #0000ff;">msgInfo</span><span style="color: #000000;">(</span>oCustomers:<span style="color: #000000;">last</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// Shows "Farley 2"</span><br /> <br /> oCustomers:<span style="color: #000000;">last</span> := <span style="color: #ff0000;">"Farley"</span><br /> oCustomers:<span style="color: #000000;">save</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">select</span><span style="color: #000000;">(</span>oCustomers:<span style="color: #000000;">nArea</span><span style="color: #000000;">)</span><br /> browse<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// Shows Farley</span><br /> <br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">nil</span><br /><br /><br /><span style="color: #B900B9;">//---------------------------------------------------------------------------//</span><br /><span style="color: #B900B9;">// Base class for DBF classes</span><br /><span style="color: #00C800;">Class</span> TXData <span style="color: #0000ff;">from</span> TDatabase<br /> <span style="color: #00C800;">Method</span> <span style="color: #00C800;">New</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">Endclass</span><br /><br /><span style="color: #00C800;">Method</span> <span style="color: #00C800;">New</span><span style="color: #000000;">(</span>cFile,lShared<span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> TXData<br /> <span style="color: #00C800;">Default</span> lShared := .t.<br /> ::<span style="color: #00C800;">super</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span>,cFile,,lShared<span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">use</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">self</span><br /><br /><span style="color: #B900B9;">//---------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">Class</span> TCustomers <span style="color: #0000ff;">from</span> TXData<br /> <span style="color: #00C800;">Method</span> <span style="color: #00C800;">New</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">Endclass</span><br /><br /><span style="color: #00C800;">Method</span> <span style="color: #00C800;">New</span><span style="color: #000000;">(</span>lShared<span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> TCustomers<br /> ::<span style="color: #00C800;">super</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"customer"</span>, lShared<span style="color: #000000;">)</span><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">self</span><br /><br /><br /><span style="color: #B900B9;">//---------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">Class</span> TInvoice <span style="color: #0000ff;">from</span> TXData<br /> <span style="color: #00C800;">Method</span> <span style="color: #00C800;">New</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">Endclass</span><br /><br /><span style="color: #00C800;">Method</span> <span style="color: #00C800;">New</span><span style="color: #000000;">(</span>lShared<span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> TInvoice<br /> ::<span style="color: #00C800;">super</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"Invoice"</span>, lShared<span style="color: #000000;">)</span><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">self</span><br />*/<br /><span style="color: #B900B9;">//---------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">Function</span> BuildIndexes<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> use customer<br /> <span style="color: #0000ff;">Index</span> <span style="color: #0000ff;">on</span> <span style="color: #ff0000;">"id"</span> tag <span style="color: #ff0000;">"custno"</span> <span style="color: #0000ff;">to</span> customer<br /> <span style="color: #0000ff;">index</span> <span style="color: #0000ff;">on</span> <span style="color: #ff0000;">"last"</span> tag <span style="color: #ff0000;">"last"</span> <span style="color: #0000ff;">to</span> customer<br /> close<br /><br /> <span style="color: #B900B9;">// use invoice</span><br /> <span style="color: #B900B9;">// index on "last" tag "Invno" to invoice</span><br /> <span style="color: #B900B9;">// close</span><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span></div>[/code:zmchlsuz] |
dbfs on Network : wich performance method? | James ,
many years ago I already used the class Tdatabase, in 1999/2001 I made an application where I found different difficulties,
I used a main window and many child windows in each of which I inserted a dbf with a listbox.
I often encountered the error "alias do not exist" and no one even helped me because at that time there was no fwh forum
but only the newsgroup.
I used this expression
[code=fw:3hhdt49w]<div class="fw" id="{CB}" style="font-family: monospace;"> USE Customer<br /><br /> DATABASE oDbf<br /> </div>[/code:3hhdt49w]
So I had to find another way to use the archives on the local network.
Later I preferred not to deal with this type of connection in order not to run into these errors.
For you first test I wish ask questions:
1) Tdatabase of fwh run ok or have problems ? or I must use anothet tdatabase on commerce..
2) Seeing your source I saw you create at init the index of archives when the app is opened then call
[code=fw:3hhdt49w]<div class="fw" id="{CB}" style="font-family: monospace;">oCustomers := TCustomers<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></div>[/code:3hhdt49w]
but Tcustomer class is linked to another class called Txdata
why this ?
why not make a link directly to tdatabase class ?
wich is the problem ?
3) then you call
[code=fw:3hhdt49w]<div class="fw" id="{CB}" style="font-family: monospace;"> oCustomers:<span style="color: #000000;">last</span> := <span style="color: #ff0000;">"Farley 2"</span> <span style="color: #B900B9;">// change</span><br /> oCustomers:<span style="color: #000000;">save</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// save</span><br /> <span style="color: #0000ff;">msgInfo</span><span style="color: #000000;">(</span>oCustomers:<span style="color: #000000;">last</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// Shows "Farley 2"</span></div>[/code:3hhdt49w]
I understood you change the name " FArley" into "Farley 2"
because then you call oCustomer:save()
but then when I see the message I see "Farley 2" but then on the browse I see allways "Farley"
and not "Farley 2"
it is not saved ?
on this recent topic
<!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?f=3&t=36149&p=215576&hilit=tdatabase#p215576">viewtopic.php?f=3&t=36149&p=215576&hilit=tdatabase#p215576</a><!-- l -->
you use directly tdatabase
[code=fw:3hhdt49w]<div class="fw" id="{CB}" style="font-family: monospace;">oCustomer:= TCustomer<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><br /><br /><br />..<br /><br /><br /><span style="color: #00C800;">CLASS</span> TCustomer <span style="color: #0000ff;">from</span> TDatabase<br /> <span style="color: #00C800;">Method</span> <span style="color: #00C800;">New</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">Endclass</span><br /><br /><span style="color: #00C800;">Method</span> <span style="color: #00C800;">New</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> TCustomer<br /> <span style="color: #00C800;">Super</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span>,<span style="color: #ff0000;">"customer"</span>,<span style="color: #ff0000;">"DBFCDX"</span>,.t.<span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">use</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #B900B9;">// Note: Since you are using DBFCDX, the index file is automatically opened</span><br /> <span style="color: #B900B9;">// and the first index is selected and it is at the first record.</span><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">self</span></div>[/code:3hhdt49w]
as you sad on note the index is automatically opened
what is the difference between calling txdata or calling tdatabase directly? |
dbfs on Network : wich performance method? | Silvio,
[quote:3o406phb]1) Tdatabase of fwh run ok or have problems ? or I must use another tdatabase on commerce..[/quote:3o406phb]
TDatabase has been working fine all along. Perhaps you were making programming errors.
[quote:3o406phb]2) Seeing your source I saw you create at init the index of archives when the app is opened then call
oCustomers := TCustomers():new()
but Tcustomer class is linked to another class called Txdata
why this ? why not make a link directly to tdatabase class ?
[/quote:3o406phb]
I meant to explain this before but I forgot. One of the great things about OOP is that you can move common code up the heirarchy and it is inherited by all the subclasses. If you can write each piece of code only once then you only have to change it once if you need or want to. You also eliminate many lines of code. In this case we only eliminated 2 lines of code in the two individual databases. For example we could have written the customer class like this:
[code=fw:3o406phb]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">Class</span> TCustomers <span style="color: #0000ff;">from</span> TXData<br /> <span style="color: #00C800;">Method</span> <span style="color: #00C800;">New</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">Endclass</span><br /><br /><span style="color: #00C800;">Method</span> <span style="color: #00C800;">New</span><span style="color: #000000;">(</span>lShared<span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> TCustomers<br /> <span style="color: #00C800;">Default</span> lShared := .t.<br /> ::<span style="color: #00C800;">super</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"customer"</span>, lShared<span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">use</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">self</span><br /> </div>[/code:3o406phb]
But we can move these two lines up the tree for each database:
[code=fw:3o406phb]<div class="fw" id="{CB}" style="font-family: monospace;"> <span style="color: #00C800;">Default</span> lShared := .t.<br /> ::<span style="color: #000000;">use</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> </div>[/code:3o406phb]
Because they are going to be used by every database class. So, let's say you have 10 databases, this saves you 20 lines of code. Also, having a base class provides you with one place where you can make changes that will be inherited by all the databases. Just for example, let's say you wanted to add a log of all the dates and times every database was opened. You could add this code to the TXData class and all the databases would inherit it, so all would get logged. Or perhaps you want to add deleted record reuse, then you can add that to TXData and all the databases inherit that feature.
[quote:3o406phb]I understood you change the name " FArley" into "Farley 2" because then you call oCustomer:save().
But then when I see the message I see "Farley 2" but then on the browse I see allways "Farley" and not "Farley 2"
[/quote:3o406phb]
You missed this code:
[code=fw:3o406phb]<div class="fw" id="{CB}" style="font-family: monospace;"> oCustomers:<span style="color: #000000;">last</span> := <span style="color: #ff0000;">"Farley"</span><br /> oCustomers:<span style="color: #000000;">save</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> </div>[/code:3o406phb]
After changing the name to "Farley 2" in the database, I changed it back to the original name so the demo would work every time you run it.
[quote:3o406phb]What is the difference between calling txdata or calling tdatabase directly?[/quote:3o406phb]
I hope I have explained it clearly. I highly recommend that you use a class in between TDatabase and your individual database classes. |
dbfs on Network : wich performance method? | Good
I must make a mother class txdata and then I can make the other classes for customer, articles, ecc.
in these days I have to try to do something with the teachings you gave me
perhap At first, I can converte a my easy prg with these methods |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.