Re: [sqlite] How to create a data of unsigned int?

2009-08-07 Thread Benjamin Nham
You probably want to either use sqlite3_bind_int64 to bind the 32-bit
IPv4 address as a positive 32-bit number (this will take between 1 and
5 bytes of space in the variable length integer format), or use
sqlite3_bind_blob and force storing the IP address as a fixed 4 byte
blob (in this case, you'd have to deal with endianness issues, but you
could just define a convention in this case, for example always
storing the IPv4 address as a 4-byte blob in network byte order).

If you use sqlite3_bind_int to bind a 32-bit integer to the statement,
then I believe sqlite would interpret any IP address with a first
octet >127 as a negative number, and therefore use the full 9 bytes of
space needed in the variable length integer format. That's probably
not what you want. Take a look at this for more information on the
variable length integer format:

http://www.sqlite.org/fileformat.html#varint_format

In short, SQLite uses the MSB of each byte in the integer as a continuation bit.

Ben

On Fri, Aug 7, 2009 at 6:11 AM, liubin liu<7101...@sina.com> wrote:
>
> Thanks, :)
>
> But now I think that's ok to use the int type to store the four byte.
> Because I could get the value by using forced conversion.
>
> But Do SQLite3 support the unsigned type?
>
> And You know that int64 is too wasting here.
>
>
>
> Pavel Ivanov-2 wrote:
>>
>> int64 type is okay to store data of type unsigned int. And int64 is
>> exactly the type used for all integers in SQLite.
>>
>> Pavel
>>
>> On Fri, Aug 7, 2009 at 5:53 AM, liubin liu<7101...@sina.com> wrote:
>>>
>>> I want to use a integer to save the ip address of ipv4. Because they all
>>> are
>>> 4 bytes.
>>>
>>> but it is better when the data type is unsigned int.
>>>
>>> How to create a data of unsigned int?
>>> 1334
>>> 1335     // tcp->gate_addr[0]是地址的高8位
>>> 1336     for ( i=0, m=1; i<4; i++, m*=0x100 )
>>> 1337         gateaddr = gateaddr + tcp->gate_addr[3-i] * m;
>>> 1338
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/How-to-create-a-data-of-unsigned-int--tp24861945p24861945.html
>>> Sent from the SQLite mailing list archive at Nabble.com.
>>>
>>> ___
>>> 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
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/How-to-create-a-data-of-unsigned-int--tp24861945p24864619.html
> Sent from the SQLite mailing list archive at Nabble.com.
>
> ___
> 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] Compile sqlite with only ANSI support (no Unicode)

2009-08-07 Thread Lukas Haase
Singaravelu, Rajaram schrieb:
> Hi,
> 
> [...]
> 
> In short, can anyone tell me if I can compile sqlite3 with only ANSI
> support so that it works like the ANSI version of fopen().

If I understand you correctly you just care about the filename when you 
talk about UTF8?!

In this case everything should be very easy. You can find the whole 
win-specific stuff in os_win.c. Concerning fopen: This call is not used, 
instead the Windows API function CreateFile is used (see function 
winOpen!). As I can see in the source, the W-prefixed call is used which 
is the Unicode-aware function.

You could either try replacing CreateFileW with CreateFileA or convert 
the filename with something like MultiByteToWideChar.

> Thanks for your help.
> 
> -Rajaram

Regards,
Luke

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


Re: [sqlite] translating CSV file into sqlite3 database for iPhone?

2009-08-07 Thread John Machin
On 8/08/2009 2:02 AM, Simon Slavin wrote:
> On 7 Aug 2009, at 4:21am, aerende wrote:
> 
>>sqlite> .import myfile.csv mydatabasetable
>>sqlite> .output mydatabasetable.sql
> 
> When you look at the .sql file in a text editor, does it make sense ?   
> Does it look like legal SQL ?  Does it have all the INSERT commands in ?
> 
> I would probably try it differently: open the .csv file in a  
> spreadsheet program, and use calculations to convert each line into an  
> INSERT command.  Then save that column of commands as a text file and  
> add the CREATE TABLE and other commands to it.

