RE: [sqlite] unaligned access with sqlite 3.3.3 on IA64

2006-02-10 Thread Chowdhury, Chandan Dutta
 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 10, 2006 7:41 PM
To: sqlite-users@sqlite.org; Chowdhury, Chandan Dutta
Subject: Re: [sqlite] unaligned access with sqlite 3.3.3 on IA64

"Chowdhury, Chandan Dutta" <[EMAIL PROTECTED]> wrote:
> Reading repository metadata in from local files
> yum(26535): unaligned access to 0x60404f44, 
> ip=0x24e683e0
> yum(26535): unaligned access to 0x60405094, 
> ip=0x24e683e0
> yum(26535): unaligned access to 0x60405154, 
> ip=0x24e683e0
> yum(26535): unaligned access to 0x6040e9f4, 
> ip=0x24e683e0 No Packages marked for Update/Obsoletion

I need additional clues.  Can you please recompile with -g, run this in
a debugger, and let me know exactly where the misaligned access occurs?

I am holding up the release of 3.3.4 on this issue.

--
D. Richard Hipp   <[EMAIL PROTECTED]>


I am not a gdb expert (not even a developer), I am more of a sysadmin,
so Plz excuse if the info is not what you want .

Here is what I could find.

The problem seems to come from sqlite3Parser and sqlite3RunParser

A call to sqlite3RunParser like this  (marked with ===)

sqlite3RunParser (pParse=0x6fff9270, 
zSql=0x60011f20 "CREATE INDEX packageId ON packages
(pkgId)",
pzErrMsg=0x6fff9370) at ./src/tokenize.c:391

Calls sqlite3Parser  like this   (marked with ===)

Breakpoint 2, sqlite3Parser (yyp=0x60012fc0, yymajor=1, yyminor=
  {z = 0x60011f49 ")", dyn = 0, n = 1},
pParse=0x6fff9270) at parse.c:3185
3185

The warning is produced here  (marked with ===)
gdb)
3218  int yymx;
(gdb)
sqlite3(8812): unaligned access to 0x600145e4,
ip=0x20094d41
3303}
(gdb)


Plz get back for any more info

Regards
Chandan Dutta Chowdhury

Log of gdb(full log attached)

=
Breakpoint 2, sqlite3Parser (yyp=0x60012fc0, yymajor=13,
yyminor=
  {z = 0x60011f20 "CREATE INDEX packageId ON packages
(pkgId)", dyn = 0, n = 6},
pParse=0x6fff9270) at parse.c:3185
3185
(gdb)
Continuing.

Breakpoint 2, sqlite3Parser (yyp=0x60012fc0, yymajor=132,
yyminor=
  {z = 0x60011f27 "INDEX packageId ON packages (pkgId)", dyn
= 0, n = 5},
pParse=0x6fff9270) at parse.c:3185
3185
(gdb)
Continuing.

Breakpoint 2, sqlite3Parser (yyp=0x60012fc0, yymajor=23,
yyminor=
  {z = 0x60011f2d "packageId ON packages (pkgId)", dyn = 0,
n = 9},
pParse=0x6fff9270) at parse.c:3185
3185
(gdb)
Continuing.

Breakpoint 2, sqlite3Parser (yyp=0x60012fc0, yymajor=97,
yyminor=
  {z = 0x60011f37 "ON packages (pkgId)", dyn = 0, n = 2},
pParse=0x6fff9270)
at parse.c:3185
3185
(gdb)
Continuing.

Breakpoint 2, sqlite3Parser (yyp=0x60012fc0, yymajor=23,
yyminor=
  {z = 0x60011f3a "packages (pkgId)", dyn = 0, n = 8},
pParse=0x6fff9270)
at parse.c:3185
3185
(gdb)
Continuing.

Breakpoint 2, sqlite3Parser (yyp=0x60012fc0, yymajor=19,
yyminor=
  {z = 0x60011f43 "(pkgId)", dyn = 0, n = 1},
pParse=0x6fff9270)
at parse.c:3185
3185
(gdb)
Continuing.

Breakpoint 2, sqlite3Parser (yyp=0x60012fc0, yymajor=23,
yyminor=
  {z = 0x60011f44 "pkgId)", dyn = 0, n = 5},
pParse=0x6fff9270) at parse.c:3185
3185
(gdb)
Continuing.

Breakpoint 2, sqlite3Parser (yyp=0x60012fc0, yymajor=20,
yyminor=
  {z = 0x60011f49 ")", dyn = 0, n = 1},
pParse=0x6fff9270) at parse.c:3185
3185
(gdb) n
3189/* if( yymajor==0 ) return; // not sure why this was here...
*/
(gdb)
3190yypParser->yyidx = 0;
(gdb)
3197  sqlite3ParserARG_STORE;
(gdb)
3198
(gdb)
3199#ifndef NDEBUG
(gdb)
3208  yy_shift(yypParser,yyact,yymajor,);
(gdb)
3209  yypParser->yyerrcnt--;
(gdb)
3217}else if( yyact == YY_ERROR_ACTION ){
(gdb)
3218  int yymx;
(gdb)
3303}
(gdb)
3208  yy_shift(yypParser,yyact,yymajor,);
(gdb)
3209  yypParser->yyerrcnt--;
(gdb)
3217}else if( yyact == YY_ERROR_ACTION ){
(gdb)
3218  int yymx;
(gdb)
3303}
(gdb)
3208  yy_shift(yypParser,yyact,yymajor,);
(gdb)
3209  yypParser->yyerrcnt--;
(gdb)
3217}else if( yyact == YY_ERROR_ACTION ){
(gdb)
3218  int yymx;
(gdb)
3303}
(gdb)
3208  yy_shift(yypParser,yyact,yymajor,);
(gdb)
3209  yypParser->yyerrcnt--;
(gdb)
3217}else if( yyact == YY_ERROR_ACTION ){
(gdb)
3218  int yymx;
(gdb)
3303}
(gdb)
3208  yy_shift(yypParser,yyact,yymajor,);
(gdb)
3209  yypParser->yyerrcnt--;
(gdb)
3217}else if( yyact == YY_ERROR_ACTION ){
(gdb)
3218  int yymx;
(gdb)
3303}
(gdb)
3208  

Re: [sqlite] Creating a (really) big table

2006-02-10 Thread Eugen Stoianovici

Jay Sprenkle wrote:


On 2/10/06, Fred Williams <[EMAIL PROTECTED]> wrote:
 


Well, unfortunately our bid'ness seems to be a "contact sport" for many.
I have been guilty of pretty much the same more times than I am proud
of.  That said...

The question is quite valid.  I do agree that something must be amiss if
there is a requirement for a large number of columns in a table.

I always think back to a collage beginning COBOL class.  The assignment
was to print a simple two dimensional table at the top of each page of a
report.  The ones who did it right had no more than about 50 "source"
punch cards in their deck.  One student (A IBM 370 night operator,
trying to better his lot.) carried in five full boxes of punched cards!
I think he was happy to get back to his shift :-)

Sometimes people are not even able to ask the right question, based on
their "unsophistication."  But those that are smart enough, do at least
ask a question, and then Listen.  We who consider ourselves
"sophisticated" must endeavor to be forever humble, in order to appear
"Inteligent" rather than "Smart A--".
   



LOL! Touche!

 

I guess you could have a table with a realy large number of 
columns...For one of my projects i had to store data from a high voltage 
device which had 100 or so(i don't remember very well) parameters that 
would constantly be updated. Part of this application would read those 
values and then take actions based on them. the only rational thing to 
do was to place them all in a single table (they were not liked 
together, just values that a device reported )
That being said, 1000 columns...really? CIA and FBI (and other secret 
services for that matter) would be impressed by the amount of data you 
possess ( shurely that's not the only table in your database, is it? 
you're trying to take over the world, admit it pinky!...or was it 
brain...? admit it brain!)


[sqlite] Re: [Monotone-devel] [sqlite] disk locality (and delta storage)

2006-02-10 Thread drh
Daniel Carosone <[EMAIL PROTECTED]> wrote:
> 
> It seems a little odd to me to build a centralised, online
> information system for tracking state and documenting activity around
> and about source code in a distributed and disconnected VCS.  
> 

Ah yes, you're right.  But in the system I envision, the wiki
and bug-tracking are also decentralized, disconnected, and
distributed.

> 
> What I'd really like to see is something that, instead of just
> plugging into monotone to show source code state and patches, actually
> used monotone for all storage and 'information transport', and allowed
> developers to update the wiki pages and bug tracking information in
> the same way they can update the code: offline, with syncs and merges
> later as needed.  

This is more in line with my thinking.

> 
> Wiki pages doesn't seem so hard, they're pretty much text documents
> stored in a VCS anyway. 

There are some complications.  Each wiki page acts if it where
its own independent project or branch.  And then you probably want
some way see all current leaves and to do merges from the web
interface.  

If you intend your system to be publically accessible, then
you will also need some mechanism to delete (or at least 
permanently hide from public view) the spam that miscreants
occasionally post on wiki pages and sometimes also on tickets.
Some kind of "death cert" perhaps.

> Bug tracking state would require a little
> more smarts, with suitable text formats stored in the VCS and
> code/hooks to assist in making sane merges between multiple heads of a
> given ticket, but even that doesn't seem terribly hard.

My thinking about tickets is that each change to a ticket
is just a small, signed, immutable record (like a cert)
that contains a variable number of name/value pairs.  The
names are things like "title", "description", "status",
"assigned-to", etc.  To reconstruct the current state of
a ticket, you sort all the pieces by their creation time
(their actual creation time, not the time they happened to
arrive at your database) and read through them one by one.
Values overwrite prior values with the same name.  So
in the end, you have one value for each field name - and
that is the current state of your ticket.

This approach gives you automatic merging and a complete
change history/audit trail.  Some people are initially shocked
that any user can update any field of the ticket, but that
kind of openness is in keeping with the wiki tradition and
has actually been used very successfully in CVSTrac.  If
you wanted to restrict changes on selected fields, you could
just ignore the name/value pairs for that field on certs
from unauthorized users.

Tickets also benefit from having "remarks" that people can
append to the ticket (without overwriting) and attachments.
Both are handled by separate certs. 

It is also very useful to have certs that record a link 
between a revision and a ticket.  In this way you can record 
that a bug was introduced by, or fixed by, a particular 
revision.  The linkage between tickets and revisions has 
proven to be particularly valuable in CVSTrac.

Once you have cross linking between revisions and tickets,
if you add a google-like search you then have a very powerful
system for doing source tree archeological work.  This comes
up a lot in maintaining SQLite.  Somebody on the web reports
a problem.  I have some vague memory of fixing a similar
problem 9 months ago, but do not recall where it was or how
I fixed it.  By using the search feature of CVSTrac together
with the links between tickets and check-in comments, I can
quickly find the historical problem and pinpoint exactly when
and how the problem was fixed.  Then post a URL to the specific
ticket that described the problem and the specific revision that
fixed it.

> 
> It could still be a web ui if people find that comfortable, just one
> that developers would often run pointing the browser at a local
> server, with a commit at the end of a session, and a later sync and
> merge. Of course, you could/would always have an instance of this
> running on a public webserver in a well-known place, just like
> monotone projects typically do for their source databases: for
> convenience, rather than necessity.

My thinking exactly.  I want the ability to drop a standalone
binary into a cgi-bin on a $7/mo hosting site and have an
instant sourceforge for some small project.  It is also nice
to be able to run things out of a database file in your home
directory.  Or do both.

Some things, like ticket reports, tend to want to use a web
interface.  So how do you do that when you're riding on an
airplane or otherwise cut off from your favorite server?
Just type (for example):

   monotone httpserver &

and then point your webbrowser at 127.0.0.1.

> 
> Some of these things might eventually go into monotone itself, perhaps
> building more tools for project policy and practice assistance around
> base mechanisms such as certs and the DAG structure.  More 

[sqlite] Re: Database Disk Full

2006-02-10 Thread Dave Dyer

>It is a reasonable assumption to make that the only thing which can have 
>changed since the last write is the disk becoming full.  A disk cable falling 
>off, head crash or mechanical disk failure is not only unlikely but would 
>crash the entire machine and make error detection and recovery unlikely so 
>testing for it is futile.

It is reasonable for a program like sqlite to operate
on the assumption that other hardware and software perform as
intended, and not attempt heroic error recovery.

On the other hand, sqlite operates in the real world, and wierd
shit happens out there.  When something goes wrong, every bit of
information that is available should BE available to those trying
to clean up the mess.

There is a huge difference, coming in in the morning after an expected
overnight run, finding it failed, and having the message 

database full

verses having the message 

09-feb-2006 03:13:12 database write failed, windows error code 14
 for f:\temp\vacuumtemp.txt, current file size = 10200K




Re: [sqlite] Database Disk Full

2006-02-10 Thread John Stanton
Since the file access has already worked by this stage the "plethora" is 
far smaller than you may have appreciated.  It is a reasonable 
assumption to make that the only thing which can have changed since the 
last write is the disk becoming full.  A disk cable falling off, head 
crash or mechanical disk failure is not only unlikely but would crash 
the entire machine and make error detection and recovery unlikely so 
testing for it is futile.

JS

Drew, Stephen wrote:

Hello,
 
In sqlite3OsWrite function (in os_win.c)  the following code exists:
 
  while( amt>0 && (rc = WriteFile(id->h, pBuf, amt, , 0))!=0 &&

wrote>0 ){

amt -= wrote;

pBuf = &((char*)pBuf)[wrote];

  }

  if( !rc || amt>(int)wrote ){

return SQLITE_FULL;

  }

Is this really a valid occasion to return SQLITE_FULL?   Surely
WriteFile Win32 API call can fail to write a full for a plethora of
reasons, or am I missing something?

Many thanks in advance

Regards,

Steve






Re: [sqlite] sqlite-3.3.3 coredumps on SGI IRIX64

2006-02-10 Thread Hamid Benhocine

[EMAIL PROTECTED] wrote:


Hamid Benhocine <[EMAIL PROTECTED]> wrote:
 


Hello, I m trying to upgrade from sqlite-3.2.7 on SGI IRIX64 to sqlite-3.3.3
The applications using sqlite-3.2.7 (compiled with mode 64 or 32 bits) work
fine. But the upgrade to sqlite-3.3.3 coredump on 64 bits when creating 
tables
with the UNIQUE, PRIMARY constraints. 
   



People with 64-bit alignment sensitive machines:  Please tell
me if check-in [3079] solves your problems.

http://www.sqlite.org/cvstrac/chngview?cn=3079

--
D. Richard Hipp   <[EMAIL PROTECTED]>


 


replacing build.c table.c and sqliteInt.h ins sqlite-3.3.3 with
those of ticket 3079

all the Problems are fixed

I was able to run the regression tests and
the results are

5 errors out of 23846 tests
Failures on these tests: printf-8.2 sync-1.1 sync-1.2 sync-1.3 
types3-1.3 (they are related to tcl!!)


GREAT JOB. thanks a lot.

Hamid



Re: [sqlite] Question about Regular Expression

2006-02-10 Thread Xavier Noria

On Feb 10, 2006, at 16:51, malcom wrote:


Hello,
I have a sqlite column with a string. This string is composed by n
different lines separated by an \n character. Each line is composed by
: . So my final string is something like this:

: \n
: \n
: 

Now I need to search *only* inside a particular key value. For example
I would to see if the value of key_2 contains a string 'test' (and if
possible return the entire value of key key_2).
Is it possible? My solution is to use regular expression (anyone can
hep me? I don't know more about them).


Let me double-check the problem: you are given the text, then key_2,  
and then you need to search whether key_2 contains "text"? I guess  
this is not the case because otherwise it would be trivial. How is  
the "particular key" to search in specified? An index? Or is that you  
need to fetch all the keys that contain "text"? In which programming  
language?


-- fxn




Re: [sqlite] Creating a (really) big table

2006-02-10 Thread Jay Sprenkle
On 2/10/06, Fred Williams <[EMAIL PROTECTED]> wrote:
> Well, unfortunately our bid'ness seems to be a "contact sport" for many.
> I have been guilty of pretty much the same more times than I am proud
> of.  That said...
>
> The question is quite valid.  I do agree that something must be amiss if
> there is a requirement for a large number of columns in a table.
>
> I always think back to a collage beginning COBOL class.  The assignment
> was to print a simple two dimensional table at the top of each page of a
> report.  The ones who did it right had no more than about 50 "source"
> punch cards in their deck.  One student (A IBM 370 night operator,
> trying to better his lot.) carried in five full boxes of punched cards!
> I think he was happy to get back to his shift :-)
>
> Sometimes people are not even able to ask the right question, based on
> their "unsophistication."  But those that are smart enough, do at least
> ask a question, and then Listen.  We who consider ourselves
> "sophisticated" must endeavor to be forever humble, in order to appear
> "Inteligent" rather than "Smart A--".

LOL! Touche!


RE: [sqlite] Database Disk Full

2006-02-10 Thread Drew, Stephen
I suspect, although am not 100%, that a third-party database tool was
using the database file. As you say, I would have expected either that
tool or the actual program to have failed to open the file

However, we could be a lot more sure if we could see the Win32 error. In
the short-term I am going to add a modification to log this info
whenever WriteFile() fails in the code mentioned, and will let you know
if it is anything that looks suspicious.

Out of interest, the file is on a local NT filesystem drive. 

Thanks,
Steve

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: 10 February 2006 17:28
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Database Disk Full

"Drew, Stephen" <[EMAIL PROTECTED]> wrote:
>> 
> It's just a little bit misleading if you're not familiar with the 
> circumstances it's raised in... I've had some confused colleagues 
> wondering why their 100kb DB on a disk with 15gb free would be out of 
> space :)
> 

