Re: [sqlite] SQLITE3_OPEN returns SQLITE_NOMEM

2008-12-21 Thread hussainfarzana

Dear Kartthi,

Hope you have resolved this issue, and we have started 3.6.7 version of
Sqlite and now we too got the same error. If you have already solved this
and having a solution, kindly guide us so that we could get rid of this
issue.
 Note: We are working with 3.6.1 version of sqlite and it is working fine
without any problem.

Regards
Farzana

sqlite wrote:
> 
> Dear All,
> 
> I have just started using the SQLite Db in my applications. My application
> runs under MIPS processor. I have generated the Sqlite3.dll and
> Sqlite3.lib file for the MIPS processor and it is geting compiled. When i
> use Sqlit3_Open function to open a DB, it fails with the error message
> SQLITE_NOMEM. But the same code is running fine in the Windows mode. How
> should i rectify this? Can anyone help me in this regard.
> 
> Thanks
> Kartthi
> 

-- 
View this message in context: 
http://www.nabble.com/SQLITE3_OPEN-returns-SQLITE_NOMEM-tp16254109p21123489.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] Trigger UPDATE based on a different row

2008-12-21 Thread jose isaias cabrera
"jose isaias cabrera" wrote...

>
> "P Kishor" wrote...
>
>> On 12/20/08, jose isaias cabrera  wrote:
>>>
>>>  Greetings!
>>>
>>>  Imagine these rows in a table named LSOpenJobs:
>>>
>>>  id, PID,subject, bdate, edate, lang,job
>>>  1, 232,2008-01-01,2008-01-10,es,trans
>>>  2, 232,2008-01-01,2008-01-10,fr,trans
>>>  3, 232,2008-01-01,2008-01-10,it,trans
>>>  4, 232,2008-01-01,2008-01-10,es,val
>>>  5, 232,2008-01-01,2008-01-10,fr,val
>>>  6, 232,2008-01-01,2008-01-10,it,val
>>>
>>>  What I would like to do is to create a trigger to update the bdate for
>>> the
>>>  'val' job of the same lang and same PID, with the edate of the 'trans'
>>> job
>>>  of same lang and same PID.  For example, in this case above, let's take
>>> id
>>>  1; the bdate for the 'val' job with the 'es' lang with the same PID, id
>>> 4,
>>>  should be updated with the edate of id 1.  So, the trigger should 
>>> UPDATE
>>> the
>>>  table to this,
>>>
>>>  id, PID,subject, bdate, edate, lang,job
>>>  1, 232,2008-01-01,2008-01-10,es,trans
>>>  2, 232,2008-01-01,2008-01-10,fr,trans
>>>  3, 232,2008-01-01,2008-01-10,it,trans
>>>  4, 232,2008-01-10,2008-01-10,es,val
>>>  5, 232,2008-01-10,2008-01-10,fr,val
>>>  6, 232,2008-01-10,2008-01-10,it,val
>>>
>>>  The trigger example in the site expects to change the same row.  This
>>> UDPATE
>>>  is based on other rows of the same table and same PID.
>>>
>>>  Any help is greatly appreciated.
>>>
>>
>>
>> José,
>>
>> Consider the following
>>
>> [04:43 PM] ~$sqlite3
>> SQLite version 3.5.9
>> Enter ".help" for instructions
>> sqlite> CREATE TABLE foo (id, PID, bdate, edate, lang,job);
>> sqlite> INSERT INTO foo VALUES (1,
>> 232,'2008-01-01','2008-01-10','es','trans');
>> sqlite> INSERT INTO foo VALUES (2,
>> 232,'2008-01-01','2008-01-10','fr','trans');
>> sqlite> INSERT INTO foo VALUES (3,
>> 232,'2008-01-01','2008-01-10','it','trans');
>> sqlite> INSERT INTO foo VALUES (4,
>> 232,'2008-01-01','2008-01-10','es','val');
>> sqlite> INSERT INTO foo VALUES (5,
>> 232,'2008-01-01','2008-01-10','fr','val');
>> sqlite> INSERT INTO foo VALUES (6,
>> 232,'2008-01-01','2008-01-10','it','val');
>> sqlite> UPDATE foo SET bdate = (SELECT f2.edate FROM foo f1 JOIN foo
>> f2 ON f1.PID = f2.PID AND f1.lang = f2.lang WHERE f1.job = 'val' AND
>> f2.job = 'trans' AND f1.id = foo.id) WHERE foo.job = 'val';
>> sqlite> SELECT * FROM foo;
>> 1|232|2008-01-01|2008-01-10|es|trans
>> 2|232|2008-01-01|2008-01-10|fr|trans
>> 3|232|2008-01-01|2008-01-10|it|trans
>> 4|232|2008-01-10|2008-01-10|es|val
>> 5|232|2008-01-10|2008-01-10|fr|val
>> 6|232|2008-01-10|2008-01-10|it|val
>> sqlite>
>>
>> The UPDATE statement above seems to do what you want. Convert that to
>> a TRIGGER if you so want, but realize that the TRIGGER is supposed to,
>> well, trigger on some event such as UPDATE or INSERT or DELETE. Other
>> than that, the above should get you going.
>>
>
> Thanks, Puneet.  I can work with this.
>
> josé