Good idea, but not a novel one; creating INSERT statements using Excel 
is rather prevalent in rapid-response "support" environments and 
provides many work opportunities for data remediaters.

Example: a database where many rows were thrown up by this query:

select account_num, price, qty, amount
from a_table
where price * qty != amount;

Further investigation showed that a high proportion met one of the 
following criteria:
(1) price = account_num
(2) qty = account_num
(3) amount = account_num
(4) price * qty = account_num -- after allowing for rounding.


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


Re: [sqlite] Busy Handler in Shared Cache Mode?

2009-08-07 Thread Pavel Ivanov
Maybe you could benefit of using sqlite3_unlock_notify()? See more
info here: http://www.sqlite.org/c3ref/unlock_notify.html.


Pavel

On Fri, Aug 7, 2009 at 1:45 PM, Nikolaus Rath wrote:
> Hello,
>
> I have program that continuously runs several threads (about 4 to 10)
> which concurrently read and write to an SQLite database. From
> http://www.sqlite.org/sharedcache.html it seems to me that I should be
> using shared cache mode.
>
> Until now, I have set the busy timeout to 500 msec and never had to deal
> with SQLITE_BUSY errors. However, there seems to be no corresponding
> function for the SQLITE_LOCKED errors that are generated in shared cache
> mode. So I changed the code manually sleep for a random amount (0 to 100
> msec) and then try to execute the statement again if it encounters
> SQLITE_LOCKED. But now the threads are often waiting for more than 1
> second before they finally get their query executed.
>
> I suspect this is because the random sleep is wasting a lot of time,
> while without shared cache (and with enabled busy timeout) a thread
> blocks and gets revived as soon as the lock on the database is
> released.
>
>
> How can I avoid this problem? Is there a way to set a busy timeout for
> SQLITE_LOCKED as well? Or a more clever method instead of sleeping for
> random amounts? Or should I just avoid using shared cache mode?
>
>
> Thanks,
>
>
>   -Nikolaus
>
> --
>  »Time flies like an arrow, fruit flies like a Banana.«
>
>  PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6  02CF A9AD B7F8 AE4E 425C
>
>
> ___
> 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


[sqlite] Busy Handler in Shared Cache Mode?

2009-08-07 Thread Nikolaus Rath
Hello,

I have program that continuously runs several threads (about 4 to 10)
which concurrently read and write to an SQLite database. From
http://www.sqlite.org/sharedcache.html it seems to me that I should be
using shared cache mode.

Until now, I have set the busy timeout to 500 msec and never had to deal
with SQLITE_BUSY errors. However, there seems to be no corresponding
function for the SQLITE_LOCKED errors that are generated in shared cache
mode. So I changed the code manually sleep for a random amount (0 to 100
msec) and then try to execute the statement again if it encounters
SQLITE_LOCKED. But now the threads are often waiting for more than 1
second before they finally get their query executed.

I suspect this is because the random sleep is wasting a lot of time,
while without shared cache (and with enabled busy timeout) a thread
blocks and gets revived as soon as the lock on the database is
released. 


How can I avoid this problem? Is there a way to set a busy timeout for
SQLITE_LOCKED as well? Or a more clever method instead of sleeping for
random amounts? Or should I just avoid using shared cache mode?


Thanks,


   -Nikolaus

-- 
 »Time flies like an arrow, fruit flies like a Banana.«

  PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6  02CF A9AD B7F8 AE4E 425C


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


Re: [sqlite] How to create a data of unsigned int?

2009-08-07 Thread Simon Slavin

On 7 Aug 2009, at 10:53am, liubin liu wrote:

> I want to use a integer to save the ip address of ipv4. Because they  
> all are
> 4 bytes.
>
> but it is better when the data type is unsigned int.

You may find it better just to store an IP number as a string, or as  
four integers.  Although it takes up more space you don't have to keep  
converting from one format to another.

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


Re: [sqlite] translating CSV file into sqlite3 database for iPhone?

2009-08-07 Thread Simon Slavin

On 7 Aug 2009, at 4:21am, aerende wrote:

>sqlite> .import myfile.csv mydatabasetable
>sqlite> .output mydatabasetable.sql

