Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. The best type for PostgreSQL text type
Qt 6.11 is out! See what's new in the release blog

The best type for PostgreSQL text type

Scheduled Pinned Locked Moved General and Desktop
8 Posts 5 Posters 1.8k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Exotic_Devel
    wrote on last edited by
    #1

    Whats the best c++ or Qt type for represent a text type column of postgresql?
    A text type in postgresql supports an unlimited number of characters (unlimited string).
    Or should I treat it as a text file?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What about QString ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      E 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        What about QString ?

        E Offline
        E Offline
        Exotic_Devel
        wrote on last edited by
        #3

        @SGaist

        Is there a character limit for QString?

        jsulmJ 1 Reply Last reply
        0
        • M Offline
          M Offline
          mcosta
          wrote on last edited by
          #4

          Hi,

          the size of a QString is a 32bit integer so, in theory the maximum size is 2^31-1.

          Once your problem is solved don't forget to:

          • Mark the thread as SOLVED using the Topic Tool menu
          • Vote up the answer(s) that helped you to solve the issue

          You can embed images using (http://imgur.com/) or (http://postimage.org/)

          1 Reply Last reply
          0
          • E Exotic_Devel

            @SGaist

            Is there a character limit for QString?

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @Exotic_Devel How long are the strings going to be?

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            E 1 Reply Last reply
            0
            • TheBadgerT Offline
              TheBadgerT Offline
              TheBadger
              wrote on last edited by
              #6

              I always use QString without any issues


              Check out my SpellChecker Plugin for Qt Creator @ https://github.com/CJCombrink/SpellChecker-Plugin

              1 Reply Last reply
              0
              • jsulmJ jsulm

                @Exotic_Devel How long are the strings going to be?

                E Offline
                E Offline
                Exotic_Devel
                wrote on last edited by
                #7

                @jsulm There isn’t a size definition, since text type in PostgreSQL is unlimited. But I believe that QStrint limit (2^31-1) will not be exceeded.

                Thanks guys.

                jsulmJ 1 Reply Last reply
                0
                • E Exotic_Devel

                  @jsulm There isn’t a size definition, since text type in PostgreSQL is unlimited. But I believe that QStrint limit (2^31-1) will not be exceeded.

                  Thanks guys.

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @Exotic_Devel The question is: how big will your strings be? Are you really going to store strings > 2^31-1 ?
                  If not then you can just use QString. Just because a string in PostgreSQL is (theoretically) unlimited does not mean that you have to use a string implementation which has an unlimited size.

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved