Re: [sqlite] Check if the new table has been created

2018-06-19 Thread Igor Korot
Hi, guys,

On Tue, Jun 19, 2018 at 4:37 PM, Igor Korot  wrote:
> Hi, Ryan,
>
> On Tue, Jun 19, 2018 at 3:22 PM, R Smith  wrote:
>>
>> On 2018/06/19 8:26 PM, Igor Korot wrote:
>>>
>>>   Hi,
>>> Is there a C API which checks if the new table has been created?
>>
>>
>> We could break this down into a few separate questions:
>>
>> 1 - Is there a C API that can return SQL query answers?
>> YES there is.
>>
>> 2 - Can I ask this API in SQL if the Schema changed, since
>> altering/adding/deleting a table involves schema changes?
>> YES you can. [I see this pragma schema_version is already mentioned in other
>> replies]
>>
>> 3 - Once I know the schema changed, can I ask for a list of tables to
>> compare to my predefined/pre-loaded/cached list to know WHICH tables were
>> changed/added/deleted?
>> YES you can: [pragma table_info]
>>
>> 4 - Can I use all of the above to update my cached table list and refresh
>> interfaces as needed?
>> Well, technically that's up to your mad skillz as a programmer, but having
>> seen your posts many times before, I'm going to bet on: YES, you can.
>>
>> 5 - Is there a C-API that does all of the above in one go for me?
>> I'm afraid NOT.
>
> Thank you.
> This post summarizes it all.
>
> I'll follow thru when I get back home.

One more question:

I presume I should call PRAGMA schema_version right after connection
has been made,
cache the value returned and then create a secondary thread which will
call this query continuously.

Am I right?

Thank you.

>
>
>>
>>
>> Good luck!
>> Ryan
>>
>>
>> ___
>> sqlite-users mailing list
>> sqlite-users@mailinglists.sqlite.org
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Strange Corruption Issue

2018-06-19 Thread poncho524
Simon Slavin-3 wrote
> I think you have a hardware problem of some kind.  Whether it's main
> storage, motherboard, memory or something else I don't know but flipping
> one random bit in an octet looks like a hardware problem, not a software
> problem.
> 
> Can you try the same software out on another computer ?

I have seen corruption on other boxes.  Trouble is these are fairly
unattended boxes and only notice corruption when i go to check the logs. 
And sometimes the file are fine.  Just every once in a while it goes bad. 
Maybe the drives we use aren't good.  Who knows.  I also haven't done a deep
analysis of other corrupt files to see if they also show the single bit flip
errors, or if they were corrupt for other reasons.  I'll report if we find
anything interesting.



--
Sent from: http://sqlite.1065341.n5.nabble.com/
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Check if the new table has been created

2018-06-19 Thread Igor Korot
Hi, Ryan,

On Tue, Jun 19, 2018 at 3:22 PM, R Smith  wrote:
>
> On 2018/06/19 8:26 PM, Igor Korot wrote:
>>
>>   Hi,
>> Is there a C API which checks if the new table has been created?
>
>
> We could break this down into a few separate questions:
>
> 1 - Is there a C API that can return SQL query answers?
> YES there is.
>
> 2 - Can I ask this API in SQL if the Schema changed, since
> altering/adding/deleting a table involves schema changes?
> YES you can. [I see this pragma schema_version is already mentioned in other
> replies]
>
> 3 - Once I know the schema changed, can I ask for a list of tables to
> compare to my predefined/pre-loaded/cached list to know WHICH tables were
> changed/added/deleted?
> YES you can: [pragma table_info]
>
> 4 - Can I use all of the above to update my cached table list and refresh
> interfaces as needed?
> Well, technically that's up to your mad skillz as a programmer, but having
> seen your posts many times before, I'm going to bet on: YES, you can.
>
> 5 - Is there a C-API that does all of the above in one go for me?
> I'm afraid NOT.

Thank you.
This post summarizes it all.

I'll follow thru when I get back home.


>
>
> Good luck!
> Ryan
>
>
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Check if the new table has been created

2018-06-19 Thread R Smith


On 2018/06/19 8:26 PM, Igor Korot wrote:

  Hi,
Is there a C API which checks if the new table has been created?


We could break this down into a few separate questions:

1 - Is there a C API that can return SQL query answers?
YES there is.

2 - Can I ask this API in SQL if the Schema changed, since 
altering/adding/deleting a table involves schema changes?
YES you can. [I see this pragma schema_version is already mentioned in 
other replies]


3 - Once I know the schema changed, can I ask for a list of tables to 
compare to my predefined/pre-loaded/cached list to know WHICH tables 
were changed/added/deleted?

YES you can: [pragma table_info]

4 - Can I use all of the above to update my cached table list and 
refresh interfaces as needed?
Well, technically that's up to your mad skillz as a programmer, but 
having seen your posts many times before, I'm going to bet on: YES, you can.


5 - Is there a C-API that does all of the above in one go for me?
I'm afraid NOT.


Good luck!
Ryan

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] (no subject)

2018-06-19 Thread R Smith


On 2018/06/19 9:55 PM, Stephen Chrzanowski wrote:

*sigh* I wish I had this kind of homework back in the day..


Well, I say you could just do the homework of those who do post homework 
questions here That way it technically IS your homework, and as 
such, your wish would have come true.



Cheers,
Your friendly neighbourhood Genie.

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] (no subject)

2018-06-19 Thread Stephen Chrzanowski
*sigh* I wish I had this kind of homework back in the day..

On Tue, Jun 19, 2018 at 3:22 PM, Simon Slavin  wrote:

