Re: [sqlite] INSERT vs BEGIN

2019-09-03 Thread Richard Damon
On 9/3/19 7:18 AM, Dominique Devienne wrote:
> On Tue, Sep 3, 2019 at 12:03 PM Rob Richardson 
> wrote:
>
>> I didn't know it is possible to insert multiple rows into a table using a
>> command like this.
>
> Added over 7 years ago: See
> https://www.sqlite.org/changes.html#version_3_7_11 #1
>
>
>> Is this just an SQLite feature, or is this part of the SQL standard?
>
> I suspect it's non-standard, since Oracle does not support it. But it's
> just a guess on my part. --DD
Many databases I have used include it, so I thought it was standard (if
not universally supported, but that is somewhat common with SQL)

-- 
Richard Damon

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


Re: [sqlite] What concurrency level is of sqlite?

2019-09-03 Thread Keith Medcalf
On Tuesday, 3 September, 2019 14:14, Peng Yu  wrote:

>In other words, if two processes write to the same sqlite file but to
>different tables, will one wait for the other? What if to the same
>table but different rows? Thanks.

You will not be permitted to do that as there is no locking at a grain finer 
than the entire database between processes.  One of the processes will be able 
to obtain the update transaction lock, and the other will fail to obtain that 
update transaction lock.  Unless you are using WAL journal mode, then in such a 
circumstance even the successful process may never be able to commit its 
changes if the other process never releases its shared lock (this is called a 
deadlock).  That is why you must always acquire all needed locks at one go by 
using the appropriate type of BEGIN statement, and if your lock acquisition 
fails you must release all held locks.

-- 
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Endless loop possible with simultaneous SELECT and UPDATE?

2019-09-03 Thread Keith Medcalf

On Tuesday, 3 September, 2019 15:01, Kees Nuyt  wrote:

>On Tue, 3 Sep 2019 18:26:01 +0100, you wrote:

>>> // do SELECT on db1
>>> // do UPDATE on db2

>> Do you expect the SELECT to see the results of the previous
>> UPDATE ?  It won't, until the transaction has ended
>> (unless you arrange this explicitly).

>That's the nice thing about this construct:
>isolation between the SELECT and the UPDATE,
>the pattern is indeed:

>* Iterate over unchanged rows,
>  without seeing DELETEs, UPDATEs and INSERTs
>  on the tables in the select,

>* Be free to act upon the original rows
>  without disturbance of the read.

>I think it only works for WAL journal mode.

It will work just fine in non-WAL mode provided that the number of changed 
pages made by the updates does not exceed the size of the cache (that is, the 
changes on db2 do not have to spill the cache and thus obtain an exclusive 
lock, that it will not be able to obtain, prior to commit time).  You of course 
have to start an ordinary transaction on db1 and an immediate transaction on 
db2 before starting the query/change loop, and commit db1 before committing db2 
after the loop runs out of rows (so that you do not deadlock yourself when the 
commit on db2 attempts to upgrade to an exclusive lock).

In WAL journal mode you do not have to worry any of that at all since an open 
read will not prevent a write on a different connection from spilling the cache 
or committing.

You can do it all on one connection using only a single immediate transaction 
(whether in WAL journal mode or not) if you are sure the query in the outer 
loop cannot be using an index modified by the inner update/delete/insert 
operations.  One way to do this is to require the use of a sorter by that query 
so that all the results must be gathered before the first row is returned (such 
as by using the ORDER BY +colname implementation detail).

-- 
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Endless loop possible with simultaneous SELECT and UPDATE?

2019-09-03 Thread Kees Nuyt
On Tue, 3 Sep 2019 18:26:01 +0100, you wrote:

>> // do SELECT on db1
>> // do UPDATE on db2
>
> Do you expect the SELECT to see the results of the previous
> UPDATE ?  It won't, until the transaction has ended
> (unless you arrange this explicitly).

That's the nice thing about this construct: 
isolation between the SELECT and the UPDATE, 
the pattern is indeed:

* Iterate over unchanged rows,
  without seeing DELETEs, UPDATEs and INSERTs 
  on the tables in the select, 

* Be free to act upon the original rows
  without disturbance of the read.

