Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 3

Qt-interest Archive, May 2007
Knowing if sqlite database exists

Pages: Prev | 1 | 2 | Next

Message 16 in thread

On 5/15/07, Martin Gebert <Martin.Gebert@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> > The database name is used to create a file that contains a file the
> > SQLite database. If you provide a name such as "foo" without a full
> > path, my guess is that the database will be created in a file "foo" in
> > the current directory, which isn't a very good idea. I didn't look at
> > the source code of Qt, so this is just a guess.
>
> That's correct, IIRC. Better specify a path to avoid unwanted surprises.
> See the docs in
> doc/html/sql-driver.html#qsqlite-for-sqlite-version-3-and-above:
>
> 'SQLite operates on a single file, which must be set as the database
> name when opening a connection. If the file does not exist, SQLite will
> try to create it. SQLite also supports in-memory databases, simply pass
> ":memory:" as the database name.'
>

Thank you all for  your help on this issue.
Now, I seem to have a problem. If there's no default place to save the
database, how can I do that? Should I just create a $HOME/.<app>
directory? (this is everything but portable). Any ideas? Where do you
usually keep app config specific files?

Cheers,

Paulo Matos

> Martin
>
> --
> To mail me in private, please remove the -NOSPAM- part from the address
> above.
>
> Ultimate Truths in software development # 3:
> PEBKAC
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>
>
>


-- 
 [ signature omitted ] 

Message 17 in thread

> Now, I seem to have a problem. If there's no default place to save the
> database, how can I do that? Should I just create a $HOME/.<app>
> directory? (this is everything but portable). Any ideas? Where do you
> usually keep app config specific files?

Well, usually for Qt applies that you save the config through QSettings. 
However, I'd advise to store additional files in a dedicated dir in 
$HOME (see QSettings for a possible naming scheme). Perhaps QDir::home() 
is what you're looking for?

Martin

-- 
 [ signature omitted ] 

Message 18 in thread

> However, I'd advise to store additional files in a dedicated dir in 
> $HOME (see QSettings for a possible naming scheme).

Addendum: Global settings/files (available read-write for all users) are 
per convention best stored in the application dir on Windows or in 
/usr/[local/]share/<appname>/ on Unices. Unfortunately Qt doesn't 
provide these location paths...?

Martin

-- 
 [ signature omitted ] 

Message 19 in thread

On 5/15/07, Martin Gebert <Martin.Gebert@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> > Now, I seem to have a problem. If there's no default place to save the
> > database, how can I do that? Should I just create a $HOME/.<app>
> > directory? (this is everything but portable). Any ideas? Where do you
> > usually keep app config specific files?
>
> Well, usually for Qt applies that you save the config through QSettings.
> However, I'd advise to store additional files in a dedicated dir in
> $HOME (see QSettings for a possible naming scheme). Perhaps QDir::home()
> is what you're looking for?

I can see me creating $HOME/.myapp and working from there having
things set up just fine but what happens in windows and mac? Will this
work?

>
> Martin
>
> --
> To mail me in private, please remove the -NOSPAM- part from the address
> above.
>
> I think I am, therefore I am thinking.
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>
>
>


-- 
 [ signature omitted ] 

Message 20 in thread

Hello, Paulo J. Matos
16.05.2007 0:19 you wrote:
>> Well, usually for Qt applies that you save the config through QSettings.
>> However, I'd advise to store additional files in a dedicated dir in
>> $HOME (see QSettings for a possible naming scheme). Perhaps QDir::home()
>> is what you're looking for?
> 
> I can see me creating $HOME/.myapp and working from there having
> things set up just fine but what happens in windows and mac? Will this
> work?
> 

Just ask user where they want it. Something like "Hi, I can create db in 
your $HOME or show me where you wanna it" (i personally hate 
applications which make this silently).

--
 [ signature omitted ] 

Message 21 in thread

> I can see me creating $HOME/.myapp and working from there having
> things set up just fine but what happens in windows and mac? Will this
> work?

If you use QDir::home() instead of the HOME environment variable, I 
think this would be OK, yes.

Martin

-- 
 [ signature omitted ] 

Message 22 in thread

Hi guys,
I'm new in qt and I've developed  a multi thread application.
I've a couple of questions :
- What happen if more user events (like push on a button) are generated 
before that the last invocation of the handler(slot) linked to the 
signal emitted is terminated? Could a slot be interrupted if a new 
signal reach the main event loop?
- in may application when somebody clicks many times on a button which 
is used to restart a thread pool, some times happen this error: 
   ASSERT failure in QWaitCondition::wait: "internal error (waiters)", 
file thread/qwaitcondition_unix.cpp, line 265
Could somebody help me?

feel free to ask me more information if I have been too clear.

Thanks in advance for yours trip.
Best regards Nicola Dicosmo.

--
 [ signature omitted ] 

Message 23 in thread

Hi guys,
I'm new in qt and I've developed  a multi thread application.
I've a couple of questions :
- What happen if more user events (like push on a button) are generated 
before that the last invocation of the handler(slot) linked to the 
signal emitted is terminated? Could a slot be interrupted if a new 
signal reach the main event loop?
- in my application when somebody clicks many times on a button which is 
used to restart a thread pool, some times happen this error:   ASSERT 
failure in QWaitCondition::wait: "internal error (waiters)", file 
thread/qwaitcondition_unix.cpp, line 265
Could somebody help me?