Puneet,

thanks for the help.  i have one more check to do: If the bdate of the 'val' 
job is greater than the 'trans' job, then the val job should stay the same. 
So, I ran this UPDATE:

CREATE TABLE foo (id, PID, bdate, edate, lang,job);
INSERT INTO foo VALUES (1, 232,'2008-01-01','2008-01-10','es','trans');
INSERT INTO foo VALUES (2, 232,'2008-01-01','2008-01-10','fr','trans');
INSERT INTO foo VALUES (3, 232,'2008-01-01','2008-01-10','it','trans');
INSERT INTO foo VALUES (4, 232,'2008-01-01','2008-01-10','es','val');
INSERT INTO foo VALUES (5, 232,'2008-01-01','2008-01-10','fr','val');
INSERT INTO foo VALUES (6, 232,'2008-01-11','2008-01-11','it','val');
UPDATE foo SET bdate = (SELECT f2.edate FROM foo f1 JOIN foo
f2 ON f1.PID = f2.PID AND f1.lang = f2.lang WHERE f1.job = 'val' AND
f2.job = 'trans' AND f1.id = foo.id AND f1.bdate < f2.edate) WHERE foo.job = 
'val';
SELECT * FROM foo;
1|232|2008-01-01|2008-01-10|es|trans
2|232|2008-01-01|2008-01-10|fr|trans
3|232|2008-01-01|2008-01-10|it|trans
4|232|2008-01-10|2008-01-10|es|val
5|232|2008-01-10|2008-01-10|fr|val
6|232||2008-01-11|it|val
sqlite>

As you can see, line 6 has lost the bdate.  I did some searches on the 
internet to try to find out how to get it to work, but could not figure it 
out.  Newbie, of course.

thanks for any help you guys could provide,

josé 

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


Re: [sqlite] [sqlite-announce] SQLite version 3.6.7

2008-12-21 Thread William Kyngesburye
On Dec 21, 2008, at 9:09 PM, Dan wrote:

> I found I also needed:
>
>   -DSQLITE_ENABLE_LOCKING_STYLE -D__DARWIN__
>
> Dan.


Huh, __DARWIN__ doesn't seem to be an OSX system macro.  I wonder why  
__APPLE__ isn't used, I figured __DARWIN__ was set.  And I missed  
SQLITE_ENABLE_LOCKING_STYLE in the compile options.  Time to review  
the compile options ;)

-
William Kyngesburye 
http://www.kyngchaos.com/

"I ache, therefore I am.  Or in my case - I am, therefore I ache."

- Marvin


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


Re: [sqlite] [sqlite-announce] SQLite version 3.6.7

2008-12-21 Thread Dan

On Dec 22, 2008, at 12:44 AM, William Kyngesburye wrote:

