Forums

Find answers, ask questions, and connect with our
community all around the world.

Home Forum Omnis General Forum Easy way to send library WITH database?

Tagged: 

  • Easy way to send library WITH database?

    Posted by Uwe Smidt on February 5, 2023 at 11:18 am

    Dear $all,

    is there an easy way to send someone else your application (i.e. library, database structure & data) as a complete package, ideally self-contained & ready to run?

    This question arises to me when asking for support at Omnis, and sometimes they ask me to send either a prototype app of the isolated problem, or the whole library. But without the database (in my case Postgres) some problems may not be reproduced without a running database. However, setting up my database is asking too much – so is there a way to ‘pre-package’ that maybe in SQLite or to containerize it?

    Thanks for any ideas!

    Best regards

    Uwe

    Vik Shah replied 1 year, 1 month ago 6 Members · 7 Replies
  • 7 Replies
  • Andreas Pfeiffer

    Administrator
    February 6, 2023 at 9:41 am

    Hello Uwe,

    It is possible to store any binary information in the $userinfo of a class i.e.

    Say you want to show a problem that occurs in a certain remote form with a data grid and you need to have your data in a list to show this. You can do the following:

    1. Copy the remote form into a new library. You can do this using drag&drop.

    2. Put a breakpoint in your original library after the data have been loaded into the list variable.

    3. When the code stops at the breakpoint and the list is loaded add a line of code to copy the list into the $userinfo of the class that is in the other library:

    Do $libs.newLibrary.$classes.myRemoteForm.$userinfo.$assign(iDataList)

    Save class newLibrary.myRemoteForm

    Note that we do not want to store the list data into the class of the current library. The command “save class” ensures that the change is written back to the hard drive. Alternatively you could have left the class open in design mode and hit the “save” button to save the class.

    4. Finally comment out the code that loads the list in the remote form that is now in the new library and add a new line to it so that it copies the data from the $userinfo property of the class back into the list:

    Calculate iDataList as $cinst.$class().$userinfo

    You might need to add an empty remote task to make the remote form working in the new library. Also make sure to remove the line of code in your original library that copies the data over to the $userinfo property in the class of the other library.

    5. Test if the remote form runs now from within the new library and if you are able to reproduce the original problem there.

    I hope this helps!

    Best regards,

    Andreas

  • Uwe Smidt

    Member
    February 7, 2023 at 4:31 pm

    Dear Andreas,

    Thank you for your prompt and comprehensive answer!

    I assume your solution works fine for an isolated problem in one form.

    But if the problem is more complex or difficult to locate in an application/library, it may become more economic to include the whole database for the troubleshooting, as opposed to rebuilding parts of an application into a stand-alone prototype to reproduce the problem.

    Therefor I look for an approach to include the database structure & data along with the library.

    But I assume there is no such easy way with little effort on the sending and receiving side. Instead, probably doing a database dump and sending it along side, plus a dialog to edit connection parameters, is the better way…

    Thank you anyway

    Best regards

    Uwe

    • This reply was modified 1 year, 7 months ago by  Uwe Smidt.
  • Andreas Pfeiffer

    Administrator
    February 9, 2023 at 8:03 am

    Hi Uwe,

    There is probably no easy way. And even then somebody would need to extract the problem.

    So in some cases it is worth trying to break the part out where the problem is. In some cases that leads to find out what is going wrong if it is a logical error for example. And if the problem still exists then it is easier to present this to the Omnis support team.

    Best regards,

    Andreas

  • Phil Potter

    Member
    June 8, 2023 at 1:23 pm

    Uwe,

    Have you considered using the library as an Omnis datafile?

    Connecting to it using Omnis SQL, then you can then add the schemas and data that is required to recreate the problem…

    Phil.

  • Doug Easterbrook

    Member
    June 9, 2023 at 1:48 pm

    hi Uwe:

    I agree, I’ve submitted a number of issues to tech support. and they fall into two categories:

    1. those that can be isolated — and if you can do it in a few lines of code, it is good for both tech and ourselves. Those problems tend to be somewhat simple. I do it when I can.
    2. those that CANNOT be isolated and need the entire app plus data

    I know thats self evident. But complex problems that are multi layered need the entire system and a set of steps to reproduce it. Since we don’t always know if the problem is in the DAM, the UI, the code, some function within the code, IP based problems, the actual contents of the data, what have you — the full environment that shows the problem is best.

    I have three thoughts on recreating the environment:

    1. The support team at omnis UK know how to restore a postgres database – because they’ve done that for me in the past a number of times. So, send them the database and the pg_restore command, along with the sql to create for any user that needs to be created (we have a common user, so I send that SQL)
    2. set up a postgres server that can be accessed across the internet. Open port 5432, set the pg_hba.conf to allow access from Omnis, and then you keep your data, but allow access to the database remotely.
    3. put the database into a docker container and send that

    I would not rewrite your app to use some other sorts of data repositories or data access mechanisms because that fundamentally changes the nature of the problem.

    the Omnis support team is GOOD.

    accessing your database remotely (#2 above) should be no problem and is my preferred solution since I can set up a database for each problem if I need to so that the data is static for that problem.

    It has a benefit that if support can see the issue, you can test and verify any solution you are given.

    thats just my thoughts. Omnis is Client Server, or web services. The database doesn’t have to be delivered all the way to support in order for it to be accessed. It just needs to be accessible via an IP address. The database server can be on local or remote, it shouldn’t matter one bit (other than if its a performance related interaction, but then you’d find that yourself if you tried your database remotely before you sent the bug in.

  • Sarah White

    Member
    August 8, 2023 at 1:36 pm

    If your application relies on a PostgreSQL database, you can create a database dump using tools like pg_dump This will create a file containing the structure and data of your database. The recipient can then restore this dump onto their PostgreSQL instance. While this approach requires PostgreSQL to be installed, it’s a common practice and is easier than setting up an entire database schema manually.</div><div> Depending on the specifics of your application, you might be able to package it as a standalone executable or bundle it into an installer. This approach would include both the application code and a preconfigured database (SQLite or otherwise) within the package. This way, users won’t need to separately set up a database.

    • This reply was modified 1 year, 1 month ago by  Sarah White.
    • This reply was modified 1 year, 1 month ago by  Sarah White.
  • Vik Shah

    Member
    August 10, 2023 at 3:49 am

Log in to reply.