Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Launching application from a database

Tags:

delphi

I have many users using my application. However if I do some update, which I put on the server, not all of them are willing to update it (they sometimes afraid of changes they do not want to accustom).

So I speculate, how to force them to launch the latest application. There are surely several ways how to do it, but I have heard, that it is possible to launch an application stored in a blob field of a database.

Does anybody knows how it can be accomplished? (I am using MySQL database)

thanx

like image 610
lyborko Avatar asked Jan 08 '13 00:01

lyborko


People also ask

Which database is used for application?

PostgreSQL. A unique relational database, PostgreSQL is the best database for Android and iOS apps. Developers can customize this database as they want; that's why it's the most preferred mobile app database.

What can applications use to interact with a database?

SQL. The database server applications interface is accessed using SQL. It's a standard query language that's used to define and manipulate databases and data, and it's supported by all popular database servers.

Can we create application using SQL?

To start creating an app with your SQL data, you need to go to the Open as App wizard. After your initial sign up, you will be asked to choose your data source. At this stage, you need to select the “MS SQL, MySQL, REST” option from the menu. Open as App also supports PostgreSQL.


2 Answers

Without judging on meaningful or nonsense ....
You could use uExecFromMem .....
There is a Memoryleak in this unit which can be fixed by adding:

  ResumeThread(PI.hThread);
  Result := PI.hThread;
  FreeMem(pFile);  // added here
end; 

an example call using a TBlobField would be

var
 ms:TMemoryStream;
begin
    ms:=TMemoryStream.Create;
    try
    TBlobField(YouDBBlobField).SaveToStream(ms);
    ms.Position := 0;
    ExecuteFromMem(Application.ExeName,'',ms.Memory); // pointing to an existing executable
    finally
      ms.Free;
    end;
end;
like image 185
bummi Avatar answered Sep 30 '22 06:09

bummi


My advice is to use libraries.

You can have a small main executable file (some kind of "launcher"), which won't do nothing but launch external .dll fields. Just like a kernel does load modules at runtime (think about how Windows or Linux work).

Then you download an updated version of a .dll, stop and unload the old one, then load and initialize the new version.

Of course, your code has to be "clean", with proper startup and shutdown functions for each .dll.

But I suspect it would be much less error prone than ExecuteFromMem(). In this respect, good old load + execute of an .exe file (as Remy suggested) sounds like a much better option to me.

like image 32
Arnaud Bouchez Avatar answered Sep 30 '22 06:09

Arnaud Bouchez