> On Dec 16, 2008, at 12:35 PM, D. Richard Hipp wrote:
>
>> Version 3.6.7 includes a major cleanup of the Unix driver in
>> os_unix.c.  Also included is the new "Proxy Locking" locking module
>> for OSX.  Proxy Locking provides greatly enhanced performance for
>> databases located on AFP filesystems.  The Proxy Locking module is
>> turned off by default.
>>
> Finally got a chance to try this.  When enabling the proxy locking (-
> DSQLITE_PREFER_PROXY_LOCKING) I get a compile error:
>
> sqlite3.c: In function 'unixOpen':
> sqlite3.c:25244: error: storage size of 'fsInfo' isn't known
> sqlite3.c:25252: error: 'MNT_LOCAL' undeclared (first use in this
> function)
> sqlite3.c:25252: error: (Each undeclared identifier is reported only
> once
> sqlite3.c:25252: error: for each function it appears in.)


I found I also needed:

   -DSQLITE_ENABLE_LOCKING_STYLE -D__DARWIN__

Dan.


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


Re: [sqlite] confusing with how to to this in sqlite

2008-12-21 Thread Simon Davies
2008/12/21 Rachmat Febfauza :
>
> It looks like you are using the sqlite3 shell, so experiment with .separator
>
> Have you used .help?
>
> Rgds,
> Simon
>
>
> yes i am using sqlite3 shell, i mean not to make display like mysql does, but 
> the difference column that i want like mysql does.
>
> take a look at this different
> A1221|SMALL|FOOD|CAKE|HOMS 1|2007-05-06 11:31:57|2007-05-06 11:42:46|649 
> (this is done with sqlite)
>
> A1221SMALLFOODCAKEHOMS 12007-5-6 11:31:572007-5-6 
> 11:31:570 (this is done with mysql)
>
> why in sqlite we got (649) : 2007-05-06 11:31:57|2007-05-06 11:42:46|649
> and in mysql we got (0) : 2007-5-6 11:31:572007-5-6 11:31:570
>
> or i think the reason is like i found in mysql documentation like this :
> "If you use LEFT JOIN to find rows that do not exist in some table and you 
> have the following test: col_name IS NULL in the WHERE part, where col_name 
> is a column that is declared as NOT NULL, MySQL stops searching for more rows 
> (for a particular key combination) after it has found one row that matches 
> the LEFT JOIN condition. "
>
> i also have test with left join but the result don't like mysql does.
>
> sory for my less knowledge
>
> thanks
>

Without the group by clause the result set is:
sqlite> select awal1.Code, awal1.Level, awal1.Category, awal1.Product,
awal1.Location, awal1."Begin",akhir1."End", strftime("%s",akh
ir1."End")-strftime("%s",awal1."Begin") as Difference from awal1,
akhir1 where awal1.Code = akhir1.Code and akhir1.Category like awa
l1.Category || '%' and awal1.Product = akhir1.Product and
awal1.Location = akhir1.Location and akhir1."End" >= awal1."Begin";
A1220SMALLFOODMARGARINEHOMS 12007-05-06 11:42:46
 2007-05-06 11:42:460
A1221SMALLFOODCAKEHOMS 22007-05-06 11:31:57
2007-05-06 11:31:570
A1221SMALLFOODCAKEHOMS 12007-05-06 11:31:57
2007-05-06 11:31:570
A1221SMALLFOODCAKEHOMS 12007-05-06 11:31:57
2007-05-06 11:42:46649
A1221SMALLFOODCAKEHOMS 12007-05-06 11:42:46
2007-05-06 11:42:460
A1222SMALLFOODWAFERHOMS 22007-05-06 11:20:34
2007-05-06 11:31:57683
A1222SMALLFOODWAFERHOMS 12007-05-06 11:20:34
2007-05-06 11:31:57683
A1222SMALLFOODWAFERHOMS 12007-05-06 11:20:34
2007-05-06 11:42:461332
A1222SMALLFOODWAFERHOMS 12007-05-06 11:42:46
2007-05-06 11:42:460
A1236MEDIUMFOODSNACKHOMS 22007-05-06 10:48:57
2007-05-06 11:19:211824
A1236MEDIUMFOODSNACKHOMS 12007-05-06 10:48:57
2007-05-06 11:19:251828
A1269SMALLCLOTHESBELTHOMS 32007-05-07 17:28:25
2007-05-07 17:28:272

