Re: [sqlite] unique constraints

2012-08-26 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 25/08/12 20:19, Simon Slavin wrote:
 You know, it does make sense that if the problem is a violated
 constraint, it does always tell you which constraint was violated.  You
 might have a number of different constraints on a column, and it would
 be nice to be told which one was causing the abort.

You do get told which constraint name caused an abort, which was something
you didn't get before.  The only quirk now is that if the constraint was
uniqueness of a particular column then you get told the column name
instead of the constraint name.  Your code has sufficient information to
make sense of exactly what happened.

Roger
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAlA5y/cACgkQmOOfHg372QQFJwCfcpUqvs61ht8E/OCfUHMTxIuk
RsoAn00BRAkMO07peoJ7p5lQElQ06X4X
=JV0u
-END PGP SIGNATURE-
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite support on windows

2012-08-26 Thread Arbol One
[Quote]
*There are a number of devices that run Windows CE

That is the vortex in this issue.

The app is being developed on Win7. Using C++ and Gtkmm as the GUI toolkit,
the libraries used for manipulation and storage of data is 'home cooked',
with the exception of the SQLite3 library. From the inception of the
project, the development has always been with the intention of portability,
thus, it is assumed that if the device can run C/C++ applications it will be
able to run our application as well.

Going back to the question of the 'number of devices' that you mentioned...
where could I find a list of these number of devices? Does Microsoft has
one?

TIA

-Original Message-
From: Mohit Sindhwani [mailto:m...@onghu.com] 
Sent: Sunday, August 26, 2012 1:13 AM
To: General Discussion of SQLite Database
Cc: Arbol One
Subject: Re: [sqlite] SQLite support on windows

On 26/8/2012 12:30 PM, Arbol One wrote:
 I am glad someone asked this question, we are almost finish with a 
 small application that is best suited for a hand held device. Is there 
 a device anyone here could suggest?
 As I said, the application is very small and uses SQLite as its RDB. 
 The application resembles a questionnaire... fill in the blanks kind 
 of thing, the data collected goes in to the RDB and later on downloaded to
a pc.

 TIA

What kind of device are you looking for?  A lot also depends on what
platform your application is built for, and what it needs.  Your current
description tends to suggest that it's rather well suited as an app for any
(or many) of the mobile phones.  There are a number of devices that run
Windows CE and you can compile SQLite3 with Visual Studio for those devices.

Best Regards,
Mohit.
26/8/2012 | 1:11 PM.

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


Re: [sqlite] SQLite support on windows

2012-08-26 Thread Kevin Benson
 On Sun, Aug 26, 2012 at 9:23 AM, Arbol One arbol...@gmail.com wrote:

 [Quote]
 *There are a number of devices that run Windows CE
 
 That is the vortex in this issue.

 The app is being developed on Win7. Using C++ and Gtkmm as the GUI toolkit,
 the libraries used for manipulation and storage of data is 'home cooked',
 with the exception of the SQLite3 library. From the inception of the
 project, the development has always been with the intention of portability,
 thus, it is assumed that if the device can run C/C++ applications it will
 be
 able to run our application as well.

 Going back to the question of the 'number of devices' that you mentioned...
 where could I find a list of these number of devices? Does Microsoft has
 one?

 TIA


http://pdadb.net/index.php?m=os
--
   --
 --
   --Ô¿Ô--
  K e V i N



 -Original Message-
 From: Mohit Sindhwani [mailto:m...@onghu.com]
 Sent: Sunday, August 26, 2012 1:13 AM
 To: General Discussion of SQLite Database
 Cc: Arbol One
 Subject: Re: [sqlite] SQLite support on windows

 On 26/8/2012 12:30 PM, Arbol One wrote:
  I am glad someone asked this question, we are almost finish with a
  small application that is best suited for a hand held device. Is there
  a device anyone here could suggest?
  As I said, the application is very small and uses SQLite as its RDB.
  The application resembles a questionnaire... fill in the blanks kind
  of thing, the data collected goes in to the RDB and later on downloaded
 to
 a pc.
 
  TIA

 What kind of device are you looking for?  A lot also depends on what
 platform your application is built for, and what it needs.  Your current
 description tends to suggest that it's rather well suited as an app for any
 (or many) of the mobile phones.  There are a number of devices that run
 Windows CE and you can compile SQLite3 with Visual Studio for those
 devices.

 Best Regards,
 Mohit.
 26/8/2012 | 1:11 PM.

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


Re: [sqlite] SQLite support on windows

2012-08-26 Thread Simon Slavin

On 26 Aug 2012, at 2:23pm, Arbol One arbol...@gmail.com wrote:

 [Quote]
 *There are a number of devices that run Windows CE
 
 That is the vortex in this issue.
 
 The app is being developed on Win7. Using C++ and Gtkmm as the GUI toolkit,
 the libraries used for manipulation and storage of data is 'home cooked',
 with the exception of the SQLite3 library. From the inception of the
 project, the development has always been with the intention of portability,
 thus, it is assumed that if the device can run C/C++ applications it will be
 able to run our application as well.
 
 Going back to the question of the 'number of devices' that you mentioned...
 where could I find a list of these number of devices? Does Microsoft has
 one?