When you look at the .sql file in a text editor, does it make sense ?   
Does it look like legal SQL ?  Does it have all the INSERT commands in ?

I would probably try it differently: open the .csv file in a  
spreadsheet program, and use calculations to convert each line into an  
INSERT command.  Then save that column of commands as a text file and  
add the CREATE TABLE and other commands to it.

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


Re: [sqlite] Concurrency Question

2009-08-07 Thread Pavel Ivanov
> If I have 2 separate processes, 1 of which will attempt to Read and Write a
> Database (Process A)
> and the 2nd which will only Read the database (Process B), then if Process A
> is in the middle of a Write when Process B tries to read what will happen?

If Process A is in the middle of writing transaction but has not
actually written anything to disk yet (all changes are in cache) then
Process B will proceed reading unlocked. If Process A is in the middle
of committing transaction or it has written some changes to disk
(there're so many changes that they don't fit into cache) then API in
Process B will return SQLITE_BUSY error. But only unless you've called
sqlite3_busy_timeout() with non-zero value. In the latter case Process
B will return SQLITE_BUSY only after mentioned timeout has gone and
Process A does not finish transaction yet. And when SQLITE_BUSY is
returned then indeed it's up to you to try again later.

> And Vice versa, What happens if Process B is reading while A tries to write?

Process A will continue unblocked until it will have to actually write
to disk. At this point it will wait for Process B to finish its
reading and after that it will actually write everything it needs.


Pavel

On Fri, Aug 7, 2009 at 11:50 AM, JimmyKryptonite wrote:
>
> I'm looking to start a project using SQLite to handle some database
> transactions.  I have question about how SQLite handles Concurrency.  I read
> up on SQLite.org about the file locking and concurrency but I didn't really
> get the info I wanted (at least I didn't walk away with an answer in the
> terms I wanted it).
>
> My question is the following:
>
> If I have 2 separate processes, 1 of which will attempt to Read and Write a
> Database (Process A)
> and the 2nd which will only Read the database (Process B), then if Process A
> is in the middle of a Write when Process B tries to read what will happen?
> Will the Read request be blocked and Process B will wait or will SQLite
> return some kind of Busy Error Code to process B and it is up to Process B
> to try again later?
>
> And Vice versa, What happens if Process B is reading while A tries to write?
> Same answer as above?
>
> I'm very much a newbie to SQLite so patience is requested.
>
> Thanks in advance
> --
> View this message in context: 
> http://www.nabble.com/Concurrency-Question-tp24867278p24867278.html
> Sent from the SQLite mailing list archive at Nabble.com.
>
> ___
> 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


[sqlite] Concurrency Question

2009-08-07 Thread JimmyKryptonite

I'm looking to start a project using SQLite to handle some database
transactions.  I have question about how SQLite handles Concurrency.  I read
up on SQLite.org about the file locking and concurrency but I didn't really
get the info I wanted (at least I didn't walk away with an answer in the
terms I wanted it).

My question is the following:

If I have 2 separate processes, 1 of which will attempt to Read and Write a
Database (Process A)
and the 2nd which will only Read the database (Process B), then if Process A
is in the middle of a Write when Process B tries to read what will happen? 
Will the Read request be blocked and Process B will wait or will SQLite
return some kind of Busy Error Code to process B and it is up to Process B
to try again later?

And Vice versa, What happens if Process B is reading while A tries to write? 
Same answer as above?

I'm very much a newbie to SQLite so patience is requested.

Thanks in advance
-- 
View this message in context: 
http://www.nabble.com/Concurrency-Question-tp24867278p24867278.html
Sent from the SQLite mailing list archive at Nabble.com.

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


Re: [sqlite] Disk IO ERROR on AIX

2009-08-07 Thread Ken


--- On Fri, 8/7/09, Dan Kennedy  wrote:

> From: Dan Kennedy 
> Subject: Re: [sqlite] Disk IO ERROR on AIX
> To: "General Discussion of SQLite Database" 
> Date: Friday, August 7, 2009, 8:26 AM
> 
> On Aug 4, 2009, at 5:07 AM, Kenneth Long wrote:
> 
> >
> > Hi,
> >
> > I'm getting a Disk I/O error when committing a
> transaction on an AIX  
> > system.
> >
> > The extended result code is 1290. Which i believe
> means that the  
> > extended code is a SQLITE_IOERR_DIR_FSYNC error.
> >
> > Any ideas why this is happening or how to track it
> down?
> 
> Compile with SQLITE_DISABLE_DIRSYNC for AIX.
> 
> Dan.
> 
> 
> > Thanks,
> > Ken
> >

Dan, Many thanks. That did the trick!!!
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] error: sqlite doesn't free mutexes on windows

2009-08-07 Thread Wilson, Ron P
> sqlite-amalgamation-3_6_16.zip
> win32
> msvc 2008 sp1
> 
> func sqlite3_open_v2() is called with 'flag' param = SQLITE_OPEN_FULLMUTEX
> | SQLITE_OPEN_READWRITE
> 
> in sqlite3_initialize() func winMutexInit() is indirectly called three
> times:
>   1) in sqlite3MutexInit()
>   2) in sqlite3PcacheInitialize()
>   3) in sqlite3_os_init() (in func sqlite3_vfs_register())
> so var winMutex_lock == 3
> 
> in sqlite3_shutdown() functions
>   sqlite3PcacheShutdown()
>   sqlite3_os_end()
>   sqlite3MutexEnd()
> are called, but sqlite3PcacheShutdown() and sqlite3_os_end() do not
> decrement var winMutex_lock
> so when sqlite3MutexEnd() is called the var winMutex is still == 3, and
> mutexes are not destroyed


Did you ever resolve this?

Ron Wilson, Engineering Project Lead
(o) 434.455.6453, (m) 434.851.1612, www.harris.com

HARRIS CORPORATION   |   RF Communications Division 
assuredcommunications(tm)
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] translating CSV file into sqlite3 database for iPhone?

2009-08-07 Thread Wilson, Ron P
> This is why I generally advocate TAB delimited files over CSV

How does .mode tabs cope with quoted strings with tabs or newlines in them?

RW

Ron Wilson, Engineering Project Lead
(o) 434.455.6453, (m) 434.851.1612, www.harris.com

HARRIS CORPORATION   |   RF Communications Division 
assuredcommunications(tm)

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


Re: [sqlite] translating CSV file into sqlite3 database for iPhone?

2009-08-07 Thread aerende

>
John Machin wrote:
> 
>>On 7/08/2009 1:21 PM, aerende wrote:
>>> I'm trying to take a CSV file and create a sqlite3 database for the
>>> iPhone. 
>>> The CSV file has 33K entries and is 2 MB.  The problem I am having is
>>> that
>>> only about 1/10 of the database file gets written into the sqlite3
>>> database.
>>> 
>>> I first translated the CSV file into SQL commands using the
>>> terminal-based
>>> verison of sqlite3:
>>> 
>>> % sqlite3
>>> sqlite> .mode csv
>>> sqlite> create table mydatabasetable (ITEM_ID INTEGER PRIMARY KEY,
>>> FIELDA TEXT, FIELDB TEXT);
>>> sqlite> .import myfile.csv mydatabasetable
> 
>>Were there any error messages from that step?
> 
> Nope.
> 
>>
>>If at this stage you do
>>
>>select count(*) from mydatabasetable;
>>
>>what is the result? 
> 
> I get the full 33K.
> 
>>If it's not the full 33K, which records are being 
>>left out?
>>
>> sqlite> .output mydatabasetable.sql
>>
>>The .output command specifies what file any output will be sent to. It 
>>doesn't actually generate any output itself. Perhaps you are missing a 
>>.dump command and a quit command -- it's always a good idea to 
>>copy/paste actual output into your mail client, rather than re-typing it 
>>from memory.
> 
> Good point.  I executed a .dump command after this.  Sorry about that.
> 
> 
>>
>>> Then I tried to create a sqlite3 database from the sql file:
>>> 
>>> % sqlite3 mydatabasetable.sqlite < mydatabasetable.sql
>>
>>Any errors from this step? What does select count(*) give you?
> 
> Nope, no errors, and I get 33K when I load mydatabasetable.sqlite
> back into sqlite3.
> 
>>
>>> 
>>> When I read in mydatabasetable.sqlite into a sqlite3 database,
> 
> I executed % sqlite3 mydatabasetable.sqlite
> 
>>
>>What does that mean? A third step? If mydatabasetable.sqlite is not 
>>already a sqlite3 database, the previous steps have run amok somehow.
>>
>>> only the
>>> first 3400 entries out of 33,000 are in the database even though
>>> mydatabasetable.sql has 33,000 unique insert commands.
> 
>>In which database?
>>
>>> Am I following the correct approach to write out an sqlite database? 
>>
>>Dunno why you are doing it in two (three?) steps; the CSV import should 
>>be all you need.
>>
>>> Is
>>> there some default database filesize limit that I need to set?  Does
>>> anyone
>>> know why only the first 3400 entries show up in the database?
>>
>>It would help very much if you said what version of SQLite you are 
>>running and what platform you are running it on.
> 
> I'm running 
> 
> % sqlite3 --version
> 3.4.0
> 
> on a MacPro
> 
> It turns out that the problem went away and I can now read all 33K entries
> in the
> database file.  Strange.  For the nth time I blew away the local files
> that the iPhone was
> reading, and this time it did the trick.  Could have been the iPhone local
> files were
> corrupted.  I didn't have any commas or newlines inside of the strings, so
> that
> wasn't the problem.  This problem of only being able to read 1/10 of the
> file persisted
> over 2 solid days of trying to fix it, where I also blew away the iPhone
> local files.  
> I wish I knew what caused it, but I hope I don't see it again.
> 
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 