I'm curious.  What was preventing them from writing to the file if it
was not a lack of disk space?  File permission problems should have been
detected when the file was opened.  What else would cause a short write?

--
D. Richard Hipp   <[EMAIL PROTECTED]>





Re: [sqlite] sqlite-3.3.3 coredumps on SGI IRIX64

2006-02-10 Thread drh
Hamid Benhocine <[EMAIL PROTECTED]> wrote:
> Hello, I m trying to upgrade from sqlite-3.2.7 on SGI IRIX64 to sqlite-3.3.3
> The applications using sqlite-3.2.7 (compiled with mode 64 or 32 bits) work
> fine. But the upgrade to sqlite-3.3.3 coredump on 64 bits when creating 
> tables
> with the UNIQUE, PRIMARY constraints. 

People with 64-bit alignment sensitive machines:  Please tell
me if check-in [3079] solves your problems.

http://www.sqlite.org/cvstrac/chngview?cn=3079

--
D. Richard Hipp   <[EMAIL PROTECTED]>



[sqlite] Problem with a simple select

2006-02-10 Thread Mehdi AMINI
Hello,


I've populated a 5MB database with a QT app.
I've got problem with a simple select query.

Here is the table's schema:

CREATE TABLE Perf ( IdEvent int,
IdComp int,
place smallint,
tps1 float,
pen1 smallint,
tps2 float,
pen2 smallint,
total float,
PointsOfficiel smallint,
PointsClassement smallint,
PRIMARY KEY (IdEvent, IdComp) );


Those requests don't return the same lines.

SELECT idEvent, idComp from Perf WHERE IdEvent=20055480;
SELECT * from Perf WHERE IdEvent=20055480;

I'm not SQL expert, but in my opinion there's no reason for that.
The first request, with only column in Primary key, seems to work and give
99 lines.
The second one return 99 lines, but only 18 with IdEvent=20055480, others
lines are one record (same Idevent and Idcomp) wich is show 81 times.

I hope my description was clear enough.
I'm looking for a way to debug that.

Thanks for your help


Mehdi




Re: [sqlite] SQLite to MySQL

2006-02-10 Thread m christensen

First, WHY move off sqlite.
Hosting companies are a dime-a-dozen.
sqlite is a library, it's part of your code, you are not asking the 
provider to set up

or maintain another RDBMS engine.
Option one in my opinion is to find a cooperative hosting company and 
move you

app unmodified.

IF your app is currently running on your PC and IF it's currently 
running sqlite

and IF your design and SQL code are reasonably optimized I highly doubt
you'll find anything that cane come close speed-wise.

IF you do have a poor design and are forced to fix it in order to 
migrate it may be

faster once you are done, but that doesn't count. ;-).

I'm an Oracle DBA I make good money doing it, but I'm not beyond using a 
more

appropriate database for a given situation.

Just to muddy the waters a bit more...
Oracle has a free version for windows and linux that is good for a 1 GB 
or smaller database

if I recall.
DB2 has just been released for free on windows and linux for machines 
with up to 2 dual Core

processors and 4 Gig RAM. No limits of database size.

Oracle just changed the way they license multi-core processors but List 
price for the

enterprise edition for a 2 CPU dual core machine it still $100,000 list.

I currently support about 20 Oracle instances driving 5 commercial 
applications which cost

about 150 million dollars to develop.
From what I've seen so far this free version of DB2 running on good 
linux hardware would

outrun the sun/oracle systems for about 1/5th the cost.





Jim C. Nasby wrote:


See also http://sql-info.de/mysql/gotchas.html.

About the only downsides I can think of with PostgreSQL is that it's
out-of-the-box configuration is meant for like a 486 and that not quite
as many hosting providers offer it. That url has about 100 downsides to
MySQL (many of which are rather serious). PostgreSQL is also strives to
stay as close to ANSI SQL as possible and makes it nearly impossible to
configure your database in such a way that it's only a matter of time
and luck before you end up with corrupted data.

