Re: [sqlite] Weird issue with the query

2016-12-02 Thread Igor Korot
Simon, On Fri, Dec 2, 2016 at 9:47 PM, Simon Slavin wrote: > > On 3 Dec 2016, at 2:44am, Igor Korot wrote: > >> Ok so in order to fix it I should assign the result of conversion to some >> variable? > > It might be simpler to use SQLITE_TRANSIENT instead of SQLITE_STATIC. > >

Re: [sqlite] Weird issue with the query

2016-12-02 Thread Igor Korot
Igor Ok so in order to fix it I should assign the result of conversion to some variable? Thank you. On Dec 2, 2016 9:07 PM, "Igor Tandetnik" wrote: On 12/2/2016 8:39 PM, Igor Tandetnik wrote: > On 12/2/2016 6:56 PM, Igor Korot wrote: > >> res = sqlite3_bind_text( stmt, 1, >> sqlite_pim

Re: [sqlite] Weird issue with the query

2016-12-02 Thread Simon Slavin
On 3 Dec 2016, at 2:44am, Igor Korot wrote: > Ok so in order to fix it I should assign the result of conversion to some > variable? It might be simpler to use SQLITE_TRANSIENT instead of SQLITE_STATIC. Simon. ___

Re: [sqlite] Weird issue with the query

2016-12-02 Thread Igor Korot
Igor Ok so in order to fix it I should assign the result of conversion to some variable? Thank you. On Dec 2, 2016 9:07 PM, "Igor Tandetnik" wrote: > On 12/2/2016 8:39 PM, Igor Tandetnik wrote: > >> On 12/2/2016 6:56 PM, Igor Korot wrote: >> >>> res = sqlite3_bind_text( stmt, 1, >>> sql

Re: [sqlite] Weird issue with the query

2016-12-02 Thread Igor Tandetnik
On 12/2/2016 8:39 PM, Igor Tandetnik wrote: On 12/2/2016 6:56 PM, Igor Korot wrote: res = sqlite3_bind_text( stmt, 1, sqlite_pimpl->m_myconv.to_bytes( tableName.c_str() ).c_str(), -1, SQLITE_STATIC ); SQLITE_STATIC tells SQLite that the string will outlive the statement handle. But in

Re: [sqlite] Weird issue with the query

2016-12-02 Thread Igor Tandetnik
On 12/2/2016 6:56 PM, Igor Korot wrote: res = sqlite3_bind_text( stmt, 1, sqlite_pimpl->m_myconv.to_bytes( tableName.c_str() ).c_str(), -1, SQLITE_STATIC ); SQLITE_STATIC tells SQLite that the string will outlive the statement handle. But in fact, you are passing a temporary buffer, de

Re: [sqlite] Weird issue with the query

2016-12-02 Thread Igor Korot
On Fri, Dec 2, 2016 at 6:56 PM, Igor Korot wrote: > Hi, ALL, > I wrote following code in C++ (error checking removed for clarity): > > [code] > const std::wstring &SQLiteDatabase::GetTableComments(const > std::wstring &tableName, std::vector &errorMsg) > { > std::wstring comment = L""; > s

[sqlite] Weird issue with the query

2016-12-02 Thread Igor Korot
Hi, ALL, I wrote following code in C++ (error checking removed for clarity): [code] const std::wstring &SQLiteDatabase::GetTableComments(const std::wstring &tableName, std::vector &errorMsg) { std::wstring comment = L""; sqlite3_stmt *stmt = NULL; std::wstring errorMessage; std::ws

Re: [sqlite] Datatype for prices (1,500)

2016-12-02 Thread Warren Young
On Nov 30, 2016, at 6:53 PM, Keith Medcalf wrote: > > sqlite> SELECT CASE WHEN (SELECT feq(0, sum(amount)) FROM transactions) What’s feq()? I don’t see it in the SQLite documentation. ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org

[sqlite] Scope of sqlite3_update_hook?

2016-12-02 Thread Jens Alfke
Does a registered sqlite3_update_hook get called when _any_ SQLite connection modifies the database, or just the connection it's registered with? If so, then does that include connections in other OS processes? (I'm looking for a way to detect this.) --Jens [via iPhone]

Re: [sqlite] Datatype for prices (1,500)

2016-12-02 Thread Chris Locke
PHP will easily display a value with trailing zeros - you don't add '00' programmatically. eg: $number = number_format(1234, 2, '.', ''); On Thu, Dec 1, 2016 at 8:08 AM, Werner Kleiner wrote: > As I can see storing prices is a topic with different ways and > different solutions. > > The advic

Re: [sqlite] Datatype for prices (1,500)

2016-12-02 Thread Stephen Chrzanowski
Werner ; In whatever language you use, how do you store a number? How do you display that number? How do you take that set of bytes at a particular memory location and get it to the users eyeballs? You have to format it. Your software converts that list of bytes into something human readable, b

Re: [sqlite] Datatype for prices (1,500)

2016-12-02 Thread Dominique Devienne
On Fri, Dec 2, 2016 at 1:01 PM, Werner Kleiner wrote: > @Darren, > > my "problem" is, that the both trailing zeros 00 after 1.5 are > missing in sqlite. In MySQL the price is stored as 1.500 > Do the printf transparently via a view in front of your table? --DD C:\Users\DDevienne>sqlite3 SQLite

Re: [sqlite] *** suspected spam or bulk *** Re: Datatype for prices (1, 500)

2016-12-02 Thread Hick Gunter
Assuming the OPs native language is German: Lieber Freund, Du hast kein Problem mit der Speicherung sondern mit der Darstellung der Werte. MySQL übernimmt aufgrund der Typangabe "decimal(7,4)" die Darstellung/Formatierung der Werte. Vor dem Speichern wird der Wert so skaliert, dass immer ganzz

Re: [sqlite] Datatype for prices (1,500)

2016-12-02 Thread Werner Kleiner
@Darren, my "problem" is, that the both trailing zeros 00 after 1.5 are missing in sqlite In MySQL the price is stored as 1.500 I do not undestand exact what you mean with multiply the number? If I multiply 1.5 x 1 with PHP before storing in sqlite then I get 15000? best regards Werner 201

Re: [sqlite] Datatype for prices (1,500)

2016-12-02 Thread R Smith
On 2016/12/01 10:08 AM, Werner Kleiner wrote: As I can see storing prices is a topic with different ways and different solutions. The advice to store prices in Cent or Integer: Yes you can do: but how will you sore hundredth cents amounts or tenth cent prices? I have prices like 0,0020 or 0,000