I think it only works for WAL journal mode.

-- 
Regards,
Kees Nuyt

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


Re: [sqlite] What concurrency level is of sqlite?

2019-09-03 Thread Simon Slavin
On 3 Sep 2019, at 9:13pm, Peng Yu  wrote:

> In other words, if two processes write to the same sqlite file but to
> different tables, will one wait for the other? What if to the same
> table but different rows? Thanks.

SQLite has only a lock for the entire database.  It does not lock tables or 
rows.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] What concurrency level is of sqlite?

2019-09-03 Thread Peng Yu
Hi,

In other words, if two processes write to the same sqlite file but to
different tables, will one wait for the other? What if to the same
table but different rows? Thanks.

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


Re: [sqlite] How to create a new table or overwrite an existing table in one command?

2019-09-03 Thread Simon Slavin
On 3 Sep 2019, at 8:57pm, Peng Yu  wrote:

> If I try to create a table that already exists, sqlite will give me an error. 
> Is there way to issue one command to create a table, but if there is already 
> a table with the same name, drop it then create the new table? Thanks.

Assuming that the new table has a different structure to the old one, do it in 
two commands:

DROP TABLE IF EXISTS MyTable;
CREATE TABLE MyTable ...;

Neither of those commands will generate an error.

If you are sure that the new table has the same structure as the old one, you 
can do

CREATE TABLE IF NOT EXISTS MyTable ...;
DELETE FROM MyTable;
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] How to create a new table or overwrite an existing table in one command?

2019-09-03 Thread Peng Yu
Hi,

If I try to create a table that already exists, sqlite will give me an
error. Is there way to issue one command to create a table, but if
there is already a table with the same name, drop it then create the
new table? Thanks.

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


Re: [sqlite] Endless loop possible with simultaneous SELECT and UPDATE?

2019-09-03 Thread Simon Slavin
On 3 Sep 2019, at 5:34pm, Alexander Vega  wrote:

> sqlite3_open("database1", );
> sqlite3_open("database1", );

Bear in mind that SQLite is not a server/client DBMS.  The database is not kept 
in memory (unless you arrange this explicitly).  All operations have to wait 
for the storage that holds the database.

So yes, you can open two connections.  But it's not going to magically double 
the speed of your program.

> // do SELECT on db1
> // do UPDATE on db2

Do you expect the SELECT to see the results of the previous UPDATE ?  It won't, 
until the transaction has ended (unless you arrange this explicitly).
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Endless loop possible with simultaneous SELECT and UPDATE?

2019-09-03 Thread Alexander Vega
So in the original code if I added a NOT INDEXED it would be valid? Also,
would an ORDER BY Auth_id ASC fix the issue, since I an not adding any new
rows the auth_ids would remain constant?

Wow I did not know that you could call open multiple times on the same
database! So the following is valid and safe (considering POSIX locking
etc.)
sqlite3_open("database1", );
sqlite3_open("database1", );
// loop start
// BEGIN TRANSACTION BOTH dbs
// do SELECT on db1
// do UPDATE on db2
// END TRANSACTION
// loop end
// close db1
// use db2 for rest of the program...

I have not seen this pattern within any sqlite3 code before so I think it
is not well known that this is a design pattern for searching and updating
at the same time.

If I were determined to stay within defined behavior AND to only use one
connection, would the following updated code attain that.

#define SELECT_EXPIRED_IDS \
"SELECT Auth_id FROM AuthTable WHERE Auth_id > ? AND expiration < ? " \
"ORDER BY Auth_id ASC LIMIT 128;"

#define UPDATE_SESID_EXPIRED \
"UPDATE AuthTable SET sesCookie=?, expiration=? WHERE Auth_id=?;"