Granted, MySQL added a lot of features in 5.0, but they still focus much
less on doing things the right way than PostgreSQL does.

And remember: Feb 31st isn't a date. :)

On Thu, Feb 09, 2006 at 07:47:47AM +1100, John Stanton wrote:
 

PostgreSQL implements standard SQL as well as the features of an 
enterprise DBMS.  On that basis if you are changing it makes sense to 
change to the fuller-featured product, one in the same class as Oracle 
and DB2.  In the short term Mysql could be as good as PostgreSQL.


Fanda Vacek wrote:
   

I'm not sure, if Postgres is better choice than MySQL. I have used both 
of  them to find out which is the better one. Both of them can do 
almost  anything. The choice is a matter of taste and person. We are 
free to  choose:)) I'm talking about MySQL 5 and PostgreSQL 8.1.


Sorry for writing this to SQLite mail-list.

Fanda

On Tue, 07 Feb 2006 22:35:09 +0100, John Stanton <[EMAIL PROTECTED]>  
wrote:


 


Jim C. Nasby wrote:

   


On Mon, Feb 06, 2006 at 05:30:39PM +0100, Laurent Goussard wrote:

 


Hi there,

I use SQLite on my website for 2 years now. I do like SQLite a lot and
will use it for a lot of new web projects but, because I got more and
more traffic, I consider to move this one to MySQL in order to reduce
the over load of my computer (I host it @ home).

Do you know if there is a way to convert easily an SQLite database
into a MySQL one ?
(I'm especially thinking about the escapestring and other "create
table [myTable] {" issues...)
   

FWIW, I believe SQLite's syntax is closer to PostgreSQL's than it 
is  to

MySQL, so it might me easier to migrate that direction...
 

If you are migrating to an enterprise level DBMS, PostgreSQL is a 
better  choice than Mysql.  It is fully featured with all the 
qualities of DB2  and Oracle but without the expense.


Note that you will need considerably more machine resources to run a  
"heavier" DBMS than Sqlite.  For example on our 166MHz, 256MB RS/6000  
PostgreSQL is sluggish but on our dual processor 1.2GHz, 2GB P-Series 
it  is lightning fast.  Sqlite runs fast on the 166MHz machine.


   

 



 



[sqlite] re: Database Disk Full

2006-02-10 Thread Dave Dyer
At 09:00 AM 2/10/2006, [EMAIL PROTECTED] wrote:
>"Drew, Stephen" <[EMAIL PROTECTED]> wrote:
>> Hello,
>>  
>> In sqlite3OsWrite function (in os_win.c)  the following code exists:
>>  
>>   while( amt>0 && (rc = WriteFile(id->h, pBuf, amt, , 0))!=0 &&
>> wrote>0 ){
>> 
>> amt -= wrote;
>> 
>> pBuf = &((char*)pBuf)[wrote];
>> 
>>   }
>> 
>>   if( !rc || amt>(int)wrote ){
>> 
>> return SQLITE_FULL;
>> 
>>   }
>> 
>> Is this really a valid occasion to return SQLITE_FULL? 
>
>What error code would you suggest as an alternative?

IMO the error code is fine, but there should be an auxiliary API
that provides all available information (file name, windows error code,
windows error description, current file size, ...), if only to facilitate
the "duh" reaction when the user realizes what's really wrong.



Re: [sqlite] sqlite-3.3.3 coredumps on SGI IRIX64

2006-02-10 Thread drh
Hamid Benhocine <[EMAIL PROTECTED]> wrote:
> Hello, I m trying to upgrade from sqlite-3.2.7 on SGI IRIX64 to sqlite-3.3.3
> The applications using sqlite-3.2.7 (compiled with mode 64 or 32 bits) work
> fine. But the upgrade to sqlite-3.3.3 coredump on 64 bits when creating 
> tables
> with the UNIQUE, PRIMARY constraints. I did not run in this issue with the
> earlier versions (sqlite-3.2.5--> sqlite-3.2.7).

PRIMARY KEY implies UNIQUE.  Including them both is redundant.
Nevertheless, it should give you a segfault.

Please send the SQL that fails.

--
D. Richard Hipp   <[EMAIL PROTECTED]>



RE: [sqlite] Creating a (really) big table

2006-02-10 Thread Fred Williams
Well, unfortunately our bid'ness seems to be a "contact sport" for many.
I have been guilty of pretty much the same more times than I am proud
of.  That said...

The question is quite valid.  I do agree that something must be amiss if
there is a requirement for a large number of columns in a table.

I always think back to a collage beginning COBOL class.  The assignment
was to print a simple two dimensional table at the top of each page of a
report.  The ones who did it right had no more than about 50 "source"
punch cards in their deck.  One student (A IBM 370 night operator,
trying to better his lot.) carried in five full boxes of punched cards!
I think he was happy to get back to his shift :-)

Sometimes people are not even able to ask the right question, based on
their "unsophistication."  But those that are smart enough, do at least
ask a question, and then Listen.  We who consider ourselves
"sophisticated" must endeavor to be forever humble, in order to appear
"Inteligent" rather than "Smart A--".

Fred

> -Original Message-
> From: Jay Sprenkle [mailto:[EMAIL PROTECTED]
> Sent: Friday, February 10, 2006 11:12 AM
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] Creating a (really) big table
>
>
> On 2/10/06, m christensen <[EMAIL PROTECTED]> wrote:
> > THANK YOU.
> >
> > Someone finally asked the right question instead of answering the
> > original one.
> >
> > Why would you possibly need 1,000 columns in a single table?
>
> Most people ask the little questions and don't give you the
> "big picture".
> A lot of times it's not well accepted when you suggest something that
> implies they have less than perfect knowledge. ;)



[sqlite] sqlite-3.3.3 coredumps on SGI IRIX64

2006-02-10 Thread Hamid Benhocine

Hello, I m trying to upgrade from sqlite-3.2.7 on SGI IRIX64 to sqlite-3.3.3
The applications using sqlite-3.2.7 (compiled with mode 64 or 32 bits) work
fine. But the upgrade to sqlite-3.3.3 coredump on 64 bits when creating 
tables

with the UNIQUE, PRIMARY constraints. I did not run in this issue with the
earlier versions (sqlite-3.2.5--> sqlite-3.2.7).
May be can any one help.
thanks
Hamid

irix64% cat test.sql
CREATE TABLE t ( a INTEGER  NOT NULL, b INTEGER NOT NULL, rval  REAL , 
UNIQUE(a,b));


irix64% sqlite64 test.db
SQLite version 3.2.7
Enter ".help" for instructions
sqlite> .read test.sql
sqlite> .schema
CREATE TABLE t ( a INTEGER  NOT NULL, b INTEGER NOT NULL, rval  REAL , 
UNIQUE(a,b));

sqlite> .quit
irix64% rm test.db

irix64% ./sqlite test.db
SQLite version 3.3.3
Enter ".help" for instructions
sqlite> .read test.sql
Bus error(coredump)
irix64% rm test.db
irix64% rm core
irix64% dbx ./sqlite
dbx version 7.3.7 (96015_Nov16 MR) Nov 16 2004 07:34:16

Executable /home/afsd/hmd/tmp/sqlite-3.3.3/./sqlite
(dbx) r test.db
Process 345139655 (sqlite) started
SQLite version 3.3.3
Enter ".help" for instructions
sqlite> .read test.sql
Process 345139655 (sqlite) stopped on signal SIGBUS: Bus error (default) 
at [sqlite3CreateIndex:2421 +0x18,0x1004bae8]

