Re: [sqlite] Running query in command window is slow

2017-09-21 Thread Frank Millman
Clemens Ladisch wrote: > > > Frank Millman wrote: > > I have a fairly complex query. If I execute it using Python, it takes > > 1 second. If I copy and paste it into the Sqlite3 command window, it > > takes 10 minutes. > > Probably different SQLite versions. > > What is the EXPLAIN QUERY PLAN ou

Re: [sqlite] Running query in command window is slow

2017-09-21 Thread Clemens Ladisch
Frank Millman wrote: > I have a fairly complex query. If I execute it using Python, it takes > 1 second. If I copy and paste it into the Sqlite3 command window, it > takes 10 minutes. Probably different SQLite versions. What is the EXPLAIN QUERY PLAN output in both cases? Regards, Clemens _

[sqlite] Running query in command window is slow

2017-09-21 Thread Frank Millman
Hi all I am running Python 3.6.0 and Sqlite3 3.8.6 on Windows 10. I have a fairly complex query. If I execute it using Python, it takes 1 second. If I copy and paste it into the Sqlite3 command window, it takes 10 minutes. I am not too bothered – it is the Python one that is important. Still, i

Re: [sqlite] How does SQLite handle \r and \n in values?

2017-09-21 Thread heribert
The used developing environment is an old one, this may case this error. I'm currently adding some new features to application compiled with MS VC98. The strings i'm using are UTF8-coded. I will mail a short sample and  the resulting error code today. Am 21.09.2017 um 20:18 schrieb Simon Slavin

Re: [sqlite] 'database disk image is malformed' only on the mac

2017-09-21 Thread Keith Medcalf
>#define SQLITE_ENABLE_FTS3 1 >#define SQLITE_OMIT_DEPRECATED 1 >#define SQLITE_OMIT_SHARED_CACHE 1 >#define SQLITE_OMIT_AUTOMATIC_INDEX 1 >#define SQLITE_OMIT_DECLTYPE 1 > >#define SQLITE_DEFAULT_MMAP_SIZE 0 >#define SQLITE_DEFAULT_MEMSTATUS 0 >#define SQLITE_DEFAULT_SYNCHRONOUS 1 > >#define SQLIT

Re: [sqlite] Create table - Error code: 21

2017-09-21 Thread Papa
The SQLite3 wrapper class and the client class use std::wstring, however, the wrapper performs the necessary conversion to std::string::data(), before submitting the requests to SQLite3. Nice of you to notice this provable cause. Thanks so much for the help. On 2017-09-21 5:37 PM, Keith Medca

Re: [sqlite] Create table - Error code: 21

2017-09-21 Thread Papa
Sorry, I realized that the example provided in my last email was not as complete as it should have been. I hope the below example would do a better job. - namespace jme{ class Person{ .     std::wstring wapstr; //!< All Purpose Wide String     // Database     s

Re: [sqlite] Create table - Error code: 21

2017-09-21 Thread Keith Medcalf
>> convert->toString >Please check this function to make sure it does what you think it >does. What happens if you leave it out and process the raw C string >instead ? You would have to change the string definition to a "normal" ASCII string. It is currently defined as UCS-2 characters and sq

Re: [sqlite] Create table - Error code: 21

2017-09-21 Thread Papa
Thanks for your help, in regards to your suggestion, here is the actual method that makes the call to createTable. void Person::CreateTable() {     try {     // Name's data     wapstr = L"CREATE TABLE ";     wapstr += table_name;     wapstr += L"(";     wapstr += L"id INT PRI

Re: [sqlite] How does SQLite handle \r and \n in values?

2017-09-21 Thread Simon Slavin
On 21 Sep 2017, at 5:00pm, heribert wrote: > I'm using c++ and generate the whole insert string via sqlite3_vmprintf with > quoted text. So the '\r' and '\n' are single characters - this will result in > the error. Something is wrong with your development environment. SQLite has no clue wha

Re: [sqlite] 'database disk image is malformed' only on the mac

2017-09-21 Thread Dan Kennedy
On 09/21/2017 04:20 AM, Fahad wrote: Thanks Jens, yes I didn't take the warnings from the Thread Sanitizer lightly. Although I'm very confident with the actual implementation (using thread local dictionaries) and have verified time and again using unit tests that my code is otherwise thread-safe,

Re: [sqlite] How does SQLite handle \r and \n in values?

2017-09-21 Thread R Smith
On 2017/09/21 3:56 PM, heribert wrote: Hello, i attempt to make a INSERT with a TEXT field containing a string with \r and \n characters, but it fails (Strings without \r and \n characters are inserted correct). The sqlite3_exec results with error... i think the reason are the special charact

Re: [sqlite] How does SQLite handle \r and \n in values?

2017-09-21 Thread heribert
I'm using c++ and generate the whole insert string via sqlite3_vmprintf with quoted text. So the '\r' and '\n' are single characters - this will result in the error. @J.King: I followed your hint to bind the values. Works now as expected. The c strings are now correctly inserted. Am 21.09.2017

Re: [sqlite] How does SQLite handle \r and \n in values?

2017-09-21 Thread Richard Hipp
On 9/21/17, heribert wrote: > > i attempt to make a INSERT with a TEXT field containing a string with \r > and \n characters, but it fails (Strings without \r and \n characters > are inserted correct). > The sqlite3_exec results with error... i think the reason are the > special characters. The S

Re: [sqlite] How does SQLite handle \r and \n in values?

2017-09-21 Thread J. King
More details would help. How are you inserting the data? Are you using a bound parameter (you should be), or quoted text? Are you using something other than the C interface to interact with the database? Which error did you receive? Can you provide a minimal example of the code you used? On Sep

Re: [sqlite] How does SQLite handle \r and \n in values?

2017-09-21 Thread Bart Smissaert
I needed this recently and for a line break this worked: 'text before linebreak' || char(10) || 'text after linebreak' RBS On Thu, Sep 21, 2017 at 2:56 PM, heribert wrote: > Hello, > > i attempt to make a INSERT with a TEXT field containing a string with \r > and \n characters, but it fails (

[sqlite] How does SQLite handle \r and \n in values?

2017-09-21 Thread heribert
Hello, i attempt to make a INSERT with a TEXT field containing a string with \r and \n characters, but it fails (Strings without \r and \n characters are inserted correct). The sqlite3_exec results with error... i think the reason are the special characters. What is the correct way to store st

Re: [sqlite] SqLite Metadata information

2017-09-21 Thread David Raymond
1. Charset - character set used in the database http://www.sqlite.org/pragma.html#pragma_encoding Though as someone mentioned this is just the internal representation, and not necessarily what you'll get back from your language of choice. 2. Collation - Collation method used in the da

Re: [sqlite] Create table - Error code: 21

2017-09-21 Thread R Smith
On 2017/09/21 10:07 AM, Papa wrote: The code shows what I have done to create a table, but ::sqlite3_prepare_v2 tells me: --- Exception --- Error message from SQLite3 - bad parameter or other API misuse Error code: 21 Perhaps show us the entire

Re: [sqlite] Create table - Error code: 21

2017-09-21 Thread Kees Nuyt
On Thu, 21 Sep 2017 04:07:36 -0400, Papa wrote: Just a side-note: >     wapstr += L"id INT PRIMARY KEY NOT NULL, "; "INT PRIMARY KEY" is not enough to create an alias for ROWID, that only happenes with "INTEGER PRIMARY KEY" : ~ $ sqlite3 test.sqlite SQLite version 3.21.0 2

Re: [sqlite] 'database disk image is malformed' only on the mac

2017-09-21 Thread Kees Nuyt
On Wed, 20 Sep 2017 06:41:05 -0700 (MST), Fahad wrote: [...] > 1) Thread A: Create a new connection, if one already does not exist for the > thread. Store it's 'reference count' in the thread storage (I close a > connection when the count becomes zero). > 2) Thread A: Get a previously stored stat

Re: [sqlite] [EXTERNAL] Create table - Error code: 21

2017-09-21 Thread Hick Gunter
My guess is that you are not connecting to any database file, i.e. calling the constructor without a file name AND not calling the openCreateDatabase method before attemting to create a table. BTW: Your data model assumes a "Name" may have only 1 street address, but up to 4 telephone numbers a

Re: [sqlite] [EXTERNAL] Re: sqlite3_stmt limitations

2017-09-21 Thread R Smith
On Wed, Sep 20, 2017 at 1:41 PM, heribert wrote: Do i have to open a database connection for each threat? Only if you work at the NSA. (It's the answer everyone else wanted to post, but maturely refrained from doing... I was weak, sorry!) ___ s

Re: [sqlite] Create table - Error code: 21

2017-09-21 Thread Simon Slavin
On 21 Sep 2017, at 9:07am, Papa wrote: > convert->toString Please check this function to make sure it does what you think it does. What happens if you leave it out and process the raw C string instead ? Also check what Clemens wrong. What happens if you try to close the db connection at t

Re: [sqlite] 'database disk image is malformed' only on the mac

2017-09-21 Thread Fahad
Thanks Jens, yes I didn't take the warnings from the Thread Sanitizer lightly. Although I'm very confident with the actual implementation (using thread local dictionaries) and have verified time and again using unit tests that my code is otherwise thread-safe, I really do think there are perhaps ce

Re: [sqlite] 'database disk image is malformed' only on the mac

2017-09-21 Thread Fahad
No I'm not. -- 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

[sqlite] sqlite-3.20.1: test/date.test fails on i686 target due to FPU wibbles

2017-09-21 Thread Sergei Trofimovich
The original bug is reported as https://bugs.gentoo.org/628242 I think test fails due to slight precision variation caused by FPU being 80-bit internally. If we add the following to CFLAGS, then: -mfpmath=387 (default on i686): test fails -mfpmath=sse (default on x86_64): test passes Quick repro

Re: [sqlite] Wanting to return REAL as formatted TEXT [SOLVED]

2017-09-21 Thread Robert W.Mills
@Richard & @John,     Have just tried that and it works just how I wanted it. Will have to make the same change for the INTEGER columns as well. @Keith,     We came to the conclusion that USAGE FLOAT-LONG was the best thing to use. I then had the problem in deciding what picture to use for the '

Re: [sqlite] Create table - Error code: 21

2017-09-21 Thread Clemens Ladisch
Papa wrote: > // *** THE ERROR IS HERE > this->rc = ::sqlite3_prepare_v2(db, > convert->toString(sql_statement_request).c_str(), -1, &binary_sql_statement, > NULL); > if (this->rc != SQLITE_OK) { > this->apstr = "Error message from SQLite3 "; > thi

[sqlite] Create table - Error code: 21

2017-09-21 Thread Papa
void myClass::CreateTable() {     try {     // Name's data     wapstr = L"CREATE TABLE ";     wapstr += table_name;     wapstr += L"(";     wapstr += L"id INT PRIMARY KEY NOT NULL, ";     wapstr += L"title_name TEXT, ";     wapstr += L"first_name TEXT, ";     wapstr