-- 
View this message in context: 
http://www.nabble.com/translating-CSV-file-into-sqlite3-database-for-iPhone--tp24858168p24866404.html
Sent from the SQLite mailing list archive at Nabble.com.

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


Re: [sqlite] translating CSV file into sqlite3 database for iPhone?

2009-08-07 Thread Marco Bambini
Have you tried my SQLiteManager app?
http://www.sqlabs.com/sqlitemanager.php

It can easily convert/import your CSV file into an sqlite3 database.
--
Marco Bambini
http://www.sqlabs.com
http://www.creolabs.com/payshield/






On Aug 7, 2009, at 4:57 PM, Adam DeVita wrote:

> This is why I generally advocate TAB delimited files over CSV
>
> Restaurant , Menu Item, Price
> Tom, Dick "The MAN", and Harry's Bar & Grill  , Specials /new stuff!  
> Mikey's
> Burger "Delishiousness ' ,  $5
>
> If you only have to upload your data once, you should be able to use a
> spreadsheet program to convert to TAB delimited rather than going  
> through
> the work of writing your own parser.
>
>
>
> On Fri, Aug 7, 2009 at 10:43 AM, Wilson, Ron P <
> ronald.wil...@tycoelectronics.com> wrote:
>
>>> I'm trying to take a CSV file and create a sqlite3 database for the
>>> iPhone.
>>> The CSV file has 33K entries and is 2 MB.  The problem I am having  
>>> is
>> that
>>> only about 1/10 of the database file gets written into the sqlite3
>>> database.
>>
>> The .import csv method is imperfect; if you have quoted strings in  
>> your csv
>> that have commas or newlines in them, the import will do surprising  
>> things.
>> I had to write my own code to do imports with quoted strings.
>>
>> RW
>>
>> Ron Wilson, Engineering Project Lead
>> (o) 434.455.6453, (m) 434.851.1612, www.harris.com
>>
>> HARRIS CORPORATION   |   RF Communications Division
>> assuredcommunications(tm)
>>
>> ___
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
>
>
>
> -- 
> VerifEye Technologies Inc.
> 905-948-0015x245
> 7100 Warden Ave, Unit 3
> Markham ON, L3R 8B5
> Canada
> ___
> 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] translating CSV file into sqlite3 database for iPhone?

2009-08-07 Thread Adam DeVita
This is why I generally advocate TAB delimited files over CSV

Restaurant , Menu Item, Price
Tom, Dick "The MAN", and Harry's Bar & Grill  , Specials /new stuff! Mikey's
Burger "Delishiousness ' ,  $5