static void
expire_sesid(void)
{
int auth_ids[128] = {0};
int i=0, j;
/* get raw current time */
current_time = get_current_db_time(false);

/* prepare SQL queries */
sqlite3_prepare_v2(db,   SELECT_EXPIRED_IDS,
-1, _info, NULL);
sqlite3_prepare_v2(db,  UPDATE_SESID_EXPIRED,
-1, _ses_expired, NULL);

do {
  sqlite3_bind_int(expire_info, 1, auth_ids[i]);
  sqlite3_bind_int(expire_info, 2, current_time);
  /* while there is work to be done */
  i=0;
  while (sqlite3_step(expire_info) == SQLITE_ROW) {
auth_ids[i++] = sqlite3_column_int(expire_info, 0);   /* auth_id */
  }
  sqlite3_reset(expire_info);

  for (j=0; j < i; j++) {
/* generate new session id */
generate_ses_id(ses_id);
/* update ses_id and internal expiration to a year ahead, log in
will set it to a month for user log in */
sqlite3_bind_text(update_ses_expired, 1, ses_id,
   16, SQLITE_STATIC);
sqlite3_bind_int64(update_ses_expired, 2, current_time_plus_year);
sqlite3_bind_int(update_ses_expired, 3, auth_ids[j]);
sqlite3_step(update_ses_expired);
sqlite3_reset(update_ses_expired);
  }
} while ( i == 128 );
/* all work has completed */
sqlite3_finalize(expire_info);
sqlite3_finalize(update_ses_expired);
return;
}




On Sun, Sep 1, 2019 at 3:47 PM Keith Medcalf  wrote:

>
> On Sunday, 1 September, 2019 11:12, Alexander Vega 
> wrote:
>
> >Thank you Keith for your answer. It has led me to more questions.
>
> >"though you may or may not have visited all rows"
> >From the documentation I did not get the impression that you would
> >ever not visit ALL ROWS at least once. Is there a technical reason
> >for this? I would assume a full table scan is walking the un-ordered
> >leaf pages of the B*tree?
>
> How do you know that you are doing a table scan?  This certainly cannot be
> assumed.  Perhaps the AuthTable has 57 columns with a total length of
> several hundred bytes per row but there also happens to be an index on a
> subset of the columns that includes the two columns that you have asked
> for.  Perhaps you are "table scanning" that covering index instead (because
> it is cheaper than reading the actual table)?  There are ways to insist on
> a table scan (select ... from table NOT INDEXED ...) for example.  However,
> you left it up to the database engine to choose the most cost effective way
> to answer your select (which is how SQL works ... it is a declarative
> language ... you declare what you want and the database figures out the
> best way to go about giving you what you asked for).
>
> As a result of updating the first such row thus received the index has now
> changed such that the row you are operating on became the last row in the
> index being scanned.  Therefore there is no "next" row.  You will have
> visited only one row, even though there might have been millions of rows in
> the table.
>
> >"Your outer query should probably be "select auth_id, expiration from
> >AuthTable where expiration <= ? order by +auth_id, +expiration" and
> >binding current_time as the parameter since there is no point in
> >retrieving rows that you will not be updating is there?  "
>
> >You are correct that does make sense. I guess I was trying avoid any
> >ambiguities of a WHERE clause on the SELECT because I do not
> >understand its behavior in this circumstance.
>
> If you cannot understand the behaviour with a WHERE clause, then what
> would make you think that one without a WHERE clause would be any more
> transparent, especially given that all Relational Databases are designed to
> provide you the results you asked for as efficiently as possible?  Perhaps
> in a few days you will discover that you need to create another index for
> some other purpose, and that causes SQLite3 to obtain what you said you
> wanted in an entirely different manner.  When you make any change to the
> database do you re-evaluate the implementation 

Re: [sqlite] Query for Many to Many

2019-09-03 Thread Keith Medcalf

On Tuesday, 3 September, 2019 07:19, dboland9  wrote:

>Thanks for the info.  As I understand things, this is an implicit join.  

The syntax for a SELECT statement goes like this:

SELECT 
FROM 
WHERE 
GROUP BY 
HAVING 
ORDER BY 

>I did try it, and it works just fine.  However, in my reading it appears that
>implicit joins are discouraged, and will only do left joins.

Implicit joins (whatever that means) are not discouraged.  And the "," in the 
list of tables may be replaced by the word JOIN.  It is merely an alternate 
spelling.  And the word ON is merely an alternate spelling of AND (plus some 
parenthesis -- you put parenthesis around the existing WHERE clause, put 
parenthesis around the ON clause, change the word ON to AND, and tack the 
result to the end of the (now parenthesized) WHERE clause).  