The group by clause combines rows
A1221SMALLFOODCAKEHOMS 12007-05-06 11:31:57
2007-05-06 11:31:570
A1221SMALLFOODCAKEHOMS 12007-05-06 11:31:57
2007-05-06 11:42:46649
into 1 row. The values in the columns not included in the group by
clause ("Begin", "End" and Difference) could be from any of the
combined rows (which rows is not, I believe, specified in any
standard). MySql and Sqlite seem to result in different selections. If
you want specific rows, then you need to modify the query to control
the data selection. In this case it appears that:
select  awal1.Code,
awal1.Level,
awal1.Category,
awal1.Product,
awal1.Location,
awal1."Begin",
min( akhir1."End" ),
min( strftime("%s",akhir1."End")-strftime("%s",awal1."Begin")  ) as 
Difference
fromawal1, akhir1
where   awal1.Code = akhir1.Code and
akhir1.Category like awal1.Category || '%' and
awal1.Product = akhir1.Product and
awal1.Location = akhir1.Location and
akhir1."End" >= awal1."Begin"
group byawal1."Begin",
awal1.Code,
awal1.Category,
awal1.Product,
awal1.Location;

gives the result you want.

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


Re: [sqlite] Trigger UPDATE based on a different row

2008-12-21 Thread jose isaias cabrera

"P Kishor" wrote...

> On 12/20/08, jose isaias cabrera  wrote:
>>
>>  Greetings!
>>
>>  Imagine these rows in a table named LSOpenJobs:
>>
>>  id, PID,subject, bdate, edate, lang,job
>>  1, 232,2008-01-01,2008-01-10,es,trans
>>  2, 232,2008-01-01,2008-01-10,fr,trans
>>  3, 232,2008-01-01,2008-01-10,it,trans
>>  4, 232,2008-01-01,2008-01-10,es,val
>>  5, 232,2008-01-01,2008-01-10,fr,val
>>  6, 232,2008-01-01,2008-01-10,it,val
>>
>>  What I would like to do is to create a trigger to update the bdate for 
>> the
>>  'val' job of the same lang and same PID, with the edate of the 'trans' 
>> job
>>  of same lang and same PID.  For example, in this case above, let's take 
>> id
>>  1; the bdate for the 'val' job with the 'es' lang with the same PID, id 
>> 4,
>>  should be updated with the edate of id 1.  So, the trigger should UPDATE 
>> the
>>  table to this,
>>
>>  id, PID,subject, bdate, edate, lang,job
>>  1, 232,2008-01-01,2008-01-10,es,trans
>>  2, 232,2008-01-01,2008-01-10,fr,trans
>>  3, 232,2008-01-01,2008-01-10,it,trans
>>  4, 232,2008-01-10,2008-01-10,es,val
>>  5, 232,2008-01-10,2008-01-10,fr,val
>>  6, 232,2008-01-10,2008-01-10,it,val
>>
>>  The trigger example in the site expects to change the same row.  This 
>> UDPATE
>>  is based on other rows of the same table and same PID.
>>
>>  Any help is greatly appreciated.
>>
>
>
> José,
>
> Consider the following
>
> [04:43 PM] ~$sqlite3
> SQLite version 3.5.9
> Enter ".help" for instructions
> sqlite> CREATE TABLE foo (id, PID, bdate, edate, lang,job);
> sqlite> INSERT INTO foo VALUES (1, 
> 232,'2008-01-01','2008-01-10','es','trans');
> sqlite> INSERT INTO foo VALUES (2, 
> 232,'2008-01-01','2008-01-10','fr','trans');
> sqlite> INSERT INTO foo VALUES (3, 
> 232,'2008-01-01','2008-01-10','it','trans');
> sqlite> INSERT INTO foo VALUES (4, 
> 232,'2008-01-01','2008-01-10','es','val');
> sqlite> INSERT INTO foo VALUES (5, 
> 232,'2008-01-01','2008-01-10','fr','val');
> sqlite> INSERT INTO foo VALUES (6, 
> 232,'2008-01-01','2008-01-10','it','val');
> sqlite> UPDATE foo SET bdate = (SELECT f2.edate FROM foo f1 JOIN foo
> f2 ON f1.PID = f2.PID AND f1.lang = f2.lang WHERE f1.job = 'val' AND
> f2.job = 'trans' AND f1.id = foo.id) WHERE foo.job = 'val';
> sqlite> SELECT * FROM foo;
> 1|232|2008-01-01|2008-01-10|es|trans
> 2|232|2008-01-01|2008-01-10|fr|trans
> 3|232|2008-01-01|2008-01-10|it|trans
> 4|232|2008-01-10|2008-01-10|es|val
> 5|232|2008-01-10|2008-01-10|fr|val
> 6|232|2008-01-10|2008-01-10|it|val
> sqlite>
>
> The UPDATE statement above seems to do what you want. Convert that to
> a TRIGGER if you so want, but realize that the TRIGGER is supposed to,
> well, trigger on some event such as UPDATE or INSERT or DELETE. Other
> than that, the above should get you going.
>