2421  pIndex->azColl[i] = zColl;
(dbx) where
>  0 sqlite3CreateIndex(pParse = 0xfff8040, pName1 = (nil), pName2 
= (nil), pTblName = (nil), pList = 0x100896d0, onError = 99, pStart = 
(nil), pEnd = (nil), sortOrder = 0, ifNotExist = 0) 
["/home/afsd/hmd/tmp/sqlite-3.3.3/build.c":2421, 0x1004bae8]
  1 yy_reduce(yypParser = 0x10090c38, yyruleno = 87) 
["/home/afsd/hmd/tmp/sqlite-3.3.3/parse.y":315, 0x100390f4]

  2 sqlite3Parser(yyp = 0x10090c38, yymajor = 20, yyminor = struct Token {
   z = 0x1008a96a = ");"
   dyn = 0
   n = 1
}, pParse = 0xfff8040) 
["/home/afsd/hmd/tmp/sqlite-3.3.3/parse.c":3218, 0x1003b820]
  3 sqlite3RunParser(pParse = 0xfff8040, zSql = 0x1008a918 = 
"CREATE TABLE t ( a INTEGER  NOT NULL, b INTEGER NOT NULL, rval  REAL , 
UNIQUE(a,b));", pzErrMsg = 0xfff8020) 
["/home/afsd/hmd/tmp/sqlite-3.3.3/tokenize.c":391, 0x10037df0]
  4 sqlite3_prepare(db = 0x1008a978, zSql = 0x1008a918 = "CREATE TABLE 
t ( a INTEGER  NOT NULL, b INTEGER NOT NULL, rval  REAL , 
UNIQUE(a,b));", nBytes = -1, ppStmt = 0xfff8198, pzTail = 
0xfff81b8) ["/home/afsd/hmd/tmp/sqlite-3.3.3/prepare.c":539, 0x100364e4]
  5 sqlite3_exec(db = 0x1008a978, zSql = 0x1008a918 = "CREATE TABLE t ( 
a INTEGER  NOT NULL, b INTEGER NOT NULL, rval  REAL , UNIQUE(a,b));", 
xCallback = 0x1000b2a0, pArg = 0xfffa1f8, pzErrMsg = 0xfff8250) 
["/home/afsd/hmd/tmp/sqlite-3.3.3/legacy.c":56, 0x100759f8]
  6 process_input(p = 0xfffa1f8, in = 0xdb31088) 
["/home/afsd/hmd/tmp/sqlite-3.3.3/shell.c":1487, 0x10010130]
  7 do_meta_command(zLine = 0x10089848 = ".read", p = 0xfffa1f8) 
["/home/afsd/hmd/tmp/sqlite-3.3.3/shell.c":1219, 0x1000ed28]
  8 process_input(p = 0xfffa1f8, in = (nil)) 
["/home/afsd/hmd/tmp/sqlite-3.3.3/shell.c":1456, 0x1000fe48]



The sqlite-3.2.7 and sqlite-3.3.3 are compiled
this way

rm tclsqlite.c libsqlite.a sqlite 2> /dev/null
for i in *.c
  do
 echo $i
 cc -64 -g  -c $i
done
rm shell.o
ar scru libsqlite.a *.o
cc -64 -g  -o sqlite shell.c libsqlite.a



Re: [sqlite] SQLite to MySQL

2006-02-10 Thread Jim C. Nasby
On Fri, Feb 10, 2006 at 04:44:30PM +0100, Fanda Vacek wrote:
> You can choose what to use. An Elephant or a Dolphin :))

Or you could use both! :P
http://commandprompt.com/images/mammoth_versus_dolphin_500.jpg


Re: [sqlite] Database Disk Full

2006-02-10 Thread drh
"Drew, Stephen" <[EMAIL PROTECTED]> wrote:
>> 
> It's just a little bit misleading if you're not familiar with the
> circumstances it's raised in... I've had some confused colleagues
> wondering why their 100kb DB on a disk with 15gb free would be out of
> space :)
> 

I'm curious.  What was preventing them from writing to the file
if it was not a lack of disk space?  File permission problems 
should have been detected when the file was opened.  What else
would cause a short write?

--
D. Richard Hipp   <[EMAIL PROTECTED]>



RE: [sqlite] Database Disk Full

2006-02-10 Thread Drew, Stephen
Hello,

Thanks for the swift response.

Hmm I don't know to be honest, something generic perhaps like a failure
to write...

It's just a little bit misleading if you're not familiar with the
circumstances it's raised in... I've had some confused colleagues
wondering why their 100kb DB on a disk with 15gb free would be out of
space :)

It's nothing urgent for me, I will alter the error message I return to
offer more suggestions as to the cause, but given in Windows we can use
GetLastError() and format an error message, this information would no
doubt be of use to people in diagnosing why the file write failed.

Many thanks, and keep up the great work!

Steve

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: 10 February 2006 17:01
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Database Disk Full

"Drew, Stephen" <[EMAIL PROTECTED]> wrote:
> Hello,
>  
> In sqlite3OsWrite function (in os_win.c)  the following code exists:
>  
>   while( amt>0 && (rc = WriteFile(id->h, pBuf, amt, , 0))!=0 &&
> wrote>0 ){
> 
> amt -= wrote;
> 
> pBuf = &((char*)pBuf)[wrote];
> 
>   }
> 
>   if( !rc || amt>(int)wrote ){
> 
> return SQLITE_FULL;
> 
>   }
> 
> Is this really a valid occasion to return SQLITE_FULL? 

What error code would you suggest as an alternative?
--
D. Richard Hipp   <[EMAIL PROTECTED]>





Re: [sqlite] Creating a (really) big table

2006-02-10 Thread Jay Sprenkle
On 2/10/06, m christensen <[EMAIL PROTECTED]> wrote:
> THANK YOU.
>
> Someone finally asked the right question instead of answering the
> original one.
>
> Why would you possibly need 1,000 columns in a single table?

Most people ask the little questions and don't give you the "big picture".
A lot of times it's not well accepted when you suggest something that
implies they have less than perfect knowledge. ;)


Re: [sqlite] Database Disk Full

2006-02-10 Thread drh
"Drew, Stephen" <[EMAIL PROTECTED]> wrote:
> Hello,
>  
> In sqlite3OsWrite function (in os_win.c)  the following code exists:
>  
>   while( amt>0 && (rc = WriteFile(id->h, pBuf, amt, , 0))!=0 &&
> wrote>0 ){
> 
> amt -= wrote;
> 
> pBuf = &((char*)pBuf)[wrote];
> 
>   }
> 
>   if( !rc || amt>(int)wrote ){
> 
> return SQLITE_FULL;
> 
>   }
> 
> Is this really a valid occasion to return SQLITE_FULL? 

What error code would you suggest as an alternative?
--
D. Richard Hipp   <[EMAIL PROTECTED]>



Re: [sqlite] Creating a (really) big table

2006-02-10 Thread m christensen

THANK YOU.

Someone finally asked the right question instead of answering the 
original one.


Why would you possibly need 1,000 columns in a single table?

What are you trying to do?

