[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sqlite-users
Subject:    [sqlite] sqlite3_bind_text problem
From:       "Matthew Allen" <fret () memecode ! com>
Date:       2008-11-14 8:22:52
Message-ID: J94QP.9100XYH () memecode ! com
[Download RAW message or body]

I have a table with the following fields:

	{"Id",			"INTEGER PRIMARY KEY AUTOINCREMENT"},
	{"ParentId",		"INTEGER"},
	{"Name",		"TEXT"},
	{"Unread",		"INTEGER"},
	{"Open",		"INTEGER"},
	{"ItemType",	"INTEGER"},
	{"Sort",		"INTEGER"},
	{"Threaded",	"INTEGER"},

And I prepare a statement using the SQL:

	insert into MyTable values (?,?,?,?,?,?,?,?)

Then a bind the values to that statement and write it to the DB. That all works \
except for the TEXT field "Name". I'm calling sqlite3_bind_text like this:

	char *Name = "Something";	
	sqlite3_bind_text(Stmt, 3, (const char*)Name, -1, SQLITE_STATIC);

And it return SQLITE_OK, however the value in the DB is NULL, or an empty string. \
Certainly not the "Something" I pass in. All the integer fields are written \
successfully so I know it's mostly working. The string is valid utf-8, null \
terminated C-string.

What am I missing here?
--
Matthew Allen

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic