Android Question SQLite import

aklisiewicz

Active Member
Licensed User
Longtime User
I'm trying to import CSV table. The table was exported from MySQL, reformated in Excell and saved again.
I get an Error which I do not understand.
Any clue ?

see attachement
 

Attachments

  • SQLite_ImportError.jpg
    SQLite_ImportError.jpg
    29.5 KB · Views: 274

mc73

Well-Known Member
Licensed User
Longtime User
Yes. Remove the quotes from the beginning and ending of each row. :)
 
Upvote 0

aklisiewicz

Active Member
Licensed User
Longtime User
there are no quotes.
there is how first 3 rows of CSV look like:


1,N/A,3849,2013 Product Guide - 1 ea,0,0.8,0.37,0,n/a,n/a,0,0,0,,Distributor Starter Kits,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,n/a,EN,1,1,9/14/08 0:00
2,N/A,3850,2013 Product Guide - 10 pk,0,7.8,3.59,0,n/a,n/a,0,0,0,,Distributor Starter Kits,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,n/a,EN,1,1,9/14/08 0:00
3,N/A,3300,Abundance Essential Oil - 15 ml,0,0.2,0.09,0,n/a,n/a,0,0,33.25,,Distributor Starter Kits,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,n/a,EN,1,1,9/14/08 0:00

Arthur
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
As I've said, watch the beginning and ending. Just have a closer look at the screenshot you posted. You'll see quotes at the beginning and ending of your row
B4X:
 ... values ('1,.......')
.
Excel usually adds quotes to strings in csv. I know it's not visible in the excel sheet, again, have a look at your screenshot.
 
Upvote 0

aklisiewicz

Active Member
Licensed User
Longtime User
THANK YOU FOR YOUR TIME
---------------------------

yes, I understand your point, but even after removing the quotes I still get Error. If you look up the previous post and 3 lines from CSV you will see no quotes, but SQLite manager still did not take it.

here is an Error
=========================================
SQLiteManager: INSERT INTO "main"."mALLPRODUCTS" VALUES ('1','N/A','3849','2013 Product Guide - 1 ea','0','0.8','0.37','0','n/a','n/a','0','0','0',null,'Distributor Starter Kits','N/A','N/A','N/A','N/A','N/A','N/A','N/A','N/A','N/A','N/A','N/A','N/A','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','1','n/a','EN','1','1','9/14/08 0:00') [ mALLPRODUCTS.ProductIcon may not be NULL ]
Exception Name: NS_ERROR_STORAGE_CONSTRAINT
Exception Message: Component returned failure code: 0x80630003 (NS_ERROR_STORAGE_CONSTRAINT) [mozIStorageStatement.execute]
=========================================

I did some more testing and discovered the I can import while creating a new table, but I cannot import into predefined table structure, although I double checked the structure and it seems OK. when I import into new table I loose however all column names and types, and will have to rename each manuall (which I would like to avoid).

Arthur
 
Upvote 0
Top