feel free to ask me more information if I haven't been enough clear.

Thanks in advance for yours trip.
Best regards Nicola Dicosmo.

p.s.
sorry for my English.

Nicola Dicosmo wrote:
> Hi guys,
> I'm new in qt and I've developed  a multi thread application.
> I've a couple of questions :
> - What happen if more user events (like push on a button) are 
> generated before that the last invocation of the handler(slot) linked 
> to the signal emitted is terminated? Could a slot be interrupted if a 
> new signal reach the main event loop?
> - in may application when somebody clicks many times on a button which 
> is used to restart a thread pool, some times happen this error:   
> ASSERT failure in QWaitCondition::wait: "internal error (waiters)", 
> file thread/qwaitcondition_unix.cpp, line 265
> Could somebody help me?
>
> feel free to ask me more information if I have been too clear.
>
> Thanks in advance for yours trip.
> Best regards Nicola Dicosmo.
>
> -- 
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>

--
 [ signature omitted ] 

Message 24 in thread

Hi guys,
I'm new in qt and I've developed  a multi thread application.
I've a couple of questions :
- What happen if more user events (like push on a button) are generated 
before that the last invocation of the handler(slot) linked to the 
signal emitted is terminated? Could a slot be interrupted if a new 
signal reach the main event loop?
- in my application when somebody clicks many times on a button which is 
used to restart a thread pool, some times happen this error:   ASSERT 
failure in QWaitCondition::wait: "internal error (waiters)", file 
thread/qwaitcondition_unix.cpp, line 265
Could somebody help me?

feel free to ask me more information if I haven't been enough clear.

Thanks in advance for yours trip.
Best regards Nicola Dicosmo.

--
 [ signature omitted ] 

Message 25 in thread

On Wednesday 16 May 2007 13:11:07 Nicola Dicosmo wrote:
> - in my application when somebody clicks many times on a button which is
> used to restart a thread pool, some times happen this error:   ASSERT
> failure in QWaitCondition::wait: "internal error (waiters)", file
> thread/qwaitcondition_unix.cpp, line 265

Do you have a small, compilable example that reproduces this? Internal errors 
like this should never happen, and if you've managed to make it happen, I 
want to fix it.

-- 
 [ signature omitted ] 

Message 26 in thread

Hi, thanks for your replay.
I'll try to write a small compilable example that reproduces this error 
during next week end.
Thanks for your offer.
Bye Nicola.

Bradley T Hughes wrote:
> On Wednesday 16 May 2007 13:11:07 Nicola Dicosmo wrote:
>   
>> - in my application when somebody clicks many times on a button which is
>> used to restart a thread pool, some times happen this error:   ASSERT
>> failure in QWaitCondition::wait: "internal error (waiters)", file
>> thread/qwaitcondition_unix.cpp, line 265
>>     
>
> Do you have a small, compilable example that reproduces this? Internal errors 
> like this should never happen, and if you've managed to make it happen, I 
> want to fix it.
>
>   

--
 [ signature omitted ] 

Message 27 in thread

On 16.05.07 12:24:09, Nicola Dicosmo wrote:
> Hi guys,
> I'm new in qt and I've developed  a multi thread application.
> I've a couple of questions :
> - What happen if more user events (like push on a button) are generated before 
> that the last invocation of the handler(slot) linked to the signal emitted is 
> terminated? Could a slot be interrupted if a new signal reach the main event 
> loop?

In Qt3 this cannot happen, because signal-slot connections are direct
function calls, so first all slots that are connected to a signal are
executed - completely, including any other signals that are triggered by
executing the slot - and then the event loop gets a chance to run again
and handle any events that are in the event queue.

In Qt4 the situation is somewhat different, as signal/slot connections
between different threads of the application usually use the
Qt::QueuedConnection mode. In this mode the signal is turned into a
special event, which is then posted to the thread that owns the object
having the slot. So these signals get delivered when the event loop runs
again and thus the slot is not called immediately when the signal is
sent.

Andreas

-- 
 [ signature omitted ] 

Message 28 in thread

Thanks a lot for your response.

Andreas Pakulat wrote:
> On 16.05.07 12:24:09, Nicola Dicosmo wrote:
>   
>> Hi guys,
>> I'm new in qt and I've developed  a multi thread application.
>> I've a couple of questions :
>> - What happen if more user events (like push on a button) are generated before 
>> that the last invocation of the handler(slot) linked to the signal emitted is 
>> terminated? Could a slot be interrupted if a new signal reach the main event 
>> loop?
>>     
>
> In Qt3 this cannot happen, because signal-slot connections are direct
> function calls, so first all slots that are connected to a signal are
> executed - completely, including any other signals that are triggered by
> executing the slot - and then the event loop gets a chance to run again
> and handle any events that are in the event queue.
>
> In Qt4 the situation is somewhat different, as signal/slot connections
> between different threads of the application usually use the
> Qt::QueuedConnection mode. In this mode the signal is turned into a
> special event, which is then posted to the thread that owns the object
> having the slot. So these signals get delivered when the event loop runs
> again and thus the slot is not called immediately when the signal is
> sent.
>
> Andreas
>
>   

--
 [ signature omitted ]