Using "commas" instead of "JOIN" there is no way to specify a particular join 
type, so "," always means "INNER JOIN" -- so if you need to specify a JOIN type 
other than an plain projection (inner) you must use the table " 
table" specification.  Except for OUTER JOIN operations, the ON clause is 
merely a WHERE condition (in outer joins the ON clause binds the table that is 
being outer joined).  In the olden days one used the special operator *= or =* 
or *=* to indicate outer joins in the where clause).  The ON clause does not 
even need to contain references to tables that have already been mentioned 
since they are merely syntactic sugar.  You can even have one without using the 
word JOIN at all as in "SELECT a,b,c FROM x,y,z ON x.a = y.b and y.g = z.c 
WHERE z.c = 5 or x.a = 3" which translates to "SELECT a,b,c FROM x,y,z WHERE 
(z.c = 5 or x.a = 3) and x.a = y.b and y.g = z.c"

You will notice that all the things in the SELECT statement are defined as "I 
want".  This is what makes SQL a declarative language -- you declare what you 
want, and it figures out how to go get it.

>Also, it looks like you are using aliasing to shorten the query strings -
>true or false?

Yes.  The tables are aliased and the as keyword is omitted.

>‐‐‐ Original Message ‐‐‐
>On Tuesday, September 3, 2019 7:32 AM, John G 
>wrote:
>
>> Or without the added calories (syntactic sugar) :
>>
>> select a., b.
>> from author_books ab, author a, books b
>> where a.author_id = ab.author_id
>> and b.book_isbn = ab.book_isbn
>>
>> On Tue, 27 Aug 2019 at 15:52, David Raymond david.raym...@tomtom.com
>> wrote:
>>
>> > It does support natural joins. > > changes" comments here>
>> > USING needs parenthesis around the column list: ...using
>> > (author_id)...using (book_isbn)...
>> > -Original Message-
>> > From: sqlite-users sqlite-users-boun...@mailinglists.sqlite.org On
>> > Behalf Of Dominique Devienne
>> > Sent: Tuesday, August 27, 2019 10:08 AM
>> > To: SQLite mailing list sqlite-users@mailinglists.sqlite.org
>> > Subject: Re: [sqlite] Query for Many to Many
>> > On Tue, Aug 27, 2019 at 4:00 PM Dominique Devienne ddevie...@gmail.com
>> > wrote:
>> >
>> > > select author., books.
>> > > from author_books
>> > > join author on author.author_id = author_books.author_id
>> > > join books on books.book_isbn = author_books.book_isbn
>> >
>> > Which can also be written:
>> > select author., books.
>> > from author_books
>> > join author using author_id
>> > join books using book_isbn
>> > Or even:
>> > select author., books.
>> > from author_books
>> > natural join author
>> > natural join books
>> > All of the above untested of course :).
>> > Not even sure SQLite supports natural join or not (I'd guess it does).
>--DD
>> > https://stackoverflow.com/questions/45531762/sql-join-using-vs-join-on
>> > https://stackoverflow.com/questions/8696383/difference-between-natural-
>join-and-inner-join
>> >
>> > 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
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Query for Many to Many

2019-09-03 Thread dboland9
Thanks for the info.  As I understand things, this is an implicit join.  I did 
try it, and it works just fine.  However, in my reading it appears that 
implicit joins are discouraged, and will only do left joins.

Also, it looks like you are using aliasing to shorten the query strings - true 
or false?

Dave,


Sent with ProtonMail Secure Email.

‐‐‐ Original Message ‐‐‐
On Tuesday, September 3, 2019 7:32 AM, John G  wrote:

> Or without the added calories (syntactic sugar) :
>
> select a., b.
> from author_books ab, author a, books b
> where a.author_id = ab.author_id
> and b.book_isbn = ab.book_isbn
>
> On Tue, 27 Aug 2019 at 15:52, David Raymond david.raym...@tomtom.com
> wrote:
>
> > It does support natural joins.  > changes" comments here>
> > USING needs parenthesis around the column list: ...using
> > (author_id)...using (book_isbn)...
> > -Original Message-
> > From: sqlite-users sqlite-users-boun...@mailinglists.sqlite.org On
> > Behalf Of Dominique Devienne
> > Sent: Tuesday, August 27, 2019 10:08 AM
> > To: SQLite mailing list sqlite-users@mailinglists.sqlite.org
> > Subject: Re: [sqlite] Query for Many to Many
> > On Tue, Aug 27, 2019 at 4:00 PM Dominique Devienne ddevie...@gmail.com
> > wrote:
> >
> > > select author., books.
> > > from author_books
> > > join author on author.author_id = author_books.author_id
> > > join books on books.book_isbn = author_books.book_isbn
> >
> > Which can also be written:
> > select author., books.
> > from author_books
> > join author using author_id
> > join books using book_isbn
> > Or even:
> > select author., books.
> > from author_books
> > natural join author
> > natural join books
> > All of the above untested of course :).
> > Not even sure SQLite supports natural join or not (I'd guess it does). --DD
> > https://stackoverflow.com/questions/45531762/sql-join-using-vs-join-on
> > https://stackoverflow.com/questions/8696383/difference-between-natural-join-and-inner-join
> >
> > 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] sqlite: see: encryption

