I created a table like this:
CREATE TABLE record_trip (trip_id CHAR(1), gp_no CHAR(1), rec_date INTEGER,
trun CHAR(1), ctrl_id CHAR(1), moment_value INTEGER, minutes_value INTEGER,
set_value INTEGER );
CREATE UNIQUE INDEX i_record_trip ON record_trip (trip_id, gp_no, rec_date);
And the trigger
Doesn't update return wrong code while there isn't record in table?
Is it normal action?
_code__
#include stdio.h
#include sqlite3.h
void create_db (void);
int main (void)
{
int ret = -1;
create_db ();
sqlite3 *db = NULL;
Thank you for you reply, :)
But I see the return errmsg is unknown error on sqlite3.6.23-1. What does
it mean?
Kees Nuyt wrote:
On Mon, 24 May 2010 01:27:05 -0700 (PDT), liubin liu
7101...@sina.com wrote:
Doesn't update return wrong code while
there isn't record in table
the original version of sqlite in fedora is 3.4.2. I built the newest version
on Fedora-7.0. And get the the wrong in building sqlite-3.6.23.1 on
Fedora-7.0 like below:
./libtool --mode=compile --tag=CC gcc -g -O2 -DSQLITE_OS_UNIX=1 -I.
-I../SQLite-b078b588d617e078/src -D_HAVE_SQLITE_CONFIG_H
Senior Scientist
Northrop Grumman Mission Systems
From: sqlite-users-boun...@sqlite.org on behalf of liubin liu
Sent: Thu 5/13/2010 2:07 AM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] multi processes, so many errores of SQLITE_BUSY and
SQLITE_MISUSE
).It's just the write operations
(INSERT/UPDATE) which will cause SQLITE_BUSY to occur.
Michael D. Black
Senior Scientist
Northrop Grumman Mission Systems
From: sqlite-users-boun...@sqlite.org on behalf of liubin liu
Sent: Tue 5/11/2010 9:20 PM
Multi processes, getting so many errores of SQLITE_BUSY and SQLITE_MISUSE...
And the system performance is very bad because of the three processes of
insert/read/update database.
How to improve the sqlite3's operations?
_my codes___
Grumman Mission Systems
From: sqlite-users-boun...@sqlite.org on behalf of liubin liu
Sent: Tue 5/11/2010 4:57 AM
To: sqlite-users@sqlite.org
Subject: [sqlite] multi processes, so many errores of SQLITE_BUSY and
SQLITE_MISUSE
...
--
View
:16
Michael D. Black
Senior Scientist
Northrop Grumman Mission Systems
From: sqlite-users-boun...@sqlite.org on behalf of liubin liu
Sent: Sat 4/24/2010 1:58 AM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Is there any memory leak
A routine of sqlite3_prepare_v2() + sqlite3_step() + sqlite3_finalize() could
contain leak.
It sound ridiculous. But the test code seems to say it. Or I used the
sqlite3_* wrongly.
__code__
#include stdio.h
#include unistd.h // for usleep()
And I watch the the process's run by top.
At first, the memory statistics is:
PID PPID USER STAT VSZ%MEM %CPU COMMAND
17731 15488 root S1104 5% 7% ./sqlite3multiwrite
When the printf() prints the 150, the memory statistics is:
PID PPID USER
Below is my code. My question is:
Is there any memory leak in the pthread2?
While pthread1 is using test.db exclusively, the sqlite3_prepare_v2() of
pthread2 still prepares the p_stmt pointer to a piece of memory malloced by
sqlite3_preapare_v2(). And then the sqlite3_finalize() can't free the
Is there any memory leak in the code?
Below is the code. Is there any memory leak in the pthread2?
While pthread1 is using test.db exclusively, the sqlite3_prepare_v2() of
pthread2 still prepares the p_stmt pointer to a piece of memory malloced by
sqlite3_preapare_v2(). And then the
Is there any memory leak in the code?
Below is the code. Is there any memory leak in the pthread2?
While pthread1 is using test.db exclusively, the sqlite3_prepare_v2() of
pthread2 still prepares the p_stmt pointer to a piece of memory malloced by
sqlite3_preapare_v2(). And then the
question multible times... ;)
to answer: what makes you think that sqlite3_finalize can't
free the prepared statement ?
liubin liu wrote:
Is there any memory leak in the code?
Below is the code. Is there any memory leak in the pthread2?
While pthread1 is using test.db exclusively
);
ret = sqlite3_prepare_v2 (db1, sql, -1, p_stmt, NULL);
sqlite3_free(sql);
Michael D. Black
Senior Scientist
Northrop Grumman Mission Systems
From: sqlite-users-boun...@sqlite.org on behalf of liubin liu
Sent: Fri 4/23/2010 7:16
return code
is wrong, and the memory pointed by p_stmt isn't freed by
sqlite3_finalize()?
Simon Slavin-3 wrote:
On 23 Apr 2010, at 1:16pm, liubin liu wrote:
But I test the routine of sqlite3_prepare_v2() + sqlite3_step() +
sqlite3_finalize() in my real code.
And the test result say
my program is blocked at the point of sqlite3_prepare_v2(*). Why?
512
513 sqlite3_stmt *p_stmt = NULL;
514 printf ( ### 500, %p, %s, %p\n,
g_db_base, sql, p_stmt);
515 ret = sqlite3_prepare_v2 (g_db_base, sql, -1, p_stmt, NULL);
516 printf (
my program is blocked at the point of sqlite3_prepare_v2(*). Why?
512
513 sqlite3_stmt *p_stmt = NULL;
514 printf ( ### 500, %p, %s, %p\n,
g_db_base, sql, p_stmt);
515 ret = sqlite3_prepare_v2 (g_db_base, sql, -1, p_stmt, NULL);
516 printf (
my application is like below. To get 2 records after a special records. But
wrong count, the count is 5:
sqlite
sqlite CREATE TABLE t1 (id INTEGER PRIMARY KEY, data INTEGER);
sqlite INSERT INTO t1 VALUES (3, 999);
sqlite INSERT INTO t1 VALUES (2, 989);
sqlite INSERT INTO t1 VALUES (4, 1009);
Thanks, I've gotten the point, :)
and the next question is that how to know the true count after a special
record while getting a special number records.
P Kishor-3 wrote:
On Sun, Mar 21, 2010 at 9:19 PM, liubin liu 7101...@sina.com wrote:
my application is like below. To get 2 records
I want to insert several pieces of data (include blob) into a table in a
transaction by programing in C language , like:
char *sql[n+2];
sql[0] = sqlite3_mprintf (BEGIN;);
char *sql_f = INSERT OR REPLACE INTO collstate VALUES (%d, %d, ?);;
for (i=1; in+1; i++)
sql[i] = sqlite3_mprintf
I want to create two tables like:
create table t1 (id INT PRIMARY KEY, cont TEXT);
create table t2 ({select count(*) from t1} INT);
How could I do it?
--
View this message in context:
http://old.nabble.com/one-column-is-another-table%27s-row-num-tp27940860p27940860.html
Sent from the SQLite
why SQLITE_BUSY when read the database
My application suffered a problem that sqlite3_step(*) of SELECT returns
SQLITE_BUSY.
I know Multiple processes can be doing a SELECT at the same time. But only
one process can be making changes to the database at any moment in time,
however. from the
how to show the equivalent hex value of integer data while select in sqlite3
shell?
sqlite
sqlite CREATE TABLE test (id INTEGER, data INTEGER);
sqlite INSERT INTO test VALUES (1, 32);
sqlite SELECT * FROM test;
1|32
sqlite
sqlite
sqlite SELECT hex(data) FROM test;
3332 ### hope to get 0x20
the process runs on a board with Atmel AT91SAM9260 (Clocks: CPU 198 MHz,
...), Memory: 16MB, yaffs on NAND 256MB.
the time of writing one row is more than 20mS, and the time of reading one
row is more than 3mS.
Is it the ceiling of the SQLite3? If no, how to improve it? espically
improving the
The environment is:
Linux at91sam9260nand 2.6.25.10
SQLite 3.6.5
liubin liu wrote:
the process runs on a board with Atmel AT91SAM9260 (Clocks: CPU 198 MHz,
...), Memory: 16MB, yaffs on NAND 256MB.
the time of writing one row is more than 20mS, and the time of reading one
row is more
[...@** createdb]$
[...@** createdb]$ sqlite3 ./db_ctrl_0.1.db
SQLite version 3.6.5
Enter .help for instructions
Enter SQL statements terminated with a ;
sqlite CREATE TABLE periods_value (id INTEGER PRIMARY KEY, valid CHAR(1),
value BLOB );
sqlite
sqlite INSERT OR REPLACE INTO periods_value
Thanks!!!
SimonDavies wrote:
2009/12/9 liubin liu 7101...@sina.com:
sqlite INSERT OR REPLACE INTO periods_value VALUES (0, 1,
x'000102030400a0afaabbaa');
sqlite
sqlite SELECT * FROM periods_value;
0|1|
sqlite
how to show the blob data?
Select id, valid, hex( value ) from
database connection...
Pavel
On Sun, Nov 29, 2009 at 7:46 PM, liubin liu 7101...@sina.com wrote:
Thank you!
I'm sorry for not showing clearly the environment is embedded linux on
arm
board.
Because there are several process who use the database. I have another
question:Could I close
process and when other
process receives it then it closes its database connection...
Pavel
On Sun, Nov 29, 2009 at 7:46 PM, liubin liu 7101...@sina.com wrote:
Thank you!
I'm sorry for not showing clearly the environment is embedded linux on
arm
board.
Because there are several process
, Nov 29, 2009 at 7:46 PM, liubin liu 7101...@sina.com wrote:
Thank you!
I'm sorry for not showing clearly the environment is embedded linux on
arm
board.
Because there are several process who use the database. I have another
question:Could I close the database of other process in main
);
...
}
...
}
liubin liu wrote:
I do the job as you say, but the problem is still here.
There are several processes who write the database. And the place is not
same each time that the problem happens.
How could I know the reason exactly?
Pavel Ivanov-2 wrote:
Because
process when you shut down?
Nick.
-Original Message-
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of liubin liu
Sent: 26 November 2009 02:29
To: sqlite-users@sqlite.org
Subject: [sqlite] sqlite3 is blocked by transaction when wanting to
close
My application includes a main process and some other processes. I open the
database in other process, but at end I will close the database in main
process.
The problem happens while I close the database. The main process is blocked.
And I could see the journal file is still there, so I guess
Thank you!
I mayn't need the high precision like
212345678901234567890123456.988290112.
John Crenshaw-2 wrote:
May I use sqlite3_bind_double() and sqlite3_prepare_v2() to solve the
problem.
That won't fix it. Your number is too large to fit in any native data
type. Even the plain math
Thanks a lot for every reply.
The num is just random num. The project is on power-measurement. So there
are some big nums with high precision.
May I use sqlite3_bind_double() and sqlite3_prepare_v2() to solve the
problem.
liubin liu wrote:
Now I use the sqlite3_mprintf() and the %f
Now I use the sqlite3_mprintf() and the %f to get the double num. My code
is below.
Now there is a num like 212345678901234567890123456.988290112. With the
way of sqlite3_mprintf() and %f, the num is cut to
2123456789012346000.00.
How to input the num
create table and index:
CREATE TABLE data_rt ( id INTEGER, dataid CHAR(4), data CHAR(12), rec_time
INTEGER, data_type CHAR(1) );
CREATE UNIQUE INDEX i_drt ON data_rt ( id, dataid );
there are data in the table of data_rt:
sqlite SELECT * FROM data_rt;
6|1290|7e22473a|857000|22
Thanks!
This is what I need, :)
Jay A. Kreibich-2 wrote:
On Mon, Aug 31, 2009 at 06:33:08PM -0700, liubin liu scratched on the
wall:
create table and index:
CREATE TABLE data_rt ( id INTEGER, dataid CHAR(4), data CHAR(12),
rec_time
INTEGER, data_type CHAR(1) );
CREATE UNIQUE INDEX
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; i4; i++, m*=0x100 )
1337 gateaddr =
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
1.)How does sqlite3's select work?
Does it need to seach for all the records?
2.)Is there any relation between errno and the sqlite3's result code?
--
View this message in context:
How could I know which SQLite3's api is reentrant?
Pavel Ivanov-2 wrote:
Why do you re-post your code as if it's another question not related
to previous one (along with the answer)?
does it mean that the sqlite3's C-api isn't reentrant or thread-safety?
If SQLite is compiled with
does it mean that the sqlite3's C-api isn't reentrant or thread-safety?
#include stdio.h // for printf()
#include signal.h // for signal()
#include unistd.h // for alarm()
#include stdlib.h // for system()
#include
Thank you very much for your post
Just after I post the last code I know the concept of reentrant and
thread-safety.
And you should notice the wrong usage of printf() in signal handle func. ^_^
So I re-writed the code and re-test. And the problem is still in someplace.
So I re-post the
there is problem when getting data by sqlite3's c apis in signal-handling
func.
_
#include stdio.h // for printf()
#include signal.h // for signal()
#include unistd.h // for alarm()
#include stdlib.h // for
why is the data file locked after writing?
the last printf() result is:
# IN END, ret = 5
according to the Result Codes:
#define SQLITE_BUSY 5 /* The database file is locked */
It means to the database file is locked? why does it happen after writing?
why is the data file locked after after using transaction?
the last result of printf() is:
# IN END, ret = 5
It means to the database file is locked?
why does it happen after using transaction although using
sqlite3_finalize()?
PS:
if shielding the codes relating with the transaction, all the
You are right
I have mend the fault, ^_^
Thank You a lot!
Igor Tandetnik wrote:
liubin liu wrote:
why is the data file locked after after using transaction?
the last result of printf() is:
# IN END, ret = 5
It means to the database file is locked?
why does it happen after using
(12, '1290', '732e4a39', 8323000, 8323255, 22);
Simon Slavin-2 wrote:
On 3 Jun 2009, at 7:05am, liubin liu wrote:
the first step is to tell if there is the data in the table.
if the answer is not, I want to insert a row of data into the table
if the answer is yes, I need to update
Does It mean the method isn't the right way?
Simon Slavin-2 wrote:
On 3 Jun 2009, at 7:05am, liubin liu wrote:
the first step is to tell if there is the data in the table.
if the answer is not, I want to insert a row of data into the table
if the answer is yes, I need to update the row
only supplied 3 column names but in the values list you have
6 values.
--- On Thu, 6/4/09, liubin liu 7101...@sina.com wrote:
From: liubin liu 7101...@sina.com
Subject: Re: [sqlite] how to compose the sql sentence?
To: sqlite-users@sqlite.org
Date: Thursday, June 4, 2009, 2:39 AM
design, declare a primary key with these
three fields.
Second, the error message says it all: You supplied three column -
names, but 6 values.
Martin
liubin liu schrieb:
Thank you a lot!
I created a table:
CREATE TABLE data ( num INTEGER, di CHAR(4), data CHAR(12), time1
INTEGER
, declare a primary key with these
three fields.
Second, the error message says it all: You supplied three column -
names, but 6 values.
Martin
liubin liu schrieb:
Thank you a lot!
I created a table:
CREATE TABLE data ( num INTEGER, di CHAR(4), data CHAR(12), time1
INTEGER,
time2
the first step is to tell if there is the data in the table.
if the answer is not, I want to insert a row of data into the table
if the answer is yes, I need to update the row of data acccording to the
data inputting from me.
--
View this message in context:
Thanks!
It sounds pretty good. But I don't understand it exactly. Could you write
down the sample codes?
Matthew L. Creech wrote:
On Mon, Apr 27, 2009 at 10:25 PM, liubin liu 7101...@sina.com wrote:
thanks
I'm not sure of the real reason.
It's true that the speed of inserting
thanks
I'm not sure of the real reason.
It's true that the speed of inserting with transaction is very fast. But my
project is using SQLite mainly in selecting something. I don't know how to
use transaction in the situation. May some friends give me some codes on
that?
My application needs some
Thanks
I amend the code according to your message.
Marcus Grimm wrote:
in your test code I see that you open the sqlite DB
each time you perform the single query.
I guess it would be fair to open the sqlite DB only once
outside your test loop.
2nd: You query against ID without an index,
our project is using sqlite3, but found that the speed is too slow.
I just tested the BerkeleyDB, and found that the speed is very fast. But I
knew the sqlite3 is fast enough. And so I'm confused.
I may be using sqlite3 in wrong way?
anyway, next is my test code. I'm glad to receive your
Yes, sqlite3_get_table() is good to handle the mission. and I am always using
it.
but I found that the prefomance was a little weak. and so I want to get some
other API to handle the same mission.
Kees Nuyt wrote:
On Sat, 7 Mar 2009 01:09:28 -0800 (PST), liubin liu
7101...@sina.com wrote
:10 -0800 (PST), liubin liu
7101...@sina.com wrote:
which func could get the number of rows?
There is no function to retrieve the number of rows in a
result set. SQLite doesn't know the number in advance, but
returns row by row while iterating through the tables. The
application can
made under the influence of
distillates? :)
g
-Original Message-
From: liubin liu [mailto:7101...@sina.com]
Sent: Friday, March 06, 2009 2:39 AM
To: sqlite-users@sqlite.org
Subject: [sqlite] Are there distillate posts in the sqlite3 board?
are there any distillate posts
are there any distillate posts in the sqlite3 board ?
--
View this message in context:
http://www.nabble.com/Are-there-distillate-posts-in-the-sqlite3-board--tp22368215p22368215.html
Sent from the SQLite mailing list archive at Nabble.com.
___
which func could get the number of row?
--
View this message in context:
http://www.nabble.com/which-func-could-get-the-number-of-row-tp22369246p22369246.html
Sent from the SQLite mailing list archive at Nabble.com.
___
sqlite-users mailing list
there are many errors in the codes.
but still worthwhile to go through them carefully.
liubin liu wrote:
This's very good!
I just download the codes from here:
http://www.apress.com/book/downloadfile/2847
dcharno wrote:
Could you tell me where can I find such documentation
This's very good!
I just download the codes from here:
http://www.apress.com/book/downloadfile/2847
dcharno wrote:
Could you tell me where can I find such documentation, or can you
recommend some books.
The Definitive Guide to SQLite by Michael Owens explains the SQLite
API in detail
:
liubin liu 7101...@sina.com wrote in message
news:22176984.p...@talk.nabble.com
the question is on the callback function's return values of
sqlite3_exec()
when using sqlite3_exec() to do select * from ..., how to get all
the return values by using the callback function?
it could print
the question is on the callback function's return values of sqlite3_exec()
when using sqlite3_exec() to do select * from ..., how to get all the
return values by using the callback function?
struct olt_info
{
int olt_index;
int olt_logo;
char* olt_line;
// int nmber;
};
int
69 matches
Mail list logo