Mail Archives: djgpp/2004/09/14/22:16:57
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | SQLite problem
|
From: | boohiss <boohiss AT cubesource DOT net>
|
MIME-Version: | 1.0
|
Message-ID: | <opseci8wqr7iosox@boohiss-927a07e>
|
User-Agent: | Opera M2/7.50 (Win32, build 3778)
|
Lines: | 40
|
Date: | Wed, 15 Sep 2004 02:05:20 GMT
|
NNTP-Posting-Host: | 24.95.40.189
|
X-Complaints-To: | abuse AT rr DOT com
|
X-Trace: | fe2.columbus.rr.com 1095213920 24.95.40.189 (Tue, 14 Sep 2004 22:05:20 EDT)
|
NNTP-Posting-Date: | Tue, 14 Sep 2004 22:05:20 EDT
|
Organization: | Road Runner High Speed Online http://www.rr.com
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
I have come accross a very baffling problem.
My main() function calls a function cust_information(), which in turn,
may call function add_customer():
int add_customer()
{
string strSQL;
sqlite *db;
char **errmsg;
db=sqlite_open(DBFILENAME, 0, NULL);
strSQL = "INSERT INTO customer VALUES (";
strSQL+= "\"" + C.phone + "\", ";
strSQL+= "\"" + C.name + "\", ";
strSQL+= "\"" + C.address + "\", ";
strSQL+= "\"" + C.comment + "\");";
-> sqlite_exec(db,strSQL.c_str(),NULL,NULL,errmsg);
sqlite_close(db);
return(0);
}
Where C is a global object with a couple public functions, and DBFILENAME
is #DEFINEd.
The problem is in the sqlite_exec line. I call this function in many
other places,
doing very similar things, and I get no problems. I get a seg fault when
this function
is called. I've ran gdb on it, and found that it actually seg faults
right after the return(0) line of cust_information(). When commenting out
the sqlite_exec
line, I get no seg fault, but obviously that's not what I want. There's
no error message
from sqlite_exec, and it appears to actually add the information to the
database file.
I'm completely baffled. Does anyone have an idea what might cause this?
Thanks,
Matt
- Raw text -