You must be thinking of Java or such -- C doesn't do concatenation that way.
There is a strcat() function but that's an ugly way to do it.
Here's how I'd do it:
int language=6;
int nbytes;
char sql[65535]; // big sql buffer to store whatever we need
nbytes=snprintf(sql,sizeof(sql),"SELECT key,name,test FROM uebersetzungen WHERE
sprach_id='%d'", language);
if (nbytes >= sizeof(sql)) {
fprintf(stderr,"SQL buffer overflow!!\n");
}
How is sprach_id defined in your table? As an integer or character? It looks
to me like you're using it as an integer.
Michael D. Black
Senior Scientist
Northrop Grumman Mission Systems
________________________________
From: [email protected] on behalf of rollerueckwaerts
Sent: Fri 7/9/2010 2:06 PM
To: [email protected]
Subject: EXTERNAL:[sqlite] concat 2 const chars ?
Hello,
I try to get an sql query string from 2 const chars.
const char *language;
language = "'6'";
const char *sql2 = "SELECT key,name,text FROM uebersetzungen WHERE sprach_id
= ";
const char *sql = strcpy(sql2,language);
// or
const char *sql = "SELECT key,name,text FROM uebersetzungen WHERE sprach_id
= " + language;
//or
const char *sql = "SELECT key,name,text FROM uebersetzungen WHERE sprach_id
= " & language;
nothing works :)
How can i do this ?
Hoping for help :)
tobi
--
View this message in context:
http://old.nabble.com/concat-2-const-chars---tp29121393p29121393.html
Sent from the SQLite mailing list archive at Nabble.com.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users