Jump to content

Recommended Posts

Posted (edited)

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.zipFetching info...

Edited by jpam
update
Posted (edited)

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:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

@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?

Posted
  On 12/29/2015 at 11:00 PM, 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?

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

  On 12/29/2015 at 11:06 PM, JohnOne said:

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:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

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:

  Reveal hidden contents

Signature last update: 2023-04-24

  • 2 weeks later...
Posted (edited)

update 09-01-2016:

added foxpro 2.x and visual foxpro read support

added foxpro 2.x .fpt memo read support

added visual foxpro .fpt memo read support

download at 1st post

Edited by jpam
  • 8 months later...
Posted (edited)

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
  • 2 weeks later...
Posted

@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

 

 

 

  • 2 months later...
Posted

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.

  • 1 month later...
Posted (edited)
  On 12/29/2015 at 11:00 PM, 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?

Expand  

Is there any chance to share the masm code?

Edited by Andreik
  • 1 year later...
Posted

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.

Posted

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:

  Reveal hidden contents

Signature last update: 2023-04-24

  • 3 years later...
Posted
  On 1/5/2017 at 2:05 PM, 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.

Expand  

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.

Posted (edited)

@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

"I think you are searching a bug where there is no bug... don't listen to bad advice."

  • 2 weeks later...
Posted

Thank you so much, that works great.

Now I've come across another issue. If a record is marked as deleted, it still comes up with the search or GetSubRecord. Is there a way to tell is a record is marked as deleted?

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
  • Recently Browsing   0 members

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