[sqlite] Does anybody can port sqlite3-3.3.7 to uClinux based-ARModulator?

2007-03-13 Thread LuYanJun
Hi guys
   uClinux version with 2003.
   kernel with linux-2.4.x.
   sqlite with 3.3.7
   verdor with GDB.
   productor with ARModulator.
   compilied process work out as well. "illegal write to 0x54fd0 of 0x11affb4" 
I received.

[EMAIL PROTECTED] uClinux-dist-2003]# arm-elf-gdb linux-2.4.x/linux 
GNU gdb 5.0
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-elf"...
(gdb) target sim
Loaded ROM boot.rom
Loaded ROM boot.rom
Loaded ROM boot.rom
Loaded ROM boot.rom
Connected to the simulator.
(gdb) load
Loading section .init, size 0xa000 vma 0x100
Loading section .text, size 0xd0180 vma 0x100a000
Loading section .data, size 0x9154 vma 0x10dc000
Start address 0x100
Transfer rate: 7444128 bits in <1 sec.
(gdb) run
Starting program: /mnt/sdb/Parcket/uClinux-dist-2003/linux-2.4.x/linux 
Linux version 2.4.20-uc0 ([EMAIL PROTECTED]) (gcc version 2.95.3 20010315 
(release)(ColdFire patches - 20010318 from http://fiddes.net/coldfire/)(uClinux 
XIP and shared lib patches from http://www.snapgear.com/)) #1 Wed Mar 14 
16:41:17 CST 2007
Processor: Atmel AT91M40xxx revision 0
Architecture: EB01
On node 0 totalpages: 1024
zone(0): 0 pages.
zone(1): 1024 pages.
zone(2): 0 pages.
Kernel command line: root=/dev/rom0
Calibrating delay loop... 12.97 BogoMIPS
Memory: 4MB = 4MB total
Memory: 2984KB available (832K code, 182K data, 40K init)
Dentry cache hash table entries: 512 (order: 0, 4096 bytes)
Inode cache hash table entries: 512 (order: 0, 4096 bytes)
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
Buffer-cache hash table entries: 1024 (order: 0, 4096 bytes)
Page-cache hash table entries: 1024 (order: 0, 4096 bytes)
POSIX conformance testing by UNIFIX
Linux NET4.0 for Linux 2.4
Based upon Swansea University Computer Society NET3.039
Initializing RT netlink socket
Starting kswapd
Atmel USART driver version 0.99
ttyS0 at 0xfffd (irq = 2) is a builtin Atmel APB USART
ttyS1 at 0xfffcc000 (irq = 3) is a builtin Atmel APB USART
Blkmem copyright 1998,1999 D. Jeff Dionne
Blkmem copyright 1998 Kenneth Albanowski
Blkmem 1 disk images:
0: 140-155D3FF [VIRTUAL 140-155D3FF] (RO)
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
SkyEye NE2k Ethernet driver version 0.2 (2003-04-27) 
sene2k dev name: eth0: <6>NET4: Linux TCP/IP 1.0 for NET4.0
IP Protocols: ICMP, UDP, TCP
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 512 bind 512)
NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
VFS: Mounted root (romfs filesystem) readonly.
Shell invoked to run file: /etc/rc
Command: #hostname GDB-ARMulator
Command: #/bin/expand /etc/ramfs.img /dev/ram0
Command: #mount -t proc proc /proc
Command: #mount -t ext2 /dev/ram0 /var
Command: #mkdir /var/tmp
Command: #mkdir /var/log
Command: #mkdir /var/run
Command: #mkdir /var/lock
Command: #cat /etc/motd
Command: #/bin/ifconfig eth0 up 10.0.0.2
Command: 
Command: hostname GDB-ARMulator
Command: /bin/expand /etc/ramfs.img /dev/ram1
Command: mount -t proc proc /proc
mount: /etc/mtab: Read-only file system
Command: mount -t ext2 /dev/ram1 /var
mount: /etc/mtab: Read-only file system
Command: mkdir /var/tmp
Command: mkdir /var/log
Command: mkdir /var/run
Command: mkdir /var/lock
Command: mkdir /var/empty
Command: cat /etc/motd
Welcome to
   _  _
 /  __| ||_| 
_   _| |  | | _   _   _  _  _ 
   | | | | |  | || |  _ \| | | |\ \/ /
   | |_| | |__| || | | | | |_| |/\
   |  ___\|_||_|_| |_|\|\_/\_/
   | |
   |_|

GDB/ARMulator support by <[EMAIL PROTECTED]>
For further information check:
http://www.uclinux.org/

Command: 
Execution Finished, Exiting

Sash command shell (version 1.1.1)
/> cd bin
/bin> sqlite3
illegal write to 0x54fd0 of 0x11affb4

Program received signal SIGINT, Interrupt.
illegal read from 0x214e04d0
illegal read from 0x214e04d1
illegal read from 0x214e04d2
illegal read from 0x214e04d3
0x14e0524 in ?? ()
(gdb) 


Re: [sqlite] does sqlite support mutil-thread be run in samedatabase?

2007-01-18 Thread LuYanJun
But I still get orignal error message, a pice of code as follow, suppose all 
routines open the same database:
void fillSchedule(void *param)
{
   Open();
   ...
   Close();
}
void fillCredits(void *param)
{
   Open();
   ...
   Close();
}
int main(void)
{
  Open()
  ...
  Close();
  hThreadSchedule = CreateThread(..., fillSchedule, ...);
  hThreadCredits = CreateThread(..., fillCredits, ...);
  
  WaitForSingleObject(.., hThreadSchedule,...);
  WaitForSingleObject(.., hThreadCredits,...);
}
So does the through is right?
- Original Message - 
From: "Dan Kennedy" <[EMAIL PROTECTED]>
To: 
Sent: Friday, January 19, 2007 1:08 PM
Subject: Re: [sqlite] does sqlite support mutil-thread be run in samedatabase?


> 
> On Fri, 2007-01-19 at 11:42 +0800, LuYanJun wrote:
>> The next question is that if I want to use multi-thread in sqlite, so
>> I need to open same database for two times, right?
> 
> Right. Each thread has to have it's own sqlite3* handle.
> 
> 
>> - Original Message - 
>> From: "LuYanJun" <[EMAIL PROTECTED]>
>> To: "sqlite-users sqlite.org" 
>> Sent: Friday, January 19, 2007 10:53 AM
>> Subject: [sqlite] does sqlite support mutil-thread be run in same database?
>> 
>> 
>> > Hi guys
>> >   does sqlite support mutil-thread be run in same database? because of I 
>> > am stuck in such below sqlite error message:
>> > error number = 21
>> > error message = library routine called out of sequence
>> >  certainly, I get some useful hints from stuff about interface of SQLite, 
>> > but I am not sure that weather sqlite support multi-thread.
>> > Tks in advance.
> 
> 
> -
> To unsubscribe, send email to [EMAIL PROTECTED]
> -
> 
>

Re: [sqlite] does sqlite support mutil-thread be run in same database?

2007-01-18 Thread LuYanJun
The next question is that if I want to use multi-thread in sqlite, so
I need to open same database for two times, right?
- Original Message - 
From: "LuYanJun" <[EMAIL PROTECTED]>
To: "sqlite-users sqlite.org" 
Sent: Friday, January 19, 2007 10:53 AM
Subject: [sqlite] does sqlite support mutil-thread be run in same database?


> Hi guys
>   does sqlite support mutil-thread be run in same database? because of I am 
> stuck in such below sqlite error message:
> error number = 21
> error message = library routine called out of sequence
>  certainly, I get some useful hints from stuff about interface of SQLite, but 
> I am not sure that weather sqlite support multi-thread.
> Tks in advance.

[sqlite] SELECT * FROM Schdeule WHERE title LIKE '%%%'

2006-12-21 Thread LuYanJun
Hi guy
   Suppose there is table name Schedule and more than two records be stored. 
however, one filed name as title and its values contain '%' in one of both 
records , so then such SQL pharse: SELECT * FROM Schedule WHERE title LIKE 
'%%%' be given  , then return both records NOT only one .
example:
.. | .. | title| ...
.. | .. | I hate you % | ...
.. | .. | I love you   | ...
so what's problem come with me? 
 

Re: [sqlite] SQL error: near "READ_ONLY": syntax error

2006-12-18 Thread LuYanJun
Thanks, But I step the instruction fellow the hint by offcial document by which 
said that's correct(BTW forgive me my poor english ):
http://www.sqlite.org/concurrency.html
4.1 Read-only transactions
BEGIN READ_ONLY;
SELECT * FROM t1;
SELECT * FROM t2;
COMMIT;

4.2 Defer write locks
BEGIN READ_INITIALLY;
SELECT * FROM t1;
SELECT * FROM t2;
COMMIT;
4.4 Defer writes
 BEGIN DEFER_WRITES;
SELECT * FROM t1;
-- Processing delay
UPDATE t1 SET ... WHERE ...
SELECT * FROM t2;
-- Processing delay
UPDATE t2 SET ... WHERE ...
SELECT * FROM t3;
-- Processing delay
UPDATE t3 SET ... WHERE ...
COMMIT;
...and so forth.

I wonder that does do something with version? 
- Original Message - 
From: "Marten Feldtmann" <[EMAIL PROTECTED]>
To: 
Sent: Monday, December 18, 2006 3:00 PM
Subject: Re: [sqlite] SQL error: near "READ_ONLY": syntax error


> LuYanJun schrieb:
>> Hi guy:
>> what does the follow meaning?
>> sqlite> BEGIN READ_ONLY;
>> SQL error: near "READ_ONLY": syntax error
> READ_ONLY is not a valid option for this command.
> 
> BEGIN [DEFERRED | EXCLUSIVE | IMMEDIATE]
> 
> Marten
> 
> -
> To unsubscribe, send email to [EMAIL PROTECTED]
> -
> 
>

[sqlite] SQL error: near "READ_ONLY": syntax error

2006-12-17 Thread LuYanJun
Hi guy:
what does the follow meaning?
sqlite> BEGIN READ_ONLY;
SQL error: near "READ_ONLY": syntax error

Re: [sqlite] Music Files

2006-11-29 Thread LuYanJun
Ok, Let me do it with C language
const unsigned char* Format(const char* szFormat, ...);
int AudioFillDatabase(const char* audiofile);
int main(void)
{
 Open();
  execDML(" CREATE TABLE IF NOT EXISTS AudioTable (id INTEGER , \n"
" name VARCHAR , \n"
  " data BLOB , \n"
  " type VARCHAR);");
AudoFillDatabase(SomeSongname.xxx);
Close();
exit(0);
}
int AudioFillDatabase(const char* audiofile)
{
   FILE* fp = fopen(audiofile, "rb");
   if ( fp == NULL )
  return -1;
   else {
  fseek(fp, 0, SEEK_END);
 long filesize = ftell(fp);
 unsigned char* MemFileSize = new unsigned char[filesize + 1];
  size_t ret = fread(MemFileSize, filesize, 1, fp);
  if ( ret != 0 )
 return -1;
  else {
 unsigned char* buf = new unsigned char[filesize+1024];
buf = Format("insert into AudioTable values (0, 'music', %Q, 'mp3');", 
MemFileSize);
   execDML(buf);
  }
 }
const char* format(const char* szFromat, ...)
{
   va_list va;
   va_start(va, szFormat);
   static char* mpBuf = sqlite3_vmprintf(szFormat, va);
   va_end(va);
   return mpBuf;
}
- Original Message - 
From: "Isaac Raway" <[EMAIL PROTECTED]>
To: 
Sent: Tuesday, November 28, 2006 11:04 PM
Subject: Re: [sqlite] Music Files


> On 11/27/06, LuYanJun <[EMAIL PROTECTED]> wrote:
>>
>> Can anybody give a simple example for domestrating ?
>> I am puzzled by this topic, how does a music file be sotred in DB as BLOB
>> type?
> 
> 
> You can insert /any/ kind of data into a SQLite database (or most any other
> sort of DB for that matter). Here's a short Pascal program that would do
> about what you want -- but of course getting the binary data out and into an
> object that can play it is another matter. Also I imagine this would be very
> slow, coming in at around 3 - 5 MB per song that has to be completely loaded
> into memory from the DB before playback and begin. I have not tested this
> but it gives you the idea: 1) load data into a stream / data string 2) write
> as DB BLOB.
> 
> var
>  MP3Source: string;
>  Data: TFileStream
> 
>  DBFileName: string;
>  DB: TSQLiteDatabase;
>  MustCreate: boolean;
> begin
>  MP3Source := 'SomeSong.mp3';
>  DBFileName := 'mp3.db3';
> 
>  MustCreate := not FileExists(DBFileName);
>  DB := TSQLiteDatabase.Create(DBFileName);
>  try
>if MustCreate then begin
>  DB.ExecSQL('CREATE TABLE mp3(filename STRING PRIMARY KEY, data
> BLOB);');
>end;
> 
>Data := TFileStream.Create(MP3Source, fmOpenRead);
>try
>  Data.Seek(0);
> 
>  DB.UpdateBlob('INSERT OR UPDATE INTO mp3(filename, data) ' +
>'VALUES(' + QuotedStr(MP3Source) + ', ?);', Data);
>finally
>  FreeAndNil(Data);
>end;
>  finally
>DB.Close;
>FreeAndNil(DB);
>  end;
> end;
>