Okay, there are some issues here to do with developing for standardised mobile 
devices.

First, no mobile handheld device runs Windows 7.  There are about 20 other 
versions of 'Windows' they run.  If you're developing an app /for/ a mobile 
device, develop and test it /on/ a mobile device, or a simulator for that 
device.  A huge tranche of Windows APIs is missing on mobile versions of 
Windows, just like a huge tranche of OS X APIs is missing for the iPhone.  Plus 
your most important factor in usability will be the GUI, and you don't know how 
fast it'll be or how it'll look and feel unless you're testing on a mobile 
display.

I might do some very preliminary development for an iPhone/iPad app by testing 
on my Mac.  Possibly just to figure out file formats.  But I'd transfer to the 
iPhone/iPad simulator as soon as possible because until then I can't even guess 
what the GUI will look like.  And it's even truer of Android, where no desktop 
computer OS is even close to Android.

Second, the list of mobile devices which run various versions of Windows 
changes so fast it's pointless asking for one unless you're ready to launch 
this week.  Not only that, but there are menu different versions of Windows, 
and which devices you care about depends on which version of Windows you want, 
which depends on which APIs you need.  The Mobile Windows development arena 
isn't just a one-size-fits-all system.  While manufacturers refuse to let their 
devices upgrade to later versions of the OS, picking your OS version 
requirements is the same as picking which devices your app will run on.

The alternative it to pick your own handheld device, order a hundred of them 
(or however many you need for testing) and to test on that.

SQLite is a tiny component in all this, and the least of your problems, since 
it works on nearly everything.  You're going to spend far more time on your GUI 
and in getting the collected data back to a computer.

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


Re: [sqlite] unique constraints

2012-08-26 Thread John Taylor

The circumstances I was thinking about is if you had many tables with
a column called 'name'.  If each table had a different name for the
constraint, then they could be differentiated.  Otherwise, it would be
nice to at least have the name of the table included in the error message.

Also, I just noticed this same behavior of foreign key constraints.
Even when they are named, a FK violation error message just says:

sqlite3.IntegrityError: foreign key constraint failed

Again, it would be nice for the error message to report the constraint
name and/or the table name. The rationale behind this is the same --
multiple tables could have the same column names and FK constraints.

Thanks,
-John

On Sat, Aug 25, 2012 at 08:13:22PM -0700, Roger Binns wrote:
 It does tell you the name of the column.  Under what circumstances could
 you not work with that?
 
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Jdbc Blob Incremental I/O

2012-08-26 Thread gwenn
Hi,
I've been trying to support incremental I/O in a Jdbc driver.
By forcing the user to access the rowid before the blob, it's possible
to use only the JDBC API for loading a Blob:
// CREATE TABLE test (data BLOB); INSERT INTO test (data) VALUES
(zeroblob(1024));
ResultSet rs = stmt.executeQuery(SELECT rowid, data FROM test);
rs.getRowId(1);
final Blob blob = rs.getBlob(2);
...
Indeed, with the rowId kept internally by the driver and with the
column index (2), I can retrieve all the data needed by
'sqlite3_blob_open': dbName, tblName, colName.
I will also support this alternative:
PrepareStatement pstmt = c.prepareStatement(SELECT data FROM test
where rowid = :rowid);
pstmt.setRowId(1, ...); -- rowId value kept internally
ResultSet rs = pstmt.executeQuery();
final Blob blob = rs.getBlob(1);

But for update/insert, it doesn't work because the
sqlite3_column_name, sqlite3_column_origin_name,
sqlite3_column_table_name and sqlite3_column_database_name can only be
used with select:
PreparedStatement pstmt = c.prepareStatement(UPDATE test SET data
= :blob WHERE rowid = :rowid);
pstmt.setRowId(2, new RowIdImpl(rowid));
pstmt.setBinaryStream(1, new ByteArrayInputStream(new byte[] {1,
2, 3, 4, 5, 6})); -- fails
pstmt.executeUpdate();

Do you see a way to write a blob incrementally by using only the JDBC API?
(I've checked all the other implementations, but they don't support
reading, nor writing...)

Thanks.

