funkey Posted October 19, 2012 Share Posted October 19, 2012 (edited) Hello, I needed to read and write dBase files. so I searched the internet and found the shapelib library (http://shapelib.maptools.org/). I compiled the DBF part of it to make a small DLL and build some wrapper functions around it. Function description is here: http://shapelib.maptools.org/dbf_api.html. I know this can be done with COM, but I hope DLL version is faster than it and faster than SQLite. But I haven't done testing yet. Maybe someone needs this UDF. Download: http://autoit.de/index.php/Attachment/16455-DBF-rar/ BR funkey Edit: Added examples Edited October 18, 2014 by funkey JScript and VelvetElvis 2 Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
ldub Posted October 19, 2012 Share Posted October 19, 2012 Thanks a lot, your UDF is very nice and useful. Some more examples, just for pleasure ? Link to comment Share on other sites More sharing options...
funkey Posted October 19, 2012 Author Share Posted October 19, 2012 I'm glad you like it. Another example: #include <Array.au3> #include <Date.au3> #include "DBF.au3" Global $hDBF = _DBF_Create("Test.dbf") If $hDBF = 0 Then ConsoleWrite("Error creating dbf file ..." & @CRLF) Exit EndIf _DBF_AddField($hDBF, "ID", $DBF_FTInteger, 10, 0) _DBF_AddField($hDBF, "Time", $DBF_FTString, 24, 0) _DBF_AddField($hDBF, "Value1", $DBF_FTDouble, 10, 3) _DBF_AddField($hDBF, "Value2", $DBF_FTDouble, 10, 3) _DBF_AddField($hDBF, "Value3", $DBF_FTDouble, 10, 3) _DBF_AddField($hDBF, "Value4", $DBF_FTDouble, 10, 3) For $i = 1 To 100 _WriteValues($hDBF) Next Global $aDBF = _DBF_DBFToArray($hDBF) _DBF_Close($hDBF) _ArrayDisplay($aDBF) Func _WriteValues($hDBF) $iRecords = _DBF_GetRecordCount($hDBF) _DBF_WriteIntegerAttribute($hDBF, $iRecords, 0, $iRecords + 1) _DBF_WriteStringAttribute($hDBF, $iRecords, 1, _Now() & "." & @MSEC) _DBF_WriteDoubleAttribute($hDBF, $iRecords, 2, Random(1, 100)) _DBF_WriteDoubleAttribute($hDBF, $iRecords, 3, Random(1, 100)) _DBF_WriteDoubleAttribute($hDBF, $iRecords, 4, Random(1, 100)) _DBF_WriteDoubleAttribute($hDBF, $iRecords, 5, Random(1, 100)) EndFunc JScript 1 Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
JScript Posted October 19, 2012 Share Posted October 19, 2012 (edited) I unfortunately do not know much about SQL, I am of the age of CA-Clipper + DBF Your UDF made me very happy, thank you! 5* JS Edited October 19, 2012 by JScript http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
funkey Posted October 19, 2012 Author Share Posted October 19, 2012 Thank you JScript! I added a few functions to the UDF and some more examples. Download link in post #1. Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
JScript Posted October 19, 2012 Share Posted October 19, 2012 Better yet, thanks! JS http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
ldub Posted October 20, 2012 Share Posted October 20, 2012 Memos are not displayed Accented characters are not recognized. Is there a solution? Link to comment Share on other sites More sharing options...
BasicOs Posted October 20, 2012 Share Posted October 20, 2012 (edited) Hi,Congrats for the Autoit port.There is my port also http://www.emesn.com/autoitforum/viewtopic.php?t=4 using no dll but dbase.exe (DBase III, IV,5) as a wrapper, so in a higher logical level.You would not realize if it is a DLL-BASED, or a wrapper-based one. Very quick, and this app makes dbase.exe modifying dbf files. It has also the BIG advantage that you can embebe several lines of "DBASE CODE SOURCE" directly and it works:I mean you can PORT and use nice commands like thin in AUTOIT, so mixing both languages .USE MYDBLIST FIELDS, etc....In two lines you make a lot of things. That is outdated but it works perfectly.I got an error in your dll-app opening a dbf. I send it here.I used your sample number 3 with a select file dialog, it is supossed to open an ArrayDisp(),If you please, take a look at the file it is a file with a couple of records,Thanks for the TOPICSaluPD: If somebody uses DB4 files. Pls send me in an attached file in a PM, as I wanted to test my library with this newer version. Edited October 20, 2012 by BasicOs Autoit.es - Foro Autoit en Español Word visitors Image Clustrmap image: - Football Spanish team - Spanish team: Casillas, Iniesta, Villa, Xavi, Puyol, Campdevilla, etc..Programando en Autoit+Html - Coding Autoit-Html - Arranca programas desde Internet - Preprocesador de Autoit a http Link to comment Share on other sites More sharing options...
funkey Posted October 29, 2012 Author Share Posted October 29, 2012 @ldub: Sorry, Shapelib does not support Memo fields. And I never used them too. But I think I reading memo fields could be easily implemented by someone better than me in C language. @BasicOS: Thanks for your comment. I cannot download your files from that link and nothing is attached to your post, sorry. Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
jpam Posted October 29, 2012 Share Posted October 29, 2012 as far i can see,the functions DBFAddField() and DBFGetFieldInfo() are not correct.the manual says;pszFieldName: The name of the new field. At most 11 character will be used.In order to use the xBase file in some packages it may benecessary to avoid some special characters in the field namessuch as spaces, or arithmetic operators.pszFieldName: If this pointer is not NULL the name of the requested fieldwill be written to this location. The pszFieldName buffershould be at least 12 character is size in order to holdthe longest possible field name of 11 characters plus aterminating zero character.it should be 10 characters zero terminatedso if you write a fieldname bigger then 10 characters your offset is wrong for the next item (Field type)who start at byte 11 in the fieldtablei hope its only wrong in the manual and not the dlljpam Link to comment Share on other sites More sharing options...
BasicOs Posted November 7, 2012 Share Posted November 7, 2012 (edited) @BasicOS: Thanks for your comment. I cannot download your files from that link and nothing is attached to your post, sorry.HERE is serie.dbf to check it.. Does somebody still use dbase IV?https://www.dropbox.com/sh/i95ks7jrrw9lix9/X85R44_-wvSalu2PD: SEE ATTACHED FILEplease say if dropbox link worked, thanksserie.zip Edited November 7, 2012 by BasicOs Autoit.es - Foro Autoit en Español Word visitors Image Clustrmap image: - Football Spanish team - Spanish team: Casillas, Iniesta, Villa, Xavi, Puyol, Campdevilla, etc..Programando en Autoit+Html - Coding Autoit-Html - Arranca programas desde Internet - Preprocesador de Autoit a http Link to comment Share on other sites More sharing options...
funkey Posted November 7, 2012 Author Share Posted November 7, 2012 Your dropbox link works. serie.dbf works fine with my DBF-UDF. It has one record with only 1234 in the first column. Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
VelvetElvis Posted November 8, 2012 Share Posted November 8, 2012 Hi,Congrats for the Autoit port.There is my port also http://www.emesn.com/autoitforum/viewtopic.php?t=4 using no dll but dbase.exe (DBase III, IV,5) as a wrapper, so in a higher logical level.Hi. Tried your link, but it's coming back 404. Link to comment Share on other sites More sharing options...
BasicOs Posted November 12, 2012 Share Posted November 12, 2012 (edited) @funkey thanks for checking I will review it other way...Hi. Tried your link, but it's coming back 404.Sorry, server was down under maintenance now is working. Remember that this port uses DBASE files, you have to copy in same directory of your autoit APP, dbaseIII or dbaseIV files. I cannot provide with port as they are propietary software. It reuses dbase.exe to work all at as a kind of command "wrapper". That has cons and pros, one pro is that can reuse old dbase language inserting macros-like LINES OF dbase CODE, it will reuse dbase.exe for this execution. E.G.for output to printer, to file, etc...Salu22:) Edited November 12, 2012 by BasicOs Autoit.es - Foro Autoit en Español Word visitors Image Clustrmap image: - Football Spanish team - Spanish team: Casillas, Iniesta, Villa, Xavi, Puyol, Campdevilla, etc..Programando en Autoit+Html - Coding Autoit-Html - Arranca programas desde Internet - Preprocesador de Autoit a http Link to comment Share on other sites More sharing options...
wysocki Posted May 28, 2014 Share Posted May 28, 2014 Sorry to reopen an old post, but it's still relevant! BasicOS: Your link takes me to a spanish language page which, unfortunately is one of the few languages I don't work with! Funkey: I got a job "fixing" an old Clipper program that I wrote in 1997 that now won't run on Windows 8! Your routine checks out on Win8 so I'm excited to see if I can do the conversion using this. Thanks a million! Link to comment Share on other sites More sharing options...
Skysnake Posted May 28, 2014 Share Posted May 28, 2014 .DBF may be ancient, but MS bought FoxPro not too long ago and you would be surprised at how many dBase/DBF installations are out there. Thank you very much for this. Is it possible to bump the two downloads (the one from VelvetElvis's link) to the top of this page? Just to make access and download easier? As time goes by access to tools like these will become more and more important. Thank you for sharing! Skysnake Why is the snake in the sky? Link to comment Share on other sites More sharing options...
Danp2 Posted May 28, 2014 Share Posted May 28, 2014 .DBF may be ancient, but MS bought FoxPro not too long ago and you would be surprised at how many dBase/DBF installations are out there. 1992 isn't exactly recent history. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
mesale0077 Posted October 17, 2014 Share Posted October 17, 2014 Hello, I needed to read and write dBase files. so I searched the internet and found the shapelib library (http://shapelib.maptools.org/). I compiled the DBF part of it to make a small DLL and build some wrapper functions around it. Function description is here: http://shapelib.maptools.org/dbf_api.html. I know this can be done with COM, but I hope DLL version is faster than it and faster than SQLite. But I haven't done testing yet. Maybe someone needs this UDF. Download: http://www.autoit.de/index.php?page=Attachment&attachmentID=16455&h=ef6c61696ff0d78b2a904e988e53c570ac275855 BR funkey Edit: Added examples new link please Link to comment Share on other sites More sharing options...
funkey Posted October 21, 2014 Author Share Posted October 21, 2014 new link please Done. German forum software version changed and so the links to there changed too. Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
HernanCano Posted June 17, 2015 Share Posted June 17, 2015 Hi, friends.I want the download, but it directs to a german page that says:Sie haben einen ungültigen oder nicht mehr gültigen Link aufgerufen.But I don´t know what means.Please help. ThanksHERNAN CANO M. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now