Results 1 to 3 of 3

Thread: qt5.4 commercial setDatabaseName() qsqlite odd error - maximum length for name?

  1. #1
    Join Date
    Nov 2008
    Posts
    178
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default qt5.4 commercial setDatabaseName() qsqlite odd error - maximum length for name?

    Version 5.4 commercial on Linux

    Weird problem with setDatabaseName() is there a maximum length for local file name?

    If I try to setDatabaseName() to /media/mmcblk1p1/.config/Somebody Corp/history.db the open fails with the ubiquitous "out of memory Error opening database"
    If I use /.config/Somebody Corp/history.db everything works.

    Yes, both directories exist. In fact there are other non QSqlDatabase things in the same method writing to the same /media path successfully. It is just the database which has issue trying to open a file there. Since a space in the path name works with the shorter name I would tend to rule it out as being the problem.

    Does anybody know if there is a max length for a local path name or if QSqlDatabase using QSQLITE has a problem with /media/mmcblk type paths? We need to put our history database on the card due to storage limitations on the target. Before I change this around completely to thump in a link after verifying the directory exists I would like to hear from someone else who has been down this path.

  2. #2
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: qt5.4 commercial setDatabaseName() qsqlite odd error - maximum length for name?

    Hi, I would imagine that the max length is a limit of the OS, not Qt. I can confirm, however, that I have used paths longer than the one you listed above, so I doubt your issue is related to a max length coming into play. Since both of the paths you list above start with a '/' then both start at the root file system. Do you really have a "/.config" directory off of your root file system?

    Please post the code you're using using the [code][/code] tags.
    I write the best type of code possible, code that I want to write, not code that someone tells me to write!

  3. #3
    Join Date
    Nov 2008
    Posts
    178
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: qt5.4 commercial setDatabaseName() qsqlite odd error - maximum length for name?

    We certainly have such a directory now, but it could have been a side effect of where I changed the string assignment.

    Cannot really post the code as this is an embedded product, but the problem is definitely with the /media/mmc path thing. I had thought about cheating and using a QDir to change the working directory to where the file needed to be, but, this is at startup and with the other threads, I do not know what that would do to things. Certainly backing the string up to /media/mmcblk1p1/.config/history.db didn't help as I tried that. There is just some oddity with that path. In the morning I may experiment starting with /media/history.db and see if that works, then tunnel down to find out where it dies. Need to get it to successfully write to that card though. We write other files there without issue so it is not a hardware or OS problem. It is only opening/creating an SQLite database out there which has trouble.

    I guess the next step would be to try and create an sqlite database in the correct location from the command line. That would move the problem outside of Qt to something in the yocto build.

Similar Threads

  1. Set maximum input length in spinbox?
    By hakermania in forum Newbie
    Replies: 1
    Last Post: 23rd December 2010, 23:54
  2. QTextEdit - how to limit maximum length?
    By Henrikas[MI] in forum Qt Programming
    Replies: 7
    Last Post: 21st September 2010, 20:38
  3. Is it possible to set a maximum length for QTextEdit ???
    By vairamuthu.g in forum Qt Programming
    Replies: 1
    Last Post: 28th August 2010, 05:17
  4. Set Maximum Length of QTextEdit
    By moh.gup@gmail.com in forum Qt Programming
    Replies: 3
    Last Post: 2nd July 2010, 08:27
  5. Replies: 33
    Last Post: 10th June 2010, 16:51

Tags for this Thread

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.