[sqlite] application for initial charge

2016-04-09 Thread Jean-Christophe Deschamps
At 07:14 09/04/2016, you wrote:
>I have implemented an application with Lazarus+FPCompiler, using SQLite
>tables, and the information was obtained from Excel tables previously 
>done.
>
>I hope it would be very simple to prepare in the former Excel tables a 
>sheet
>with the information required by my application and "charge it" instead of
>the manual introduction as now.
>
>Please, if somebody knows something about this aspect, I will appreciate
>very much any information.

I would use a powerful scripting language for that, AutoIt, which makes 
it very easy to interface SQLite and automate Excel as well.
See https://www.autoitscript.com/site/autoit/

--
jcd 



[sqlite] regression in 3.12.0 vs. 3.11.0, column type information in PRAGMA missing

2016-04-09 Thread Mike Bayer


On 04/06/2016 10:33 AM, Richard Hipp wrote:
> On 4/4/16, Mike Bayer  wrote:
>> The "type" column in PRAGMA table_info() is now a blank string when the
>> target object is a view in 3.12.0. In 3.11.0 and prior versions, the
>> typing information is returned,
>>
>
> I think the problem is fixed by this checkin:
> https://www.sqlite.org/src/info/fb555c3c2af7f5e6
>
> Please confirm.

Can confirm my user's issue is resolved by version 3.12.1 thanks for the 
quick turnaround!



>


[sqlite] sqlite error 25 during bind

2016-04-09 Thread Kumar Suraj
Yes i am calling sqlite3_prepare_v2

 snprintf(command, 512, INSERT_DN);