Thanks, Puneet.  I can work with this.

josé 

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


Re: [sqlite] [sqlite-announce] SQLite version 3.6.7

2008-12-21 Thread William Kyngesburye
On Dec 16, 2008, at 12:35 PM, D. Richard Hipp wrote:

> Version 3.6.7 includes a major cleanup of the Unix driver in
> os_unix.c.  Also included is the new "Proxy Locking" locking module
> for OSX.  Proxy Locking provides greatly enhanced performance for
> databases located on AFP filesystems.  The Proxy Locking module is
> turned off by default.
>
Finally got a chance to try this.  When enabling the proxy locking (- 
DSQLITE_PREFER_PROXY_LOCKING) I get a compile error:

sqlite3.c: In function 'unixOpen':
sqlite3.c:25244: error: storage size of 'fsInfo' isn't known
sqlite3.c:25252: error: 'MNT_LOCAL' undeclared (first use in this  
function)
sqlite3.c:25252: error: (Each undeclared identifier is reported only  
once
sqlite3.c:25252: error: for each function it appears in.)


OSX 10.5.6, Xcode 3.1.2

-
William Kyngesburye 
http://www.kyngchaos.com/

"Those people who most want to rule people are, ipso-facto, those  
least suited to do it."

- A rule of the universe, from the HitchHiker's Guide to the Galaxy


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


Re: [sqlite] Sharing a database / Replication

2008-12-21 Thread Simon
> Most you need to know about locking is found in:
> http://www.sqlite.org/lang_transaction.html
> 
> sqlite3_exec() these statements one by one:
> ATTACH 'filename' as db2;
> BEGIN IMMEDIATE; -- or EXCLUSIVE
> (error handling/retry) 
> 
> -- this assumes table1 has the exact 
> -- same definition in both db1 and db2
> INSERT INTO db1.table1 SELECT * FROM db2.table1;
> (error handling)
> 
> COMMIT; -- or ROLLBACK

Ok, good...  Thanks a lot for this quick structure!

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


Re: [sqlite] confusing with how to to this in sqlite

2008-12-21 Thread Rachmat Febfauza

It looks like you are using the sqlite3 shell, so experiment with .separator

Have you used .help?

Rgds,
Simon


yes i am using sqlite3 shell, i mean not to make display like mysql does, but 
the difference column that i want like mysql does. 

take a look at this different
A1221|SMALL|FOOD|CAKE|HOMS 1|2007-05-06 11:31:57|2007-05-06 11:42:46|649 (this 
is done with sqlite)

A1221SMALLFOODCAKEHOMS 12007-5-6 11:31:572007-5-6 
11:31:570 (this is done with mysql)

why in sqlite we got (649) : 2007-05-06 11:31:57|2007-05-06 11:42:46|649
and in mysql we got (0) : 2007-5-6 11:31:572007-5-6 11:31:570

or i think the reason is like i found in mysql documentation like this :
"If you use LEFT JOIN to find rows that do not exist in some table and you have 
the following test: col_name IS NULL in the WHERE part, where col_name is a 
column that is declared as NOT NULL, MySQL stops searching for more rows (for a 
particular key combination) after it has found one row that matches the LEFT 
JOIN condition. "

i also have test with left join but the result don't like mysql does.

sory for my less knowledge

thanks


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