Re: [sqlite] --disable-threadsafe broken in 3.25.x

2018-10-01 Thread Tim Streater
On 01 Oct 2018, at 21:02, Fabrice Fontaine  wrote:

> Please find attached a patch fixing this issue. As this is my first
> contibution to sqlite, please excuse me if I made any mistakes.

Don't send attachment (not allowed), include it inline.


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


[sqlite] --disable-threadsafe broken in 3.25.x

2018-10-01 Thread Fabrice Fontaine
Dear all,

Since commit
https://github.com/mackyle/sqlite/commit/de41277e946d250b2d7331b6fe4addd22525d33
(and so since 3.25.x), --disable-threadsafe is broken in sqlite-autoconf.

Indeed, the following line was removed:
THREADSAFE_FLAGS=-DSQLITE_THREADSAFE=0

This line was setting the default value and as a result, if
--disable-threadsafe is set, no value is given to SQLITE_THREADSAFE and it
takes a default value of 1.

Please find attached a patch fixing this issue. As this is my first
contibution to sqlite, please excuse me if I made any mistakes.

Best Regards,

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


Re: [sqlite] DB To DB Transfer Time

2018-10-01 Thread Jens Alfke


> On Sep 25, 2018, at 11:14 AM, dmp  wrote:
> 
> The result for the 50K file db test of SQLite was 370.184
> seconds. Is this a reasonable transfer speed, given the
> conditions noted?

You haven’t specified how much of that time was spent in SQLite. For all we 
know, 370 seconds was spent in MariaDB and your own code, and it only took .184 
sec for SQLite to insert the rows :)

Try running your code with a profiler. Or at least wrap some quick & dirty 
timing code around your functions that call SQLite.

Also, make sure to insert as many rows as possible within a transaction. 
Committing a transaction in SQLite is quite expensive due to filesystem 
flushing.

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


Re: [sqlite] storing unsigned 64 bit values

2018-10-01 Thread Jens Alfke


> On Sep 27, 2018, at 3:53 AM, Conor Lennon  wrote:
> 
> The problem that I have is retrieving the value using c bindings.
> I'm calling sqlite3_column_int64.
> ...
> When I call the function it returns back 9223372036854775807, which is the 
> maximum size of a signed 64 bit integer (one less than 2 to the power of 63)

How did you store the number? If you called sqlite3_bind_int64, then the value 
should survive the round-trip unscathed, even though SQLite will interpret the 
value as signed. But it’s still the same 64-bit pattern, and if you cast it 
from/to uint64_t it’ll work. (The only problem is that SQLite will think it’s a 
negative number, so sorting and some arithmetic won’t work properly. Addition 
and subtraction will, though.)

But it sounds like you added the value literally to the SQL statement; this is 
a bad idea for many reasons. It’s more expensive to run the query because it 
has to be parsed every single time, you don’t get type-checking or even 
syntax-checking, and if you ever try to do this with strings instead of ints, 
you can easily open yourself up to SQL-injection attacks. Don’t do it!

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


Re: [sqlite] read and write locking

2018-10-01 Thread David Raymond
Short version: The database will need to be in WAL mode
https://www.sqlite.org/wal.html


-Original Message-
From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On 
Behalf Of p...@geniais.com
Sent: Monday, October 01, 2018 9:57 AM
To: sqlite-users@mailinglists.sqlite.org
Subject: [sqlite] read and write locking

Hello,
When I try to do a search from one script, returns not found when 
another script is writing, even though it is in another record.
How can I make the script that are writing leave free to others for read 
only?

Thank you
Ismael


___
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] read and write locking

2018-10-01 Thread p...@geniais.com

Hello,
When I try to do a search from one script, returns not found when 
another script is writing, even though it is in another record.
How can I make the script that are writing leave free to others for read 
only?


Thank you
Ismael


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


Re: [sqlite] .separator and .mode commands interactions

