Jump to content

dBase udf and dll


jpam
 Share

Recommended Posts

hi forum peoples

for people that are using dBaseIII and dBaseIV database files

i want to share my dbase dll + udf that i wrote for one of my projects

the dll supports;  

open/create/read/write dbaseIII dbf files

open/create/read/write dBaseIV dbf files

open/create/read/write dbaseIII dbt memo files

open/create/read/write dBaseIV dbt memo files

most basic functions are in the dll

more functions wil be added when needed

dll ,udf and several samples are included in zipfile

Have fun

Jpam

 

update;

udf has now standard function headers

changed Opt("OnExitFunc", "Close_DLL") to OnAutoItExitRegister("Close_DLL")

update 02-01-2016:  

added fast powerfull case-insensitive search() function to dll with wildcard support

update 09-01-2016:  

added foxpro 2.x and visual foxpro read support

added foxpro 2.x fpt memo read support

added visual foxpro memo read support

dbasedll.zip

Edited by jpam
update
Link to comment
Share on other sites

QUESTIONS: Who is the license owner for attached DLL ? What type of license is for this DLL ?

btw.

Pretty good UDF
One remark: for the functions header use the standard headers you can  add this using  SciTE4AutoIt by pressing CTRL+ALT+H

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

@mLipok

no licenses on this dll, wrote it myself in masm v10

SciTE4AutoIt by pressing CTRL+ALT+H does nothing in my editor

can you give me an example for a standard header?

Which Editor (Name+Version) currently you are using ?

Never knew about that either, you have to click on function first.

To be more precicely, just go to the line with function name declaration , and press CTRL+ALT+H
But you must install SciTE4AutoIt - Jos version you can find it here:

https://www.autoitscript.com/site/autoit-script-editor/downloads/

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

If you mean SciTE it is very old version.
I think that you are using the editor supplied with AutoIt installer.

 

I encourage you to download and install a version with this link:
https://www.autoitscript.com/site/autoit-script-editor/downloads/

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

  • 2 weeks later...
  • 8 months later...

Thank you for making this, it helps me a lot in my project.

I have run into an issue I'm hoping you can help with -- Pack($hDbf) just locks the program up. All other file operations seem to operate as needed; I can create a DBF from scratch, add records, read records, and mark records as deleted without any major issue. However, a Pack operation doesn't succeed and I need this big time. The program becomes unresponsive and requires forced closure. The record in the DBF is still there and marked as deleted. Can you recommend a way past this? Here is a sample snippet of code that does cause an unresponsive application on my side (the file does exist and has records marked for deletion):

#include <dBase.au3>

$hDbf = OpenDBF(@ScriptDir & "\_agents.dbf")
Pack($hDbf)
CloseDBF($hDbf)

Also, there seems to be a limit on length of large file names and large field names. Is this by design or is there possibly something wrong on my side? OS: Win 7 Professional x64. The following snippet produces a filename "eislarge.dbf" with a single field named "thisfieldn":

#include <dBase.au3>

$hDbf = CreateDBF("_thisfilenameislarge.dbf", $DBASEIII)
AddField($hDbf, "thisfieldnameislarge", "C", 20, 0, 0, 0)
CloseDBF($hDbf)

And if I can be so bold as to add a request -- if possible, ability to detect if a record has been marked as deleted would be useful. I would like to use this in conjuction with (or within) the GetSubRecord function. Or, is there some way of getting this information that I'm not seeing?

Edited by jwurmz
Link to comment
Share on other sites

  • 2 weeks later...

@jwurmz

dbf filenames are 8.3 dos style, its by design.

fieldnames are 10 char zero terminated, it's allso by design.

the GetSubRecord function skips the first byte of the record, that is the record delete mark.

IsRecordDeleted() missing function :)

The pack function was tested many times, but mybe there is still a bug in the code :)

i have to dig up the source code

next week i have some spare time to look into it.

kind regards

jpam

 

 

 

Link to comment
Share on other sites

  • 2 months later...

Hello

I would like to use this library, but Search()

Search($_hBase, $_pStr, $_fld, $_pBuf, $_len)

function doesn't work as expected. I am trying to define third parameter ("field number"), but then there is no results and function returns -1. 

Any ideas? Best Regards.

Link to comment
Share on other sites

  • 1 month later...
On 12/30/2015 at 1:00 AM, jpam said:

@mLipok

no licenses on this dll, wrote it myself in masm v10