Paul is probably correct and you don't really need to know how to create 
a table
with a zillion columns 'easier' but you need to correctly normalize your 
design.




Paul Tomblin wrote:


Quoting James Biggs ([EMAIL PROTECTED]):
 


Hi. My problem is that i want to create a table which should have around 1000
columns. Obviously, to add them manually would take a lot of time. Is there
a way to make this automatically? Any program or a command? I have looked
around but not much luck. Thanks for looking
   



99.99% of the time when somebody wants to make a table with that many
columns, it's because they don't understand relational databases and are
trying to put information that should be in a joined table into columns in
the main table.

 



[sqlite] Database Disk Full

2006-02-10 Thread Drew, Stephen
Hello,
 
In sqlite3OsWrite function (in os_win.c)  the following code exists:
 
  while( amt>0 && (rc = WriteFile(id->h, pBuf, amt, , 0))!=0 &&
wrote>0 ){

amt -= wrote;

pBuf = &((char*)pBuf)[wrote];

  }

  if( !rc || amt>(int)wrote ){

return SQLITE_FULL;

  }

Is this really a valid occasion to return SQLITE_FULL?   Surely
WriteFile Win32 API call can fail to write a full for a plethora of
reasons, or am I missing something?

Many thanks in advance

Regards,

Steve



Re: [sqlite] Question about Regular Expression

2006-02-10 Thread Derrell . Lipman
malcom <[EMAIL PROTECTED]> writes:

> Hello,
> I have a sqlite column with a string. This string is composed by n
> different lines separated by an \n character. Each line is composed by
> : . So my final string is something like this:
>
> : \n
> : \n
> : 
>
> Now I need to search *only* inside a particular key value. For example
> I would to see if the value of key_2 contains a string 'test' (and if
> possible return the entire value of key key_2).

This is a perfect use for having a different table contain your key/value
pairs.  Consider this:

CREATE TABLE item
(
  item_id   INTEGER PRIMARY KEY
);

CREATE TABLE attributes
(
  item_id   INTEGER REFERENCES item,
  data_key  TEXT,
  data_valueTEXT
);

INSERT INTO item VALUES (1);
INSERT INTO attributes VALUES (1, 'description', 'My first item');
INSERT INTO attributes VALUES (1, 'quantity', '3');

INSERT INTO item VALUES (2);
INSERT INTO attributes VALUES (2, 'description', 'My second item');
INSERT INTO attributes VALUES (2, 'quantity', '7');

-- now we can easily search for a particular value within a specific key
-- or, as you requested, the whole value if some text exists within the
-- value
SELECT item_id, data_value
  FROM attributes
  WHERE data_key = 'description'
AND data_value GLOB '*second*';


This didn't answer your question, but may provide a better method to
accomplish your goals.

Derrell


Re: [sqlite] Question about Regular Expression

2006-02-10 Thread Jay Sprenkle
> I have a sqlite column with a string. This string is composed by n
> different lines separated by an \n character. Each line is composed by
> : . So my final string is something like this:
>
> : \n
> : \n
> : 
>
> Now I need to search *only* inside a particular key value. For example
> I would to see if the value of key_2 contains a string 'test' (and if
> possible return the entire value of key key_2).
> Is it possible? My solution is to use regular expression (anyone can
> hep me? I don't know more about them).

That would work fine. You could easily create a user defined function
and use the regular expression lib in it. Google search shows articles
on using regex in python, ruby, and php so you might be able to find
something already worked out for your use.


[sqlite] Question about Regular Expression

2006-02-10 Thread malcom
Hello,
I have a sqlite column with a string. This string is composed by n
different lines separated by an \n character. Each line is composed by
: . So my final string is something like this:

: \n
: \n
: 

Now I need to search *only* inside a particular key value. For example
I would to see if the value of key_2 contains a string 'test' (and if
possible return the entire value of key key_2).
Is it possible? My solution is to use regular expression (anyone can
hep me? I don't know more about them).
Here:
http://refdb.sourceforge.net/manual/sect1-regular-expressions.html
I've seen that probability sqlite supports only SQL simple regular
expression ("...Some database engines like SQLite do not support
Unix-style regular expressions. You have to use SQL regular
expressions in this case"). Is it true? And if it's true is
possible to make this using only SQL regexp?
Thank you very much.
Malcom


Re: [sqlite] SQLite to MySQL

2006-02-10 Thread Fanda Vacek

You can choose what to use. An Elephant or a Dolphin :))

Fanda

On Thu, 09 Feb 2006 02:43:13 +0100, Jim C. Nasby <[EMAIL PROTECTED]>  
wrote:



See also http://sql-info.de/mysql/gotchas.html.

About the only downsides I can think of with PostgreSQL is that it's
out-of-the-box configuration is meant for like a 486 and that not quite
as many hosting providers offer it. That url has about 100 downsides to
MySQL (many of which are rather serious). PostgreSQL is also strives to
stay as close to ANSI SQL as possible and makes it nearly impossible to
configure your database in such a way that it's only a matter of time
and luck before you end up with corrupted data.

Granted, MySQL added a lot of features in 5.0, but they still focus much
less on doing things the right way than PostgreSQL does.

And remember: Feb 31st isn't a date. :)

On Thu, Feb 09, 2006 at 07:47:47AM +1100, John Stanton wrote:

PostgreSQL implements standard SQL as well as the features of an
enterprise DBMS.  On that basis if you are changing it makes sense to
change to the fuller-featured product, one in the same class as Oracle
and DB2.  In the short term Mysql could be as good as PostgreSQL.

Fanda Vacek wrote:
>I'm not sure, if Postgres is better choice than MySQL. I have used both
>of  them to find out which is the better one. Both of them can do
>almost  anything. The choice is a matter of taste and person. We are
>free to  choose:)) I'm talking about MySQL 5 and PostgreSQL 8.1.
>
>Sorry for writing this to SQLite mail-list.
>
>Fanda
>
>On Tue, 07 Feb 2006 22:35:09 +0100, John Stanton <[EMAIL PROTECTED]>
>wrote:
>
>>Jim C. Nasby wrote:
>>
>>>On Mon, Feb 06, 2006 at 05:30:39PM +0100, Laurent Goussard wrote:
>>>
Hi there,

I use SQLite on my website for 2 years now. I do like SQLite a lot  
and
will use it for a lot of new web projects but, because I got more  
and
more traffic, I consider to move this one to MySQL in order to  
reduce

the over load of my computer (I host it @ home).