(the driver is here:
https://github.com/gwenn/sqlite-jna/tree/master/src/main/java/org/sqlite/driver)
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Connect MySQL database made with phpMyAdmin to Sqlite

2012-08-26 Thread Νικολέττα Σιώτα

Hello everyone,

My name is Nicole Siota and I am a university student currently working on my 
thesis. 
I want to make a PC trivia game with 2D graphics and write a manual on how to 
do it.
I decided to work on this project to learn more about this and give it my best 
shot. 
Unfortunately, I have quite a basic problem.

I have created a database with several tables in MySQL using the phpMyAdmin 
tool 
from XAMPP (apache) and I want to connect it with a VB.NET project. I thought 
that
using Sqlite would be better for my project since it has a VB.NET feature. I 
exported 
my database as a .sql file but I can not use it with Sqlite because it shows me 
that only
.db or .sqlite files are accepted. I tried to open my file with Sqlite3 but it 
showed that
the tables contained errors. I am kind of confused on what needs to be done to 
make
this work.

If someone can answer me, I would be very grateful. Any help is very much 
appreciated.
Thank you so much for your time.

Nicole Siota

P.S.: If someone knows a tip on connecting directly a MySQL database made with 
XAMPP
to VB.NET, I would be very happy as well. Thank you so much again!
  
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Import at first unhappy - then happy after all

2012-08-26 Thread Kevin Benson
 On Sun, Aug 26, 2012 at 11:30 AM, Udi Karni uka...@gmail.com wrote:

***SNIP***



 As an aside - not a big deal - this is on Windows - the file specifications
 in the .import and .read commands require 2 back slashes in the syntax
 - can that be fixed?

 Thanks !


The explanation for this behavior is here

http://www.sqlite.org/cvstrac/tktview?tn=1073
--
   --
 --
   --Ô¿Ô--
  K e V i N
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Import at first unhappy - then happy after all

2012-08-26 Thread Udi Karni
Thanks for the explanation.

Is there a way to change the Sqlite escape character globaly? Chose some
out-of-the-way character that would allow backward quotes to be used
normally?

Something like -

.escape [
.read c:\path\file.sql

???

On Sun, Aug 26, 2012 at 9:41 AM, Kevin Benson kevin.m.ben...@gmail.comwrote:

  On Sun, Aug 26, 2012 at 11:30 AM, Udi Karni uka...@gmail.com wrote:

 ***SNIP***


 
  As an aside - not a big deal - this is on Windows - the file
 specifications
  in the .import and .read commands require 2 back slashes in the
 syntax
  - can that be fixed?
 
  Thanks !
 
 
 The explanation for this behavior is here

 http://www.sqlite.org/cvstrac/tktview?tn=1073
 --
--
  --
--Ô¿Ô--
   K e V i N
 ___
 sqlite-users mailing list
 sqlite-users@sqlite.org
 http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

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


Re: [sqlite] Connect MySQL database made with phpMyAdmin to Sqlite

2012-08-26 Thread Simon Slavin

On 26 Aug 2012, at 11:37am, Νικολέττα Σιώτα nicolesi...@hotmail.com wrote:

 I have created a database with several tables in MySQL using the phpMyAdmin 
 tool 
 from XAMPP (apache) and I want to connect it with a VB.NET project. I thought 
 that
 using Sqlite would be better for my project since it has a VB.NET feature. I 
 exported 
 my database as a .sql file but I can not use it with Sqlite because it shows 
 me that only
 .db or .sqlite files are accepted. I tried to open my file with Sqlite3 but 
 it showed that
 the tables contained errors. I am kind of confused on what needs to be done 
 to make
 this work.
 
 If someone can answer me, I would be very grateful. Any help is very much 
 appreciated.
 Thank you so much for your time.

You will find a MySQL tool which will output your MySQL database as the set of 
SQL commands which would be needed to make that database.  The result will be a 
text file which includes some 'CREATE TABLE' commands and many 'INSERT' 
commands, and some other commands.

Then you do X.  I will come back to X.

Then you can use the SQLite shell tool (you can download it from the SQLite web 
site) to turn this text file into a SQLite database file.  You use the '.read' 
command.

Now I write about X.  The formats for SQL commands are slightly different 
between MySQL and SQLite.  You are probably going to have to use a text editor 
to make a minor change or two to the text file.  It might word first time, it 
might not.

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


Re: [sqlite] Import at first unhappy - then happy after all

2012-08-26 Thread Kevin Benson
On Sun, Aug 26, 2012 at 11:30 AM, Udi Karni uka...@gmail.com wrote:

 The following scenario happens occasionally.

 At first the import fails on mismatched columns - as if the end-of-line
 marker is off.

 You run it again right away and everything completes successfully.

 ?

 Is there some kind of tracing that can be turned on so that when this
 happens we can gather some clues?

 As an aside - not a big deal - this is on Windows - the file specifications
 in the .import and .read commands require 2 back slashes in the syntax
 - can that be fixed?

 Thanks !


Perhaps
http://www.sqlite.org/uri.html  3.1 The URI Path
will help you

--
   --
  --
 --Ô¿Ô--
K e V i N




 Z:\sqlite3 z:\xyz.db3
 SQLite version 3.7.11 2012-03-20 11:35:50
 Enter .help for instructions
 Enter SQL statements terminated with a ;
 sqlite pragma page_size=4096;
 sqlite pragma journal_mode=off;
 off
 sqlite pragma temp_store=memory;
 sqlite .timer on
 sqlite .separator ','
 sqlite .read c:\\create_table\\create_table_xyz.sql
 CPU Time: user 0.00 sys 0.00
 sqlite .import c:\\data_csv\\xyz.csv xyz
 Error: c:\data_csv\xyz.csv line 12: expected 59 columns of data but found
 99
 sqlite select count (*) from xyz;
 0
 CPU Time: user 0.00 sys 0.00
 sqlite .import c:\\data_csv\\xyz.csv xyz
 sqlite select count (*) from xyz;
 97744059
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users