SciTE4AutoIt by pressing CTRL+ALT+H does nothing in my editor

can you give me an example for a standard header?

Is there any chance to share the masm code?

Edited by Andreik

When the words fail... music speaks.

Link to comment
Share on other sites

  • 1 year later...

Hi 

sorry for my english.

After strart example CreateDbaseIII.au3  :

Console :

"C:\Program Files (x86)\AutoIt3\Include\dBase.au3" (42) : ==> Subscript used on non-accessible variable.:
return $__hDbf[0]
return $__hDbf^ ERROR

 

Where is problem?

Thx for answer.

Link to comment
Share on other sites

In line number 42.

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

  • 3 years later...
On 1/5/2017 at 6:05 AM, mayestik said:

Hello

I would like to use this library, but Search()

Search($_hBase, $_pStr, $_fld, $_pBuf, $_len)

function doesn't work as expected. I am trying to define third parameter ("field number"), but then there is no results and function returns -1. 

Any ideas? Best Regards.

I am also trying to use this function but can't get it to work with any value other than -1 for $_fld.

From the dbase.au3 header on Seach: $_fld - is protected in the dll for a valid field number , Search() will fail with error -1

This may have something to do with it but I'm not able to figure it out. 

I know this is an old post, but the software I've "inherited" is based on FoxPro and this UDF has made my life so much easier.

Link to comment
Share on other sites

@Holmesware Unfortunately OP didn't show for years and as his dll code has been kept secret...

Anyway, I tried the following and it seems to work fine, without calling his Search() function (which accepts only -1 as third parameter as you noticed, -1 means search in any column) but sometimes (many times !) we would like to search only in one column and return the rows matching that column.

To achieve this, I commented the following lines in OP's file Search.au3 :

;~    $Array = DllStructCreate("DWORD[1000]") ; 1000 rows returned (max) in my case
;~    $recCnt = Search($hDbf, "*4.9400", -1, DllStructGetPtr($Array), DllStructGetSize($Array))

;~    If $recCnt >0 Then

;~     $recNr   = 1
;~     $fldNr   = 0
;~     $index   = 0
;~     $subitem = 0

;~     _GUICtrlListView_BeginUpdate($g_idListView)

;~     Do
;~        $rec = GetSubRecord($hDbf, DllStructGetData($Array,1,$recNr), $fldNr)
;~        GUICtrlCreateListViewItem($rec, $g_idListView)

;~        Do

;~           $rec = GetSubRecord($hDbf, DllStructGetData($Array,1,$recNr), $fldNr)
;~           _GUICtrlListView_SetItem($g_idListView, $rec, $index, $subitem)

;~           $fldNr   += 1
;~           $subitem += 1

;~        Until $fldNr = $fldCnt

;~        $recNr  += 1
;~        $fldNr   = 0
;~        $index  += 1
;~        $subitem = 0

;~     Until $recCnt == $index

;~     _GUICtrlListView_EndUpdate($g_idListView)

;~    EndIf

And placed these lines instead :

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   Local $fldNr = 0 ; 1st column = 0
   Local $vSearch = 1000.55
   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   Local $iIndex = - 1 ; keep it always - 1

   For $i = 0 To GetRecordCount($hDbf) - 1
       If StringInStr(GetSubRecord($hDbf, $i, $fldNr), $vSearch) > 0 Then
            $iIndex += 1 ; 0+ (first row got index 0)
            If $iIndex = 0 Then _GUICtrlListView_BeginUpdate($g_idListView)
            GUICtrlCreateListViewItem("", $g_idListView)
            For $j = 0 To $fldCnt - 1               
                _GUICtrlListView_SetItem($g_idListView, GetSubRecord($hDbf, $i, $j), $iIndex, $j)
            Next
        EndIf
    Next

    If $iIndex > -1 Then _GUICtrlListView_EndUpdate($g_idListView)

The 2 lines where you indicate the searched column and what you're searching for are these ones :

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   Local $fldNr = 0 ; 1st column = 0
   Local $vSearch = 1000.55
   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Now in case you want, from time to time, search again in any column, then you could rework the whole code and, when $fldNr = - 1, switch back to OP's code etc...

Timers showed same speed as OP's Search function in the dll (based on a dbf of 1000 rows and 64 cols)

Good luck
 

Edited by pixelsearch
Link to comment
Share on other sites

  • 2 weeks later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...