INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Why are Del##.MB and _QSQ## files created in Delphi6 Enterprize.?
2

Why are Del##.MB and _QSQ## files created in Delphi6 Enterprize.?

Why are Del##.MB and _QSQ## files created in Delphi6 Enterprize.?

(OP)
My OS is MS-XP.Prof

Upon compiling my Projects I perpetually have these files created and accumulate in the Target Directory until I get "Memory exceeded" exception which needs to be deleted before I am able to continue.

Whilst creating a time-consuming nuisance to delete I have no idea of what use, if any,
these files are or can be put.

How can creation of these files be prevented?

Thanks in advance.

Old Man Delphi

RE: Why are Del##.MB and _QSQ## files created in Delphi6 Enterprize.?

These are temporary files created by the TQuery component.
You must configure the DBE to put these files in a sensible temporary location (like c:\temp).
At runtime you can set Session.PrivateDir for this purpose.
Or stop using the DBE all together, it is old and obsolote...

/Daddy

-----------------------------------------------------
Helping people is my job...

RE: Why are Del##.MB and _QSQ## files created in Delphi6 Enterprize.?

(OP)
Thanks for that! bigsmile I note and respect your advice to stop using the DBE but I am relying upon it so extensively on Paradox tables not keen to fix things that aren't broke. Having said that I suspect I should walk away from the Paradox Tables which have a nasty habit of crashing the Index. I guess I should re-engineer my projects to be totally SQL reliant. Which raises other questions. Starting with HOW would I set about doing that without using the DBE. Another forum.bigears

Old Man Delphi

RE: Why are Del##.MB and _QSQ## files created in Delphi6 Enterprize.?

(OP)
Please forgive me if this is an imposition.

Could you please be more specific with some code as to how and where I would put this in my application to be effective in Runtime?

Thanks in advance whosrdaddy

Old Man Delphi

RE: Why are Del##.MB and _QSQ## files created in Delphi6 Enterprize.?

You can configure the PrivateDir in the BDE setup or at runtime.

/Daddy

-----------------------------------------------------
Helping people is my job...

RE: Why are Del##.MB and _QSQ## files created in Delphi6 Enterprize.?

(OP)
I refer to a previous response to this post which inter alia reads as follows ..

"The other approach is to assign a hard coded path to Session.PrivateDir.
Uses Windows, DBTables" .. which I undersstand

Whilst I remain most grateful for this advice which has earned the responder a well-deserved star I would be equally grateful if someone would be so kind as to please elaborate, for this
mere mortal, EXACTLY HOW AND WHERE an "const" and "appropriate place" might be to include this code in my Project.

"const
temp_path_len = 512;
var
temp_path: array[1 .. 512] of char;

//
// Place this code snippet at the
// approriate place in the code
//
GetTempPath(temp_path_len, @temp_path);
Session.PrivateDir := StrPas(@temp_path);

//
// or
//
// Session.PrivateDir := 'C:Temp';

Thanks in advance.

Old Man Delphi

RE: Why are Del##.MB and _QSQ## files created in Delphi6 Enterprize.?

It depends on the type of application really.
If it is just a forms application, I would do this init function in the OnCreate event of the main form.

/Daddy

-----------------------------------------------------
Helping people is my job...

RE: Why are Del##.MB and _QSQ## files created in Delphi6 Enterprize.?

CODE

Unit <myunitname>;

interface

uses ...

const
   temp_path_len = 512;

type
  TForm1 = class(TForm)
    ...
     procedure FormCreate(Sender: TObject);
  private
    function GetTempDirectory: String;
  public

  end;

var
  Form1: TForm1;

implementation

  ...

procedure TForm1.FormCreate(Sender: TObject);
var
  TempDirectory: String;
begin
  TempDirectory := GetTempDirectory;
  if DirectoryExists(TempDirectory) then
    Session.PrivateDir := TempDirectory
  else
    //Directory doesn't exist.
    //you can use ForceDirectories(TempDirectory) to create it.
    //but in Win7 and greater you may need elevated user access rights to do so.
end;

function TForm1.GetTempDirectory: String;
var
  temp_path: array[1..temp_path_len] of Char;
begin
  GetTempPath(temp_path_len, @temp_path);
  Result := StrPas(@temp_path);
end; 

GetTempPath returns back the directory associated with the temp directory environment variable - no guarantee that the directory actually exists nor are you guaranteed to actually have write access to that directory. I didn't code to test write access, but you can easily add that if you feel the need to do so by writing and then deleting a file in the directory.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close