Results 1 to 5 of 5

Thread: How store a unsigned short into a database

  1. #1
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    691
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How store a unsigned short into a database

    Hi to all,
    I would store a unsigned short type ( 98 elements of ushort ) into a database ( ms sql express 2005 and sqlite ). But I can not find the correct type.
    I would have some help.
    Best Regards,
    Franco
    Franco Amato

  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: How store a unsigned short into a database

    You cannot find a correct type for what?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    691
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How store a unsigned short into a database

    Quote Originally Posted by wysota View Post
    You cannot find a correct type for what?
    Wysota hi,
    I can not find a correct type in the database that can store a ushort.
    Regards
    Franco Amato

  4. #4
    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: How store a unsigned short into a database

    For SQLite it doesn't matter as it will store it as text anyway. For other databases it will be something like SMALLINT or INTEGER(maximum_number_of_digits). If I understand correctly that you need an array of those then I think you need to rethink your design -- databases don't like arrays. You can store it as text separated by commas -- it will be as inefficient as any other kind of representation.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How store a unsigned short into a database

    For SQLite it doesn't matter as it will store it as text anyway.
    This is true of Sqlite2 but not Sqlite3, which uses a variable length binary representation of integer data in columns with numeric affinity (if possible).
    http://sqlite.org/datatype3.html

Similar Threads

  1. Need ideas on how to store data in SQL-Database
    By homerun4711 in forum Newbie
    Replies: 3
    Last Post: 5th January 2011, 23:10
  2. converting QByteArray to unsigned short
    By sattu in forum Qt Programming
    Replies: 16
    Last Post: 28th September 2010, 13:51
  3. Replies: 5
    Last Post: 9th April 2007, 14:26
  4. Tiff in unsigned short
    By spawnwj in forum Qt Programming
    Replies: 14
    Last Post: 26th July 2006, 07:41
  5. Is it possible to store pointers in a database ?
    By probine in forum General Programming
    Replies: 8
    Last Post: 5th April 2006, 21:28

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.