2019-09-03 Thread Kees Nuyt
On Tue, 3 Sep 2019 12:11:32 +0530, Vadiraj Villivalam wrote:

> Hi,
>
> Our client software uses sqlite for persistence and db is currently
> encrypted by passing a app generated key to SEE.
> With the open os like android providing keystore and key generation
> mechanism, we want to switch to this secure key generation mechanism and
> avoid generating  key ourselves. As the key store does not allow the key
> itself to be exported out, I would like to know if sqlite has a mechanism
> to leverage the key store way of en/decrypting it (could be with a callback
> implemented by app that interfaces with Android keystore)? Any insight will
> help. Thanks.

This article may be of help. It also talks about limitations,
e.g. "The Keystore itself is encrypted using the user’s own
lockscreen pin/password, hence, when the device screen is locked
the Keystore is unavailable. Keep this in mind if you have a
background service that could need to access your application
secrets."



It is the first hit in a search on "android keystore api
tutorial".

Hope this helps.

-- 
Regards,
Kees Nuyt

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


Re: [sqlite] Query for Many to Many

2019-09-03 Thread John G
Or without the added calories (syntactic sugar) :

select a.*, b.*
from author_books ab, author a, books b
where  a.author_id  = ab.author_id
  and  b.book_isbn = ab.book_isbn

On Tue, 27 Aug 2019 at 15:52, David Raymond 
wrote:

> It does support natural joins.  changes" comments here>
>
> USING needs parenthesis around the column list: ...using
> (author_id)...using (book_isbn)...
>
>
> -Original Message-
> From: sqlite-users  On
> Behalf Of Dominique Devienne
> Sent: Tuesday, August 27, 2019 10:08 AM
> To: SQLite mailing list 
> Subject: Re: [sqlite] Query for Many to Many
>
> On Tue, Aug 27, 2019 at 4:00 PM Dominique Devienne 
> wrote:
>
> > select author.*, books.*
> >   from author_books
> >   join author on author.author_id  = author_books.author_id
> >   join books  on books.book_isbn   = author_books.book_isbn
> >
>
> Which can also be written:
>
> select author.*, books.*
>   from author_books
>   join author using author_id
>   join books  using book_isbn
>
> Or even:
>
> select author.*, books.*
>   from author_books
>   natural join author
>   natural join books
>
> All of the above untested of course :).
> Not even sure SQLite supports natural join or not (I'd guess it does). --DD
>
> https://stackoverflow.com/questions/45531762/sql-join-using-vs-join-on
>
> https://stackoverflow.com/questions/8696383/difference-between-natural-join-and-inner-join
> ___
> 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] INSERT vs BEGIN

2019-09-03 Thread Dominique Devienne
On Tue, Sep 3, 2019 at 12:03 PM Rob Richardson 
wrote:

> I didn't know it is possible to insert multiple rows into a table using a
> command like this.


Added over 7 years ago: See
https://www.sqlite.org/changes.html#version_3_7_11 #1


> Is this just an SQLite feature, or is this part of the SQL standard?