Re: [sqlite] Music Files

2006-11-27 Thread LuYanJun
Can anybody give a simple example for domestrating ?
I am puzzled by this topic, how does a music file be sotred in DB as BLOB type?

TKS.
- Original Message - 
From: "Alex Roston" <[EMAIL PROTECTED]>
To: 
Sent: Saturday, October 28, 2006 4:35 AM
Subject: Re: [sqlite] Music Files


> At one point there was a project that did something like this, and it 
> was called Route66. I think it used mysql, perl and a player called 
> splay. You might google it.
> 
> Alex
> 
> sebcity wrote:
> 
>>Is it possible to store mp3 files in a SSQLite database? would they be able
>>to be played from the database? How would you save them?
>>  
>>
> 
> 
> -
> To unsubscribe, send email to [EMAIL PROTECTED]
> -
> 
>

[sqlite] Fw: Why can't I delete tmp.db after close sqlite?

2006-11-08 Thread LuYanJun
if the file is new for opening, then success for delete, in other hand, if the 
file is old for opening, then failed for delete. example as follow:
 sqlite3_open("tmp.db", &mpDB); //tmp.db is exist

- Original Message - 
From: LuYanJun 
To: sqlite-users sqlite.org 
Sent: Thursday, November 09, 2006 11:11 AM
Subject: Why can't I delete tmp.db after close sqlite?


Hi all
Why can't I delete tmp.db after close sqlite?

sqlite3* mpDB;
  int nRet = sqlite3_open("tmp.db", &mpDB);
  if (nRet != SQLITE_OK)
  {
   const char* szError = sqlite3_errmsg(mpDB);
   printf("open error:%s\n",szError);
  }
  sqlite3_close(mpDB);
  printf("close!\n");
  if ( ! ::DeleteFile(tmp.db ))
  {
   printf("delete error!\n");
  }
  else
   printf("ok delete!!!\n");
  return 0; 

Best regards

[sqlite] Why can't I delete tmp.db after close sqlite?

2006-11-08 Thread LuYanJun
Hi all
Why can't I delete tmp.db after close sqlite?
 
sqlite3* mpDB;
  int nRet = sqlite3_open("tmp.db", &mpDB);
  if (nRet != SQLITE_OK)
  {
   const char* szError = sqlite3_errmsg(mpDB);
   printf("open error:%s\n",szError);
  }
  sqlite3_close(mpDB);
  printf("close!\n");
  if ( ! ::DeleteFile(tmp.db ))
  {
   printf("delete error!\n");
  }
  else
   printf("ok delete!!!\n");
  return 0; 

Best regards