wxSQLite3 opening files with space

Talk here about issues with one of the components hosted at wxCode, or suggest features for it.
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2077
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania
Contact:

wxSQLite3 opening files with space

Postby evstevemd » Fri Nov 30, 2012 8:02 am

Hi,
It seems that my wxSQLite3Database::Open() does not work for files with Spaces in them.
For example it works fine for data.db but not for "Data Base.db"
Si this a bug? If its normal how can I use wxSQLite3 with filenames spaced?

Thanks!
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
[Ubuntu 15.04/Windows 10 Pro - GCC/MinGW, CodeLite IDE et al]

utelle
Moderator
Moderator
Posts: 767
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

Re: wxSQLite3 opening files with space

Postby utelle » Fri Nov 30, 2012 10:46 am

evstevemd wrote:It seems that my wxSQLite3Database::Open() does not work for files with Spaces in them.
For example it works fine for data.db but not for "Data Base.db"
Si this a bug? If its normal how can I use wxSQLite3 with filenames spaced?

I don't think it's related to wxSQLite3. The filename of the database file is passed to SQLite in UTF-8 encoding but otherwise unchanged. Opening a file with a name which contains spaces should definitely work. I tested it successfully under Windows.

If it doesn't work for you there has to be a different explanation. Does the filename include path information? If yes, make sure the path exists in your file system. What happens when you execute your application? Does your application crash? If yes, can you debug the application to find the location where it crashes? Or do you get an exception? If yes, what is the message text? Or which other phenomenon do you experience?

Regards,

Ulrich

evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2077
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania
Contact:

Re: wxSQLite3 opening files with space

Postby evstevemd » Fri Nov 30, 2012 3:32 pm

utelle wrote:
evstevemd wrote:It seems that my wxSQLite3Database::Open() does not work for files with Spaces in them.
For example it works fine for data.db but not for "Data Base.db"
Si this a bug? If its normal how can I use wxSQLite3 with filenames spaced?

I don't think it's related to wxSQLite3. The filename of the database file is passed to SQLite in UTF-8 encoding but otherwise unchanged. Opening a file with a name which contains spaces should definitely work. I tested it successfully under Windows.

I thought so but I checked with SQlite3 docs they say as you said: it should work!

utelle wrote:If it doesn't work for you there has to be a different explanation. Does the filename include path information? If yes, make sure the path exists in your file system. What happens when you execute your application? Does your application crash? If yes, can you debug the application to find the location where it crashes? Or do you get an exception? If yes, what is the message text? Or which other phenomenon do you experience?

Regards,

Ulrich

App does not crash. As the matter of fact changing name to one without space works fine. There is where I get puzzled. Let me check again if I can discover anything! :oops:
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
[Ubuntu 15.04/Windows 10 Pro - GCC/MinGW, CodeLite IDE et al]

utelle
Moderator
Moderator
Posts: 767
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

Re: wxSQLite3 opening files with space

Postby utelle » Fri Nov 30, 2012 5:51 pm

evstevemd wrote:App does not crash. As the matter of fact changing name to one without space works fine.

This is indeed strange. If wxSQLite3Database::Open fails a wxSQLite3Exception is thrown. Please catch this exception and report the error code and message here. Use code like in the minimal sample

Code: Select all

...
catch (wxSQLite3Exception& e)
{
    cerr << e.GetErrorCode() << ":" << (const char*)(e.GetMessage().mb_str()) << endl;
}

or use wxLogError.

evstevemd wrote:There is where I get puzzled. Let me check again if I can discover anything! :oops:

I'll certainly try to help but without being able to reproduce the problem I have no clue what's going wrong in your application.

Regards,

Ulrich

evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2077
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania
Contact:

Re: wxSQLite3 opening files with space

Postby evstevemd » Sat Dec 01, 2012 7:44 pm

I found a bug in my code. All codes with call to Open have been deleted.
However, I had redirected exceptions and forgot to check it in CodeLite.
Sorry for my stupid mistake and thanks for your hand :oops:
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
[Ubuntu 15.04/Windows 10 Pro - GCC/MinGW, CodeLite IDE et al]


Return to “wxCode”

Who is online

Users browsing this forum: No registered users and 1 guest