I suspect it's non-standard, since Oracle does not support it. But it's
just a guess on my part. --DD
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite: see: encryption

2019-09-03 Thread Simon Slavin
On 3 Sep 2019, at 7:41am, Vadiraj Villivalam 
 wrote:

> As the key store does not allow the key
> itself to be exported out, I would like to know if sqlite has a mechanism to 
> leverage the key store way of en/decrypting it (could be with a callback 
> implemented by app that interfaces with Android keystore)? Any insight will 
> help.

Can you write code in C/C++ to retrieve the key from the key store ?  If so, 
you can provide the key to SQLite by creating your own SQLite function which 
does that.



In your case, the function can ignore any argumnets.  Or perhaps you could pass 
the key for your encryption hash.

I've found it difficult to find examples of this on the web.  Perhaps if you 
tell us your programming language someone else can find one.  Or perhaps this 
will do:


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


Re: [sqlite] INSERT vs BEGIN

2019-09-03 Thread Rob Richardson
I didn't know it is possible to insert multiple rows into a table using a
command like this.  Is this just an SQLite feature, or is this part of the
SQL standard?

RobR

On Mon, Sep 2, 2019 at 8:14 AM Dominique Devienne 
wrote:

> On Mon, Sep 2, 2019 at 12:52 PM Simon Slavin  wrote:
>
> > > One must know that I am obliged to use "BEGIN DEFERRED TRANSACTION"
> > because others threads needs to access to tables.
> > SQLite copes very well when you have one connection writing to the
> > database and other connections reading.  The problems come when you have
> > two connections writing to the database at once.
> >
>
> In WAL mode only! Otherwise readers are blocked when the writer is active,
> and readers prevent the writer from proceeding. --DD
> ___
> 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] sqlite: see: encryption

2019-09-03 Thread Vadiraj Villivalam
Hi,

Our client software uses sqlite for persistence and db is currently
encrypted by passing a app generated key to SEE.
With the open os like android providing keystore and key generation
mechanism, we want to switch to this secure key generation mechanism and
avoid generating  key ourselves. As the key store does not allow the key
itself to be exported out, I would like to know if sqlite has a mechanism
to leverage the key store way of en/decrypting it (could be with a callback
implemented by app that interfaces with Android keystore)? Any insight will
help. Thanks.

Regards,
Vadiraj

-- 


Your privacy is important to us. That is why we have taken appropriate 
measures to ensure the data you provide to us is kept secure. To learn more 
about how we process your personal information, how we comply with 
applicable data protection laws, and care for the security and privacy of 
your personal data, please review our Privacy Policy 
.
 
If you have any questions related to data protection and compliance with 
applicable laws, please contact us at our Security Operations Center at 
1-302-444-9838 or mail us at: 

Attention: Privacy Compliance Program, P.O. 
Box 59263, Schaumburg, IL USA, 60159-0263
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Tutorial on SQLite Internals - 2019-11-05 in Houston, TX

2019-09-03 Thread Philip Bennefall
I will unfortunately not be able to participate, but I am wondering if 
it will be recorded and put on YouTube or similar? I have seen some 
talks of yours from TCL and other conferences and enjoyed them very much.



Kind regards,


Philip Bennefall


On 9/3/2019 3:12 AM, Richard Hipp wrote:

There will be a full-day tutorial on SQLite Internals on Tuesday
2019-11-05 in Houston TX. See details at:

https://www.tcl.tk/community/tcl2019/tutorials.html#drh:sqlite-tour1

This will be an intensive tutorial.  Bring your laptop, with a
C-compiler already installed, and also with TCL development libraries
(needed to compile SQLite from canonical sources) and Fossil
installed, and be comfortable using the compiler tools before you
arrive, as we have a lot of ground to cover and will need to move
quickly.

This tutorial is part of the 2019 Tcl/Tk conference, which will
continue on the following three days.  To maximize your learning
experience, plan stay as long as you can, as these events normally
involve a lot of socializing with a group of very smart people.

I will be giving the tutorial (obviously) but I am not a conference
organizer and am not up on all the details.  If you have questions,
please ask and I will see if I can find answers.  Or, some of the
conference organizers are on this mailing list, so perhaps they will
speak up.



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