If you only have to upload your data once, you should be able to use a
spreadsheet program to convert to TAB delimited rather than going through
the work of writing your own parser.



On Fri, Aug 7, 2009 at 10:43 AM, Wilson, Ron P <
ronald.wil...@tycoelectronics.com> wrote:

> > I'm trying to take a CSV file and create a sqlite3 database for the
> > iPhone.
> > The CSV file has 33K entries and is 2 MB.  The problem I am having is
> that
> > only about 1/10 of the database file gets written into the sqlite3
> > database.
>
> The .import csv method is imperfect; if you have quoted strings in your csv
> that have commas or newlines in them, the import will do surprising things.
>  I had to write my own code to do imports with quoted strings.
>
> RW
>
> Ron Wilson, Engineering Project Lead
> (o) 434.455.6453, (m) 434.851.1612, www.harris.com
>
> HARRIS CORPORATION   |   RF Communications Division
> assuredcommunications(tm)
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
VerifEye Technologies Inc.
905-948-0015x245
7100 Warden Ave, Unit 3
Markham ON, L3R 8B5
Canada
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] translating CSV file into sqlite3 database for iPhone?

2009-08-07 Thread Wilson, Ron P
> I'm trying to take a CSV file and create a sqlite3 database for the
> iPhone.
> The CSV file has 33K entries and is 2 MB.  The problem I am having is that
> only about 1/10 of the database file gets written into the sqlite3
> database.

The .import csv method is imperfect; if you have quoted strings in your csv 
that have commas or newlines in them, the import will do surprising things.  I 
had to write my own code to do imports with quoted strings.

RW

Ron Wilson, Engineering Project Lead
(o) 434.455.6453, (m) 434.851.1612, www.harris.com

HARRIS CORPORATION   |   RF Communications Division 
assuredcommunications(tm)

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


Re: [sqlite] Disk IO ERROR on AIX

2009-08-07 Thread Dan Kennedy

On Aug 4, 2009, at 5:07 AM, Kenneth Long wrote:

>
> Hi,
>
> I'm getting a Disk I/O error when committing a transaction on an AIX  
> system.
>
> The extended result code is 1290. Which i believe means that the  
> extended code is a SQLITE_IOERR_DIR_FSYNC error.
>
> Any ideas why this is happening or how to track it down?

Compile with SQLITE_DISABLE_DIRSYNC for AIX.

Dan.


> Thanks,
> Ken
>
> ___
> 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] How to create a data of unsigned int?

2009-08-07 Thread Pavel Ivanov
SQLite doesn't support unsigned types. And int64 is not too wasting
for you unless you work with negative numbers (which you are not
because you work with unsigned numbers). It's because SQLite always
does compacting of integer numbers - if number fits into 1 byte then
it stores 1 byte, if it fits in 2 bytes then it stores 2 etc. So in
your case it most probably will store 5 bytes which is not too bad.
IIRC, only for negative numbers SQLite always uses 8 bytes.

Pavel

On Fri, Aug 7, 2009 at 9:11 AM, liubin liu<7101...@sina.com> wrote:
>
> Thanks, :)
>
> But now I think that's ok to use the int type to store the four byte.
> Because I could get the value by using forced conversion.
>
> But Do SQLite3 support the unsigned type?
>
> And You know that int64 is too wasting here.
>
>
>
> Pavel Ivanov-2 wrote:
>>
>> int64 type is okay to store data of type unsigned int. And int64 is
>> exactly the type used for all integers in SQLite.
>>
>> Pavel
>>
>> On Fri, Aug 7, 2009 at 5:53 AM, liubin liu<7101...@sina.com> wrote:
>>>
>>> I want to use a integer to save the ip address of ipv4. Because they all
>>> are
>>> 4 bytes.
>>>
>>> but it is better when the data type is unsigned int.
>>>
>>> How to create a data of unsigned int?
>>> 1334
>>> 1335     // tcp->gate_addr[0]是地址的高8位
>>> 1336     for ( i=0, m=1; i<4; i++, m*=0x100 )
>>> 1337         gateaddr = gateaddr + tcp->gate_addr[3-i] * m;
>>> 1338
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/How-to-create-a-data-of-unsigned-int--tp24861945p24861945.html
>>> Sent from the SQLite mailing list archive at Nabble.com.
>>>
>>> ___
>>> 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
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/How-to-create-a-data-of-unsigned-int--tp24861945p24864619.html
> Sent from the SQLite mailing list archive at Nabble.com.
>
> ___
> 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] How to create a data of unsigned int?

