Forum > Database

[gdbm] - Access Violation masquerading as another Exception, needs resport?

(1/1)

Gustavo 'Gus' Carreno:
Hey Y'all,

I've been playing around with the GNU DBM key/value pair database.

You can find some examples on how to do it under the FPC source on the packages/gdbm/examples folder.
As a disclaimer I haven't compiled nor ran those examples.

Nonetheless, I did copy the code, almost verbatim to my TestGNUDBM playground project.

The issue is that on the line that retrieves the last of the keys with gdbm_nextkey() it throws and Access Violation exception.


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---try  key:= gdbm_nextkey(FDB, key);except  on E: Exception do  begin    memLog.Append(Format('ERROR: %s', [E.Message]));    memLog.Append('Need to report this error triggered on the last entry');    key:= '';  end;end;
In debug, if you continue running the program it then issues another exception with the following text -ish:


--- Code: Text  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---### Not supported on GDB < 5.3 ###
Can the experts please tell me if this is a known issue so I don't duplicate an issue posting?

At the moment I'm gobbling up the exception so my code doesn't completely break, as you can see on the GitHub repo source code.
I would like not to have to do it. Even if traversing the whole database is not the most common way to use a key/value pair store.

Cheers,
Gus

marcov:
Sounds to me as the gdbm header is outdated. There is not much use of gdbm, so that wouldn't surprise me. Most people opt for postgres, firebird, mysql or sqlite

Gustavo 'Gus' Carreno:
Hey Marco,


--- Quote from: marcov on June 17, 2022, 11:11:06 am ---Sounds to me as the gdbm header is outdated.

--- End quote ---

Thanks! So what should I do next?


--- Quote from: marcov on June 17, 2022, 11:11:06 am ---There is not much use of gdbm, so that wouldn't surprise me. Most people opt for postgres, firebird, mysql or sqlite

--- End quote ---

I completely agree with you, but when you're messing about with pure key/value pair databases, Free Pascal is rather lacking support on the new kid on the block: LevelDB.

To be honest, GDBM was the only thing supported out of the box :)

Cheers,
Gus

Navigation

[0] Message Index

Go to full version