Results 1 to 9 of 9

Thread: Is it possible to store pointers in a database ?

  1. #1
    Join Date
    Jan 2006
    Posts
    185
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Is it possible to store pointers in a database ?

    Hi,

    Is it possible to store a pointer in a database.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Is it possible to store pointers in a database ?

    No. Well... it is possible but it doesn't make any sense as it will become invalid when the current process is terminated and other processes can't use it too. So the answer stays at "no"

  3. #3
    Join Date
    Feb 2006
    Location
    US
    Posts
    173
    Thanks
    16
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Is it possible to store pointers in a database ?

    Pointers are virutal ... essentially offsets to real physical base addresses. So, it is conceivable that you could restore this information. I've heard of some game engines that store this type information in a database and simply restore it during runtime to avoid memory allocation performance hits. However, I have no experience with this. And, I have no understanding what OS service is leveraged to accomplish this.

  4. #4
    Join Date
    Mar 2006
    Location
    Mountain View, California
    Posts
    489
    Thanks
    3
    Thanked 74 Times in 54 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Is it possible to store pointers in a database ?

    The big questions are why you want to do this and how you would use it.

    I have seen an app that marshalled pointers out to persistant storage, but it was overkill for what it was doing. In most cases where one wishes for persistant pointers, there is usually a better (and simpler) way to get the same functional result.

  5. #5
    Join Date
    Feb 2006
    Location
    Boulder, Colorado, USA
    Posts
    63
    Thanked 8 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Is it possible to store pointers in a database ?

    You might want to look into an object database for object persistance if that is what you are looking into.
    http://en.wikipedia.org/wiki/Object_database

  6. #6
    Join Date
    Feb 2006
    Location
    US
    Posts
    173
    Thanks
    16
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Is it possible to store pointers in a database ?

    Quote Originally Posted by Brandybuck
    The big questions are why you want to do this and how you would use it.
    In games it takes significant time to build scene graph information -- espeically for transitions from one area/chapter of the game to another. If able to simply load portions of the database pre-constructed, then it would provide seamless (i.e. natural, smooth, continuous) transitions.

  7. #7
    Join Date
    Feb 2006
    Location
    US
    Posts
    173
    Thanks
    16
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Is it possible to store pointers in a database ?

    It would eliminate the time needed to re-build the constructed database; it's not just an issue of allocation as I incorrectly stated.

  8. #8
    Join Date
    Mar 2006
    Location
    Mountain View, California
    Posts
    489
    Thanks
    3
    Thanked 74 Times in 54 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Is it possible to store pointers in a database ?

    In the case of games you don't want to be marshalling/demarshalling pointers, it's not gaining you anything. If your performance is based on tangled web of pointers, time to redesign. You would do better to restructure your data so it can be loaded faster and use a thread to preload neighboring scenes in the background.

    Besides, games are special cases that should never be used as case studies for good programming practice :-)

  9. #9
    Join Date
    Feb 2006
    Location
    US
    Posts
    173
    Thanks
    16
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Is it possible to store pointers in a database ?

    No offense Brandybuck ... but, you're way off here.

    Your statement has a certain emotional appeal. But, I think it misses the intent of my response. I wasn't promoting this as an industry best-practice for general programming ... rather trying to provide an answer to a question by Probine.

    Obviously, this thread has gotten way off topic. But, I had to repsond one last time.

    Cheers,
    Ben

Similar Threads

  1. Threads and database connection
    By probine in forum Qt Programming
    Replies: 9
    Last Post: 7th August 2013, 09:30
  2. cannot share the database connection!!!!
    By cbarmpar in forum Qt Programming
    Replies: 13
    Last Post: 23rd September 2008, 15:42
  3. Replies: 5
    Last Post: 9th April 2008, 00:10
  4. Multiple database connections
    By cyberboy in forum Qt Programming
    Replies: 3
    Last Post: 30th March 2008, 17:56
  5. Database Master-Detail Entry Form
    By Phan Sin Tian in forum Newbie
    Replies: 4
    Last Post: 3rd February 2008, 15:31

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.