2009-08-07 Thread liubin liu

Thanks, :)

But now I think that's ok to use the int type to store the four byte.
Because I could get the value by using forced conversion.

But Do SQLite3 support the unsigned type?

And You know that int64 is too wasting here.



Pavel Ivanov-2 wrote:
> 
> int64 type is okay to store data of type unsigned int. And int64 is
> exactly the type used for all integers in SQLite.
> 
> Pavel
> 
> On Fri, Aug 7, 2009 at 5:53 AM, liubin liu<7101...@sina.com> wrote:
>>
>> I want to use a integer to save the ip address of ipv4. Because they all
>> are
>> 4 bytes.
>>
>> but it is better when the data type is unsigned int.
>>
>> How to create a data of unsigned int?
>> 1334
>> 1335     // tcp->gate_addr[0]是地址的高8位
>> 1336     for ( i=0, m=1; i<4; i++, m*=0x100 )
>> 1337         gateaddr = gateaddr + tcp->gate_addr[3-i] * m;
>> 1338
>>
>> --
>> View this message in context:
>> http://www.nabble.com/How-to-create-a-data-of-unsigned-int--tp24861945p24861945.html
>> Sent from the SQLite mailing list archive at Nabble.com.
>>
>> ___
>> 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
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-create-a-data-of-unsigned-int--tp24861945p24864619.html
Sent from the SQLite mailing list archive at Nabble.com.

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


Re: [sqlite] How to create a data of unsigned int?

2009-08-07 Thread Pavel Ivanov
int64 type is okay to store data of type unsigned int. And int64 is
exactly the type used for all integers in SQLite.

Pavel

On Fri, Aug 7, 2009 at 5:53 AM, liubin liu<7101...@sina.com> wrote:
>
> I want to use a integer to save the ip address of ipv4. Because they all are
> 4 bytes.
>
> but it is better when the data type is unsigned int.
>
> How to create a data of unsigned int?
> 1334
> 1335     // tcp->gate_addr[0]是地址的高8位
> 1336     for ( i=0, m=1; i<4; i++, m*=0x100 )
> 1337         gateaddr = gateaddr + tcp->gate_addr[3-i] * m;
> 1338
>
> --
> View this message in context: 
> http://www.nabble.com/How-to-create-a-data-of-unsigned-int--tp24861945p24861945.html
> Sent from the SQLite mailing list archive at Nabble.com.
>
> ___
> 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


[sqlite] Extending FTS

2009-08-07 Thread Lukas Haase
Hi,

Thank you anybody for your replies and ideas to "FTS and postfix 
search". I thought a lot about it and came to the conclusion: In general 
it is not necessary for a fulltext system not find subwords. If it would 
be, then I either need no index (search through whole data) or put 
subwords into the index too.

So if my documents would be English I would be perfectly finished, even 
better with the PORTER-Tokenizer.

But unfortunately the language is German and there are words consisting 
of of other words (e.g. Telefonkabel = telephone cable). It is still a 
requirement finding the "Telefonkabel" as well when searching for 
"Kabel". Does anybody have an idea what would be the best approach? In 
my opinion, I have no chance except to split these words with a 
predefined dictionary (e.g. {"Telefonkabel"} will become {"telefon", 
"kabel", "telefonkabel"}. Even this is a challenge (the index-generation 
should not take too long). My idea now would be to extend the FTS in 
some way to
a) Support splitting words with predefined dictonary
b) maybe support for non-english (german) versions of the Porter 
Stemming algorithm.

I have programming experience with C and C++ but no idea of SQLite. 
Where to begin? How easy would it be to implement this and how much time 
would it take?

I also found [1]. This indexer seems to be more powerful than the 
builtin FTS. However, I can't find support for word-splitting too. Does 
anybody have experience with that indexer? Would it be simpler to extent 
this indexer? Maybe someone have already tested both...on which should I 
concentrate, which one is faster?

