Firebird: folder listing lazarus / 16-Databases ---------------------------------------------------------------------- TRNelson · 2016-03-06 15:56 Hello, I would like to return a file listing for a folder that resides on the Firebird server.  I have found all sorts of suggestions but I have been unable to get any of them to work in Firebird.  The option that shows the greatest potential is similar to: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i INSERT DirectoryListing (subdirectory, depth, isfile) EXEC xp_dirtree 'c:\somefolder',10,1; That is probably over simplifying the process and I have been unable to get this to work.  Maybe this is not the route to go.  I have seen other examples that are not nearly so concise.  I would like to incorporate the code into my program. ---------------------------------------------------------------------- balazsszekely · 2016-03-06 17:15 AFAIK you cannot access the filesystem directly from firebird server(other then the actual database). If this would be true, any system with firebird installed would be easily compromised. ---------------------------------------------------------------------- taazz · 2016-03-06 17:22 Quote from: GetMem on March 06, 2016, 06:15:36 pmAFAIK you cannot access the filesystem directly from firebird server(other then the actual database). If this would be true, any system with firebird installed would be easily compromised. not if the stored procedure that returned the file list require admin rights to execute. It is part of MSSQL server from version 2000 if I remember correctly. ---------------------------------------------------------------------- TRNelson · 2016-03-06 17:40 Quote from: taazz on March 06, 2016, 06:22:24 pmQuote from: GetMem on March 06, 2016, 06:15:36 pmAFAIK you cannot access the filesystem directly from firebird server(other then the actual database). If this would be true, any system with firebird installed would be easily compromised. not if the stored procedure that returned the file list require admin rights to execute. It is part of MSSQL server from version 2000 if I remember correctly. Yes, I believe this is correct and have come across numerous examples.  None of them seem to work on Firebird though.  Or maybe they do and I don't know how to implement them. ---------------------------------------------------------------------- balazsszekely · 2016-03-06 17:42 @taazz MSSQL is a different beast, in my opinion you cannot access the file system with firebird, but I want to keep an open mind about this, maybe there is a way after all. Waiting for solutions... ---------------------------------------------------------------------- SymbolicFrank · 2016-03-10 11:09 The easiest way is probably to make your own UDF.DLL that does it. ---------------------------------------------------------------------- mbdev · 2016-03-10 11:32 You could solve the problem like this: http://ibexpert.net/ibe/index.p hp?n=Doc.IBExpertFileSystemInventoryTipsAndTricks ---------------------------------------------------------------------- balazsszekely · 2016-03-10 12:20 Quote@SymbolicFrank The easiest way is probably to make your own UDF.DLL that does it.Yes, this is a possible solution, though not something firebird natively does. Quote@mbdev You could solve the problem like this: http://ibexpert.net/ibe/index.p hp?n=Doc.IBExpertFileSystemInventoryTipsAndTricksThose are the features of IBExperts IBEBlock scripting not firebird. ---------------------------------------------------------------------- taazz · 2016-03-10 12:23 Quote from: GetMem on March 06, 2016, 06:42:13 pm@taazz MSSQL is a different beast, true but it is the perfect example of the feature asked. Quote from: GetMem on March 06, 2016, 06:42:13 pmin my opinion you cannot access the file system with firebird, As far as I know there is nothing ready made that would allow you to do so. Quote from: GetMem on March 06, 2016, 06:42:13 pmbut I want to keep an open mind about this, maybe there is a way after all. Waiting for solutions... The easy way out is to create a UDF that will read from the firebird config file the default data directory and allow the user to ask information about it. Sorry I have nothing ready to share never needed that ability with firebird so far. ---------------------------------------------------------------------- balazsszekely · 2016-03-10 12:38 Quote@taazz Sorry I have nothing ready to share never needed that ability with firebird so far.Actually I don't need this feature, I was only curious if it can be done natively with firebird. ---------------------------------------------------------------------- SymbolicFrank · 2016-03-10 13:07 Making a Firebird UDF DLL/so is quite easy. In the lpr, you list the exports, like so: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i exports  udf_version,  .. Declare them like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function udf_version: PChar; cdecl; export; and use the Firebird memory manager to pass strings and other blocks of data, like so: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function ib_util_malloc(Amount: Integer): Pointer; cdecl; external 'ib_util.dll'; function StrToP(s: string): PChar;begin  Result := ib_util_malloc(Length(s) + 1);  StrPCopy(Result, s);end; function udf_version: PChar; cdecl;begin  Result := StrToP('1.0.0');end;