2018-10-01 Thread Clemens Ladisch
Luc Charansonney wrote:
> sqlite> .separator tabs

  sqlite> select 1, 2;
  1tabs2

> sqlite> .import mydata.txt mytable
> Error: multi-character column separators not allowed for import

You should have used ".separator \t".

> So I fall back on my feet by using .mode instead of .separator:
> sqlite> .mode tabs
> sqlite> .import mydata.txt mytable

The .mode command expects a name, but .separator the actual characters.

The modes have more differences than the separators, but that's mostly
for output.  As far as .import is concerned, the only mode with special
behaviour is "ascii" (which does not use CSV quoting rules).


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


[sqlite] .separator and .mode commands interactions

2018-10-01 Thread Luc Charansonney
Hello,

I apologize if the question has already been asked before, but I need some 
clarification on the use of .mode and .separator relatively to the .import 
command.

Say I have a structured tab-separated text file "mydata.txt" I want to import 
into a database using the .import FILE TABLE command. If I refer to the 
documentation obtained by typing ".help" in the SQLite shell, it states :
.separator COL ?ROW?   Change the column separator and optionally the row 
separator for both the output mode and .import

But this is in apparent contradiction with the Command Line Shell help :
"Note that it is important to set the "mode" to "csv" before running the 
".import" command. This is necessary to prevent the command-line shell from 
trying to interpret the input file text as some other format. "
https://sqlite.org/cli.html

So, if I use .separator, as hinted by the built-in .help command, I get the 
following
sqlite> .separator tabs
sqlite> .import mydata.txt mytable
I get the following error :
Error: multi-character column separators not allowed for import

So I fall back on my feet by using .mode instead of .separator:
sqlite> .mode tabs
sqlite> .import mydata.txt mytable

But I'd like to understand why .separator does not behave the way I expect it 
to? Is it because there is confusion between the default ".mode" (which is 
comma-separated) onto which I impose a tab through ".separator"?

Thanks for your explanations, and for this great piece of software.

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


Re: [sqlite] Issue altering table name

2018-10-01 Thread Dan Kennedy

On 09/30/2018 06:59 PM, Luke Amery wrote:

Hi sqliters,

Is this a bug?

sqlite> SELECT sqlite_version();
3.25.1
sqlite> CREATE TABLE x(f1 integer NOT NULL PRIMARY KEY);
sqlite> CREATE VIEW y AS SELECT f1 AS f1 FROM x;
sqlite> CREATE TRIGGER t INSTEAD OF UPDATE OF f1 ON y BEGIN UPDATE x SET f1
= NEW.f1; END;
sqlite> CREATE TABLE z (f1 integer NOT NULL PRIMARY KEY);
sqlite> ALTER TABLE z RENAME TO z2;
Error: error in trigger t: no such column: NEW.f1

My expectation is the new alter table logic would notice this is an instead
of trigger where NEW has special significance and not block my attempt to
rename an unrelated table.


Thanks for reporting this one. Now fixed here:

  https://www.sqlite.org/src/info/c52f457e56eb9d57

Dan.


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


Re: [sqlite] Calling sqlite3_create_module from a DLL

2018-10-01 Thread Clemens Ladisch
Deon Brewis wrote:
> I have a DLL that makes a series of sqlite3_create_function_v2 calls.
> It all works fine and the DLL is usable.
>
> I've tried adding a sqlite3_create_module into the same DLL, but I get
> an assert in:
>
> sqlite3_mutex_try
> over here:
> assert( sqlite3GlobalConfig.mutex.xMutexTry );
>
> xMutexTry (really all the .mutex callbacks) are null.
>
> I'm trying to call create_module during my sqlite3_extension_init
> export, directly after my call to SQLITE_EXTENSION_INIT2(pApi);

Apparently, you did not call sqlite3_initialize().
 says:
| For maximum portability, it is recommended that applications always
| invoke sqlite3_initialize() directly prior to using any other SQLite
| interface.


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