if ( (rv = sqlite3_prepare_v2(sqlHandle->db, command, -1,
 , NULL) ) != SQLITE_OK )
{
   fprintf(stderr, "Error Insert : sqlite3_prepare_v2, Error code :
%d\n", rv);
   sqlite3_finalize(newStmt);
   return rv;
}
rv = sqlite3_bind_blob(newStmt, 1, aInBuffer.ptr, aInBuffer.size,
SQLITE_STATIC);
if (rv != SQLITE_OK)
{
fprintf(stderr, "Error Insert : sqlite3_bind_blob, Error code :
%d\n", rv);
sqlite3_finalize(newStmt);
return rv;
}
rv = sqlite3_bind_int(newStmt, 2 , aInClassId);
if (rv != SQLITE_OK)
{
fprintf(stderr, "Error Insert : sqlite3_bind_int, Error code :
%d\n", rv);
sqlite3_finalize(newStmt);
return rv;
}


On Wed, Apr 6, 2016 at 4:55 PM, Simon Davies 
wrote:

> On 6 April 2016 at 12:16, Kumar Suraj  wrote:
> > Hi
> .
> .
> .
> > Here is table definition and insert statement which is causing this
> >
> > #define CREATE_TABLE_DNINDEX "CREATE TABLE IF NOT EXISTS TBL (dn BLOB,
> > pclassid INTEGER, pkey INTEGER, kindex INTEGER PRIMARY KEY ASC)"
> >
> > #define INSERT_DN "INSERT INTO TBL (dn,pclassid,pkey) VALUES (?,?,?);"
> >
> >  rv = sqlite3_bind_int(newStmt, 2 , aInClassId);
> >
> > if (rv != SQLITE_OK)
> >
> > {
> >
> > fprintf(stderr, "Error Insert : sqlite3_bind_int, Error code
> :
> > %d\n", rv);
> >
> > sqlite3_finalize(newStmt);
> >
> > return rv;
> >
> > }
>
> Are you calling sqlite3_prepare_v2 before your call to sqlite3_bind_int?
>
> Regards,
> Simon
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


[sqlite] application for initial charge

2016-04-09 Thread hfiandor
Thanks very much to Jean-Christophe Deschamps

Regards
Ing. H?ctor F. Fiandor Rosario



[sqlite] DELETE can fail with reverse_unordered_selects = true

2016-04-09 Thread Richard Hipp
On 4/9/16, Richard Hipp  wrote:
> On 4/9/16, Bradley Grainger  wrote:
>> In some circumstances "DELETE FROM x WHERE col = val" may fail to delete
>> all
>> rows if "PRAGMA reverse_unordered_selects = true;" has been executed.
>>
>
> https://sqlite.org/src/info/a306e56ff68b8fa5

Should be fixed now on trunk.  The key change
(https://sqlite.org/src/fdiff?sbs=1=863aedf086131743=8fdad9fbba723df1)
is moving a single block of up 26 lines in the file.
-- 
D. Richard Hipp
drh at sqlite.org


[sqlite] DELETE can fail with reverse_unordered_selects = true

2016-04-09 Thread Bradley Grainger
In some circumstances "DELETE FROM x WHERE col = val" may fail to delete all 
rows?if?"PRAGMA reverse_unordered_selects = true;" has been executed.

Steps to repro:
Open the test DB (https://downloads.logoscdn.com/temp/test.db 40KB)?with SQLite 
3.12.1
Run:
  pragma reverse_unordered_selects = true;
  delete   from ids where fk = '';
  select * from ids where fk = '';

Expected Behaviour: No rows returned.

Actual Behaviour:?SQLite returns the row: 79|

Example:
C:\>sqlite3 test.db
SQLite version 3.12.1 2016-04-08 15:09:49
Enter ".help" for usage hints.
sqlite> pragma reverse_unordered_selects = true;
sqlite> delete from ids where fk = '';
sqlite> select * from ids where fk = '';
79|
SQLite>

I have reproed this with SQLite 3.12.1 on Windows 10 x64 and Mac OS X 10.10.

I wasn't able to repro (using this file) with SQLite 3.8.11.1, but I could with 
SQLite 3.9.0 (on Mac OS X 10.10).


[sqlite] application for initial charge

2016-04-09 Thread Simon Slavin

On 9 Apr 2016, at 6:14am, hfiandor  wrote:

> I hope it would be very simple to prepare in the former Excel tables a sheet
> with the information required by my application and ?charge it? instead of
> the manual introduction as now.

Take a copy of your Excel spreadsheet.
Add a new column something like

=CONCATENATE("INSERT INTO myTable VALUES (",a1,",",a2,")")

So that it constructs the INSERT commands itself.  When you have all the 
commands you need copy and paste them into a text file.

Then use your own programming or the SQLite shell tool to execute those 
commands.

Simon.


[sqlite] Broken database after experiments with fts.

2016-04-09 Thread Cezary H. Noweta
Hello,

On 2016-03-29 19:25, Dan Kennedy wrote:
>http://sqlite.org/src/info/d0a3853b37230c12

> The fix should appear as part of the 3.13 release (not 3.12 - the
> version that was tagged earlier this morning).

Could that check--in be incorporated into next minor version? It fixes 
rather serious bug which makes a database file corrupted in such a way 
that it cannot be repaired. (It can be repaired by copying all data to a 
new database or by binary editing of the database file.)

-- best regards

Cezary H. Noweta


[sqlite] DELETE can fail with reverse_unordered_selects = true

2016-04-09 Thread Richard Hipp
On 4/9/16, Bradley Grainger  wrote:
> In some circumstances "DELETE FROM x WHERE col = val" may fail to delete all
> rows if "PRAGMA reverse_unordered_selects = true;" has been executed.
>

https://sqlite.org/src/info/a306e56ff68b8fa5

-- 
D. Richard Hipp
drh at sqlite.org


[sqlite] Expecting syntax error on delete

2016-04-09 Thread Richard Williams
I have a PHP program where I have the equivalent of the following code. The
code was not deleting the expected rows ('abc' & 'def') because of the bad
syntax. However the error did not throw an exception. Is this what I should
expect?

$p = new PDO('sqlite::memory:');
$p->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$p->exec("create table a (a text)");
$sql = "delete from a where a in (a in ('abc','def'))";
$stat = $p->exec($sql);


[sqlite] SQLite 3.8.11 Crashed with Mutlithread

2016-04-09 Thread 蔡畅(雁闲)
Hi ?? ? 
?I?used?SQLite(SQLITE_VERSION_NUMBER?3008011)?in?production?environment?on?Android?platform.?SQLite?was?built?with?encryption?extension?which?implemented?by?myself.?Recently?there?were?crash?cases?for?got?signal?11,?it?seemed?that?SQLite?has?visited?invalid?memory?address.?The?code?line?was?"id->pMethods->xWrite(id,?pBuf,?amt,?offset)",?actually?the?value?of?id?was?4c77?and?pMethods?was?NULL.
? ? 
?SQLite?runned?with?multithread?mode?and?the?journal?mode?was?DELELE.?There?were?1?write?thread?and?3?read?threads,?each?of?thread?has?own?DB?hand?which?can?not?be?passed?between?threads.?Threads?was?controlled?by?RWLOCK,?so?there?should?be?only?1?write?thread?or?only?read?threads?can?visit?DB?simultaneously.?I?got?confused?why?did?"id"?and?"pMethods"?became?an?invalid?address.I?tried?to?reproduce?the?crash?but?failed.
? ? 
?By?the?way,?when?SQLite?runned?with?one?write?thread?and?only?one?read?thread,?there?were?no?crash?cases.
?
Looking?forward?your?help,thanks!

Crash?stack?as?follows:
sqlite3OsWrite
jni/sqlitecrypto/sqlite3/sqlite3.c:16651
syncJournal
jni/sqlitecrypto/sqlite3/sqlite3.c:46501
sqlite3PagerCommitPhaseOne
jni/sqlitecrypto/sqlite3/sqlite3.c:48567
sqlite3BtreeCommitPhaseOne
jni/sqlitecrypto/sqlite3/sqlite3.c:57490
vdbeCommit
jni/sqlitecrypto/sqlite3/sqlite3.c:67962
sqlite3VdbeExec
jni/sqlitecrypto/sqlite3/sqlite3.c:75110
sqlite3Step
jni/sqlitecrypto/sqlite3/sqlite3.c:70740
sqlite3_exec

My?Compiler?parameters?as?follows:
-DSQLITE_HAS_CODEC
-DSQLITE_THREADSAFE=2
-DNDEBUG=1
-DSQLITE_DEFAULT_MEMSTATUS=0
-DSQLITE_POWERSAFE_OVERWRITE=1
-DSQLITE_ENABLE_MEMORY_MANAGEMENT=1
-DSQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576


[sqlite] application for initial charge

2016-04-09 Thread hfiandor
Dear list members:



Recently I have worked with an application for initial charge of an
Accounting System. It was very simple and I suspect that was implemented
with EXCEL and the Accounting System BD motor is not an SQLite (maybe
FoxPro).



The main idea is to prepare an accounting entry (I don?t know how to name it
in english but in spanish it is known as ?comprobante?) in Excel, in a
special layout, press a button, and generate the entry in a way that the
Accounting System can ?read? when it was ?imported?.



I have implemented an application with Lazarus+FPCompiler, using SQLite
tables, and the information was obtained from Excel tables previously done.



I hope it would be very simple to prepare in the former Excel tables a sheet
with the information required by my application and ?charge it? instead of
the manual introduction as now.



Please, if somebody knows something about this aspect, I will appreciate
very much any information.



Thanks

Ing. H?ctor F. Fiandor Rosario