> On 19 Jun 2018, at 8:15pm, Vicente minguez gabarda 
> wrote:
>
> > hello I need a simple example of relationship between table,
> > I would like to be able to visualize the relationship code between tables
> > and then reuse it.
>
> 
>
> One day, just for a laugh, we should actually do someone's homework for
> them.
>
> Simon.
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] (no subject)

2018-06-19 Thread Simon Slavin
On 19 Jun 2018, at 8:15pm, Vicente minguez gabarda  wrote:

> hello I need a simple example of relationship between table,
> I would like to be able to visualize the relationship code between tables
> and then reuse it.



One day, just for a laugh, we should actually do someone's homework for them.

Simon.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Check if the new table has been created

2018-06-19 Thread Simon Slavin


On 19 Jun 2018, at 7:56pm, Richard Hipp  wrote:

> Poll the PRAGMA schema_version value and watch for changes.

This is the best way.  (I'm hardly likely to argue with DRH, am I ?)

However, it's a terrible way to communicate using a database system.  If you 
want two connections to communicate have one connection create a new row in an 
existing table, which the other can query.

Simon.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] I need a simple example of relationship between tables

2018-06-19 Thread Vicente minguez gabarda
hello I need a simple example of relationship between table,
I would like to be able to visualize the relationship code between tables
and then reuse it.
thank you very much
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] (no subject)

2018-06-19 Thread Vicente minguez gabarda
hello I need a simple example of relationship between table,
I would like to be able to visualize the relationship code between tables
and then reuse it.
thank you very much
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Check if the new table has been created

2018-06-19 Thread Abroży Nieprzełoży
afaik there is no such api.
You need to periodically check if something changed.

Run
pragma schema_version;
to get current schema version.
If it changes then run
select name from sqlite_master where type='table' and name not
like 'sqlite_%';
to get the list of table names and compare this list with one you've
got previously.


2018-06-19 20:42 GMT+02:00, Igor Korot :
> Hi, Wout,
>
> On Tue, Jun 19, 2018 at 1:31 PM, Wout Mertens 
> wrote:
>> you can query the table with
>> https://www.sqlite.org/pragma.html#pragma_table_info
>
> Let me give you a scenario:
>
> 1. My application connects to the database and performs some
> operations (using C API).
> 2. During the application run, someone started sqlite3, connects to
> the database and creates a
> brand new table.
> 3. My application will need to pick up the newly created table and continue.
>
> Is it easily possible?
>
> There is a sqlite3_*_hook() family of functions, but it looks like
> they won't help with sqlite_master.
>
> Is there a different way?
>
> Thank you.
>
>>
>> On Tue, Jun 19, 2018, 8:26 PM Igor Korot  wrote:
>>
>>>  Hi,
>>> Is there a C API which checks if the new table has been created?
>>>
>>> Thank you.
>>> ___
>>> sqlite-users mailing list
>>> sqlite-users@mailinglists.sqlite.org
>>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>>>
>> ___
>> sqlite-users mailing list
>> sqlite-users@mailinglists.sqlite.org
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Check if the new table has been created

2018-06-19 Thread Richard Hipp
On 6/19/18, Igor Korot  wrote:
> Hi, Wout,
>
> On Tue, Jun 19, 2018 at 1:31 PM, Wout Mertens 
> wrote:
>> you can query the table with
>> https://www.sqlite.org/pragma.html#pragma_table_info
>
> Let me give you a scenario:
>
> 1. My application connects to the database and performs some
> operations (using C API).
> 2. During the application run, someone started sqlite3, connects to
> the database and creates a
> brand new table.
> 3. My application will need to pick up the newly created table and continue.
>
> Is it easily possible?
>
> There is a sqlite3_*_hook() family of functions, but it looks like
> they won't help with sqlite_master.
>
> Is there a different way?

Poll the PRAGMA schema_version value and watch for changes.
-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Check if the new table has been created

2018-06-19 Thread Igor Korot
Hi, Wout,

On Tue, Jun 19, 2018 at 1:31 PM, Wout Mertens  wrote:
> you can query the table with
> https://www.sqlite.org/pragma.html#pragma_table_info

Let me give you a scenario:

1. My application connects to the database and performs some
operations (using C API).
2. During the application run, someone started sqlite3, connects to
the database and creates a
brand new table.
3. My application will need to pick up the newly created table and continue.

Is it easily possible?

There is a sqlite3_*_hook() family of functions, but it looks like
they won't help with sqlite_master.

Is there a different way?

Thank you.

>
> On Tue, Jun 19, 2018, 8:26 PM Igor Korot  wrote:
>
>>  Hi,
>> Is there a C API which checks if the new table has been created?
>>
>> Thank you.
>> ___
>> sqlite-users mailing list
>> sqlite-users@mailinglists.sqlite.org
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>>
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Check if the new table has been created

2018-06-19 Thread Wout Mertens
you can query the table with
https://www.sqlite.org/pragma.html#pragma_table_info

On Tue, Jun 19, 2018, 8:26 PM Igor Korot  wrote:

>  Hi,
> Is there a C API which checks if the new table has been created?
>
> Thank you.
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Check if the new table has been created

2018-06-19 Thread Igor Korot
 Hi,
Is there a C API which checks if the new table has been created?

Thank you.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Strange Corruption Issue

2018-06-19 Thread Simon Slavin


On 19 Jun 2018, at 5:44am, Scott Robison  wrote:

> My first guess would be failing RAM chips.

My guess is that, but more vague.

I think you have a hardware problem of some kind.  Whether it's main storage, 
motherboard, memory or something else I don't know but flipping one random bit 
in an octet looks like a hardware problem, not a software problem.

Can you try the same software out on another computer ?

Simon.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users