Home » U++ Library support » U++ SQL » Some questions around SQlite3
Some questions around SQlite3 [message #28430] |
Wed, 01 September 2010 20:08 |
mubeta
Messages: 77 Registered: October 2006
|
Member |
|
|
Hi guys,
Some question around SQlite3:
1) I am using a thirdy part database, and I want to inser new values in the table. Now I am using this way:
...
Sqlite3Session db1;
if(!db1.Open(fName))
{
//statements
return;
}
SQL = db1;
Sql sql;
//Statements
sql*Insert("Project")("Id", i)("DbNum", daveDbNum)("Start", daveStart)("Length", daveLen)("Buff", daveMem1.strValues);
//Statements
db1.Close();
Questions:
1.1) How thw object named "sql" is linked to the object named "db1" ?? I reach this source code following some u++ reference code, but I don't understand how db1 and sql are connectd. The application is working correctly.
1.2) I saw that using SQL.Execute(), can send the queries as I most like; but, in the same source code, how I can send an String of binary values ? Example:
Sqlite3Session db1;
db1.Open(fName);
SQL = db1;
SQL.Execute("INSERT INTO table (field1, field2) VALUES ('1', + String(foo) + "')");
where "foo" are binary values. Sometime this way result in an error, because in the string it's included the char('). Ther eis some encoder/decoder for solve this problem?
2) When using SELECT statement in the query, next using Fetch(), I can get the fileds values, but only indexable with number:
Sqlite3Session db1;
db1.Open(fName);
SQL = db1;
Sql sql;
sql.Execute("SELECT * FROM table");
while(sql.Fetch()) PromptOK(sql[5]); // Working correctly
while(sql.Fetch()) PromptOK(sql(SqlId("Name"))); // Does not work ??
Question: How I can get the index of the fields, from the field name? When I am using a thirdy part database, I don't know the index of the fields!
Thanks a lot.
|
|
|
Goto Forum:
Current Time: Sat Apr 27 19:25:37 CEST 2024
Total time taken to generate the page: 2.08018 seconds
|