Do you know if there is a way to convert easily an SQLite database
into a MySQL one ?
(I'm especially thinking about the escapestring and other "create
table [myTable] {" issues...)
>>>
>>>  FWIW, I believe SQLite's syntax is closer to PostgreSQL's than it
>>>is  to
>>>MySQL, so it might me easier to migrate that direction...
>>
>>
>>If you are migrating to an enterprise level DBMS, PostgreSQL is a
>>better  choice than Mysql.  It is fully featured with all the
>>qualities of DB2  and Oracle but without the expense.
>>
>>Note that you will need considerably more machine resources to run a
>>"heavier" DBMS than Sqlite.  For example on our 166MHz, 256MB RS/6000
>>PostgreSQL is sluggish but on our dual processor 1.2GHz, 2GB P-Series
>>it  is lightning fast.  Sqlite runs fast on the 166MHz machine.
>>
>
>








Re: [sqlite] DBD:SQLite and sqlite3_column_decltype()

2006-02-10 Thread Dennis Cote

Nathan Kurz wrote:


Hello --

I'm trying to track down a segfault that happens when I'm using
DBD::SQLite for Perl, and I'm confused by the documentation for
sqlite3_column_decltype().  I think I understand what it does, but
I think there are some typos that make me uncertain:

http://sqlite.org/capi3ref.html#sqlite3_column_decltype

The first argument is a prepared SQL statement. If this statement is
a SELECT statement, the Nth column of the returned result set of the
SELECT is a table column then the declared type of the table column
is returned. If the Nth column of the result set is not at table
column, then a NULL pointer is returned. The returned string is UTF-8
encoded for sqlite3_column_decltype() and UTF-16 encoded for
sqlite3_column_decltype16(). For example, in the database schema:

CREATE TABLE t1(c1 INTEGER);



And the following statement compiled:

SELECT c1 + 1, 0 FROM t1;



 Then this routine would return the string "INTEGER" for the second
 result column (i==1), and a NULL pointer for the first result column
 (i==0).

Is the first sentence supposed to be "If this statement is a SELECT
statement [and if] the Nth column..."?  And the next sentence should
be "is not [a] table column"?  And is the final paragraph correct, or
are the numbers reversed for which is NULL and which is "INTEGER"?  


I think what's happening with the Perl interface is that
sqlite3_column_decltype() returns NULL if the table is created without
an explicit type, instead of the "" or "TEXT" that I would have
expected.  Is this correct?  Or should it return something else?

Thanks!

Nathan Kurz
[EMAIL PROTECTED]

 


Nathan,

I believe you are correct about the two typos, but I think the final 
paragraph is correct. I think the example select statement is wrong. It 
should read:


   SELECT c1+1, c1 FROM t1;

I have replace the zero with c1. Now the final paragraph makes sense. 
The first result column is the result of an expression, not a table 
column, so it returns a NULL pointer for the declared type string. The 
second result  is from column c1 and the function returns a pointer to a 
string containing its declared type, "INTEGER".


As far as your Perl interface is concerned, if you didn't explicitly 
give the column a type, there is no declared type for it to return, so 
it should return an empty string. It shouldn't return a NULL pointer, 
that means the result is not taken directly from a table column.


HTH
Dennis Cote




Re: [sqlite] Creating a (really) big table

2006-02-10 Thread Jim C. Nasby
On Fri, Feb 10, 2006 at 07:44:37AM -0500, Paul Tomblin wrote:
> Quoting James Biggs ([EMAIL PROTECTED]):
> > Hi. My problem is that i want to create a table which should have around 
> > 1000
> > columns. Obviously, to add them manually would take a lot of time. Is there
> > a way to make this automatically? Any program or a command? I have looked
> > around but not much luck. Thanks for looking
> 
> 99.99% of the time when somebody wants to make a table with that many
> columns, it's because they don't understand relational databases and are
> trying to put information that should be in a joined table into columns in
> the main table.

Agreed. What is it you're trying to do?
-- 
Jim C. Nasby, Sr. Engineering Consultant  [EMAIL PROTECTED]
Pervasive Software  http://pervasive.comwork: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf   cell: 512-569-9461


Re: [sqlite] Database is Full error

2006-02-10 Thread drh
Teg <[EMAIL PROTECTED]> wrote:
> I have a 15 gig database that I'm trying to "vacuum", the table
> structure's butt simple but, after running most of the night it tells
> me "Database is Full". Not sure exactly what that means.
> 
> I have 24 gigs of disk space free on the disk so, I don't think I ran
> out.

It takes a little over 30GiB of free disk space to vacuum
a 15GiB file.

If you don't have that much space, you can vacuum this way:

   sqlite3 olddb .dump | sqlite3 newdb
   rm olddb
   mv newdb olddb

That only takes about 15GiB of disk space, but is not atomic.

> 
> SQlite3.exe is 3.2.2
> 
> It's telling me the "database disk image is malformed" now too.

This bug was fixed in 3.2.6.  See the first bullet on the release
notes.

--
D. Richard Hipp   <[EMAIL PROTECTED]>



[sqlite] Database is Full error

2006-02-10 Thread Teg

I have a 15 gig database that I'm trying to "vacuum", the table
structure's butt simple but, after running most of the night it tells
me "Database is Full". Not sure exactly what that means.

I have 24 gigs of disk space free on the disk so, I don't think I ran
out.

SQlite3.exe is 3.2.2

The database was created using: 3.2.7

It's telling me the "database disk image is malformed" now too.

Have I bumped into some upper limit on DB size? Or is this an issue
with the version I'm using? I'm downloading 3.3.3 as I write this.

C



Re: [sqlite] unaligned access with sqlite 3.3.3 on IA64

2006-02-10 Thread drh
"Chowdhury, Chandan Dutta" <[EMAIL PROTECTED]> wrote:
> Reading repository metadata in from local files
> yum(26535): unaligned access to 0x60404f44,
> ip=0x24e683e0
> yum(26535): unaligned access to 0x60405094,
> ip=0x24e683e0
> yum(26535): unaligned access to 0x60405154,
> ip=0x24e683e0
> yum(26535): unaligned access to 0x6040e9f4,
> ip=0x24e683e0
> No Packages marked for Update/Obsoletion

I need additional clues.  Can you please recompile with -g,
run this in a debugger, and let me know exactly where the
misaligned access occurs?

I am holding up the release of 3.3.4 on this issue.

--
D. Richard Hipp   <[EMAIL PROTECTED]>



Re: [sqlite] feild value pairs

2006-02-10 Thread Arjen Markus
chetana bhargav wrote:
> 
> Hi,
> 
>   My requirement is that, I want to store some common properties and some 
> more optional properties depending on the need of each application. Where 
> these optional properties need to be stored as feild value pairs. Most of the 
> values(almost 99.5%) values are of integer type. And there are some 100 odd 
> such properties
> 
>   Now my problem if I want to store these optional properties, do I create a 
> column for each type or just store them as blob. If we store them as blob is 
> there any sginificat performance impact if some one stores all the properties 
> in one record as the record size grows. Presuming all properties are stored 
> taking 400 bytes for each record(at max).
> 
>   Do we have any analysis the enumeration time or load time if we have large 
> data in one record. Or the overall impact because of couple of  large records.
> 
> 

Why not use a separate table with columns like:

- appname - string
- property- string
- intvalue- integer
- stringvalue - string

YOu can select all the properties for a specific application and the
general ones:
  
   SELECT * FROM xxx WHERE appname = 'myapp' OR appname = 'GENERAL';

or some such set-up. No need to use loads of columns. This is what
relational databases 
are good at.

Regards,

Arjen



[sqlite] feild value pairs

2006-02-10 Thread chetana bhargav
Hi,
   
  My requirement is that, I want to store some common properties and some more 
optional properties depending on the need of each application. Where these 
optional properties need to be stored as feild value pairs. Most of the 
values(almost 99.5%) values are of integer type. And there are some 100 odd 
such properties
   
  Now my problem if I want to store these optional properties, do I create a 
column for each type or just store them as blob. If we store them as blob is 
there any sginificat performance impact if some one stores all the properties 
in one record as the record size grows. Presuming all properties are stored 
taking 400 bytes for each record(at max). 
   
  Do we have any analysis the enumeration time or load time if we have large 
data in one record. Or the overall impact because of couple of  large records.


-
Brings words and photos together (easily) with
 PhotoMail  - it's free and works with Yahoo! Mail.

Re: [sqlite] Creating a (really) big table

2006-02-10 Thread Xavier Noria

On Feb 10, 2006, at 13:01, James Biggs wrote:



I can do for example

$dbh->do( "CREATE TABLE my_table (etc etc etc)");

but i don't know a Perl command for creating a table with many  
columns. I

did not find one in the docs either. Thanks


The idea is that you build the SQL string dynamically:

my @column_defs = fetch_column_defs_from_somwehere();
my $sql = <

[sqlite] unaligned access with sqlite 3.3.3 on IA64

2006-02-10 Thread Chowdhury, Chandan Dutta
Hello All,

I am using sqlite-3.3.3 with yam and pysqlite on a RedHat Enterprise
Linux 4 IA64 machine. I get a lot of "unaligned access" message while
using yum.

# yum update
Setting up Update Process
Setting up repositories
os100% |=|  951 B
00:00
build_tools   100% |=|  951 B
00:00
Reading repository metadata in from local files
yum(26535): unaligned access to 0x60404f44,
ip=0x24e683e0
yum(26535): unaligned access to 0x60405094,
ip=0x24e683e0
yum(26535): unaligned access to 0x60405154,
ip=0x24e683e0
yum(26535): unaligned access to 0x6040e9f4,
ip=0x24e683e0
No Packages marked for Update/Obsoletion

I have noticed some warnings while compiling sqlite-3.3.3 

./libtool --mode=compile gcc -O2 -g -DOS_UNIX=1 -DHAVE_USLEEP=1
-DHAVE_FDATASYNC=1 -I. -I./src -DNDEBUG   -DTHREADSAFE=0
-DSQLITE_OMIT_CURSOR -c ./src/vdbe.c
 gcc -O2 -g -DOS_UNIX=1 -DHAVE_USLEEP=1 -DHAVE_FDATASYNC=1 -I. -I./src
-DNDEBUG -DTHREADSAFE=0 -DSQLITE_OMIT_CURSOR -c ./src/vdbe.c  -fPIC
-DPIC -o .libs/vdbe.o
./src/vdbe.c: In function `sqlite3VdbeExec':
./src/vdbe.c:2000: warning: cast to pointer from integer of different
size
./src/vdbe.c:2016: warning: cast from pointer to integer of different
size
 gcc -O2 -g -DOS_UNIX=1 -DHAVE_USLEEP=1 -DHAVE_FDATASYNC=1 -I. -I./src
-DNDEBUG -DTHREADSAFE=0 -DSQLITE_OMIT_CURSOR -c ./src/vdbe.c -o vdbe.o
>/dev/null 2>&1

...
...

 gcc -O2 -g -DOS_UNIX=1 -DHAVE_USLEEP=1 -DHAVE_FDATASYNC=1 -I. -I./src
-DNDEBUG -DTHREADSAFE=0 -DSQLITE_OMIT_CURSOR -c ./src/table.c  -fPIC
-DPIC -o .libs/table.o
./src/table.c: In function `sqlite3_get_table':
./src/table.c:148: warning: cast to pointer from integer of different
size
./src/table.c: In function `sqlite3_free_table':
./src/table.c:193: warning: cast from pointer to integer of different
size
 gcc -O2 -g -DOS_UNIX=1 -DHAVE_USLEEP=1 -DHAVE_FDATASYNC=1 -I. -I./src
-DNDEBUG -DTHREADSAFE=0 -DSQLITE_OMIT_CURSOR -c ./src/table.c -o table.o
>/dev/null 2>&1

The following confirms that the issue is coming from sqlite

python
Python 2.3.4 (#1, Feb  2 2005, 11:44:21)
[GCC 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite
>>> db = sqlite.connect("//var/cache/yum/os/primary.xml.gz.sqlite")
>>> cur = db.cursor()
>>> cur.execute("select * from db_info")
python(26534): unaligned access to 0x6008dfe4,
ip=0x239503e0
python(26534): unaligned access to 0x6008e134,
ip=0x239503e0
python(26534): unaligned access to 0x6008e1f4,
ip=0x239503e0

Is this a bug in sqlite.

Thanks in advance for the help.

Regards
Chandan Dutta Chowdhury


Re: [sqlite] Creating a (really) big table

2006-02-10 Thread Markus Hoenicka
Markus Hoenicka <[EMAIL PROTECTED]> was heard to say:

Sorry for the typo, fixed below

my $command = "CREATE TABLE my_table (";

foreach my $counter (1..999) {
  $command .= "INT column" . $counter . ", ";
}

$command .= "INT column1000)";

print $command;


-- 
Markus Hoenicka
[EMAIL PROTECTED]
(Spam-protected email: replace the quadrupeds with "mhoenicka")
http://www.mhoenicka.de



Re: [sqlite] Creating a (really) big table

2006-02-10 Thread Markus Hoenicka
James Biggs <[EMAIL PROTECTED]> was heard to say:

>
> I can do for example
>
> $dbh->do( "CREATE TABLE my_table (etc etc etc)");
>
> but i don't know a Perl command for creating a table with many columns. I
> did not find one in the docs either. Thanks
>

Something along these lines (untested!!) should work:

my $command = "CREATE TABLE my_table (";

foreach my $counter (1..999) {
  $columns .= "INT column" . $counter . ", ";
}

$command .= "INT column1000)";

print $command;

You may need to name your columns more intelligently.

regards,
Markus

-- 
Markus Hoenicka
[EMAIL PROTECTED]
(Spam-protected email: replace the quadrupeds with "mhoenicka")
http://www.mhoenicka.de



Re: [sqlite] Creating a (really) big table

2006-02-10 Thread James Biggs

I can do for example

$dbh->do( "CREATE TABLE my_table (etc etc etc)");

but i don't know a Perl command for creating a table with many columns. I
did not find one in the docs either. Thanks

--
View this message in context: 
http://www.nabble.com/Creating-a-%28really%29-big-table-t1096710.html#a2868524
Sent from the SQLite forum at Nabble.com.



Re: [sqlite] Creating a (really) big table

2006-02-10 Thread Markus Hoenicka
James Biggs <[EMAIL PROTECTED]> was heard to say:

>
> Hi. My problem is that i want to create a table which should have around 1000
> columns. Obviously, to add them manually would take a lot of time. Is there
> a way to make this automatically? Any program or a command? I have looked
> around but not much luck. Thanks for looking

What about writing a small Perl|Ruby|Python script to generate a SQL command
that you feed to sqlite?

regards,
Markus

-- 
Markus Hoenicka
[EMAIL PROTECTED]
(Spam-protected email: replace the quadrupeds with "mhoenicka")
http://www.mhoenicka.de



[sqlite] Creating a (really) big table

2006-02-10 Thread James Biggs

Hi. My problem is that i want to create a table which should have around 1000
columns. Obviously, to add them manually would take a lot of time. Is there
a way to make this automatically? Any program or a command? I have looked
around but not much luck. Thanks for looking
--
View this message in context: 
http://www.nabble.com/Creating-a-%28really%29-big-table-t1096710.html#a2862610
Sent from the SQLite forum at Nabble.com.