Thank you again all,

Luke

[1] http://ft3.sourceforge.net/

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


Re: [sqlite] "Bad CPU type in executable"?

2009-08-07 Thread Hamish Allan
On Wed, Aug 5, 2009 at 8:20 PM, Jean-Denis Muys wrote:

> No I don't (even though I don't speak English natively). If you google
> "top posting evil" you will realize that "evil" has been associated
> with "top posting" for longer than I can remember.

And Natalie Portman has been associated with hot grits for longer than
I care to remember. An appeal to the intarwebz does not a point make.

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


[sqlite] Disk IO ERROR on AIX

2009-08-07 Thread Kenneth Long

Hi,

I'm getting a Disk I/O error when committing a transaction on an AIX system. 

The extended result code is 1290. Which i believe means that the extended code 
is a SQLITE_IOERR_DIR_FSYNC error. 

Any ideas why this is happening or how to track it down?

Thanks,
Ken

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


[sqlite] Compile sqlite with only ANSI support (no Unicode)

2009-08-07 Thread Singaravelu, Rajaram
Hi,

I am using sqlite 3.6.16 in my application to create a database. I am
aware that sqlite supports Unicode and it expects the database file path
to be either UTF-8 or UTF-16 encoded. But my application supports only
ANSI (ASCII + rest of the 128 characters in the machine's character map)
and I have no immediate plans to make it Unicode compliant.

The problem is that, the application is being used in few non-english
machines where the path happens to have accented (French/Spanish)
characters. Since I do not convert the ANSI string to UTF-8 before
calling sqlite3_open(), the database creation fails. A normal fopen()
(ANSI version) succeeds for the same path because the non-english
accented character falls within the 256 characters defined in the
machine's character map. I wish sqlite3_open() also function the same
way.

There are several instances in my code where I call sqlite3_open().
Instead of converting the path to UTF-8 encoding in all those instances,
I was wondering if I can somehow change sqlite to expect the file path
to be in ANSI instead of UTF-8.

In short, can anyone tell me if I can compile sqlite3 with only ANSI
support so that it works like the ANSI version of fopen().

Thanks for your help.

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


Re: [sqlite] "Bad CPU type in executable"?

2009-08-07 Thread Jean-Denis Muys

On Aug 5, 2009, at 8:32 PM, Hamish Allan wrote:

> On Wed, Aug 5, 2009 at 5:50 PM, Jean-Denis  
> Muys wrote:
>
>> You're top-posting, it's evil, the thread is becoming messy.
>
> You need to look up the word "evil" sometime.

No I don't (even though I don't speak English natively). If you google  
"top posting evil" you will realize that "evil" has been associated  
with "top posting" for longer than I can remember.

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


[sqlite] How to create a data of unsigned int?

2009-08-07 Thread liubin liu

I want to use a integer to save the ip address of ipv4. Because they all are
4 bytes.

but it is better when the data type is unsigned int.

How to create a data of unsigned int?
1334
1335 // tcp->gate_addr[0]是地址的高8位
1336 for ( i=0, m=1; i<4; i++, m*=0x100 ) 
1337 gateaddr = gateaddr + tcp->gate_addr[3-i] * m;
1338 

-- 
View this message in context: 
http://www.nabble.com/How-to-create-a-data-of-unsigned-int--tp24861945p24861945.html
Sent from the SQLite mailing list archive at Nabble.com.

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


[sqlite] Robustness proposal for sqlite3_clear_bindings()

2009-08-07 Thread Yan Bertrand
Hello all,

 

I have just come accross a bug - which is essentially and most likely a
bug in my program but results in a segfault in sqlite3 code. So I
thought I would suggest a robustness change (not to correct my bug, but
for other people not to see a segfault in the same conditions).

sqlite3_clear_bindings does not check its statement parameter against
NULL before using it. 

This check is however done in sqlite3_reset.

It would be nice to check pStmt against NULL in sqlite3_clear_bindings
as well (and probably just return SQLITE_OK if the pointer is NULL ?).

 

Thank you for your support.

Best regards,

 

Yan

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