Home » U++ Library support » U++ SQL » simple example sqlite ref. not working core console
simple example sqlite ref. not working core console [message #52514] |
Tue, 15 October 2019 02:47  |
|
HI all-
Am I doing something wrong with this code?
I am running the most recent nightly build. MinGW with SQLite plug-in.
I tried another type of join too. That one didn't work either. At the end, I will put in a code block the SQLite code that works.
I also added a foreign key statement in the create table for SQLite.
Is there a trick for joining SQLite tables?
Hey guys, I am having bad juju. Today, I got a virus off a mirror that I frequent for code. Wah!
I ran this on my system with nmap, and there are no open ports 
thanks,
roboloki
TABLE_(a)
INT_ (id) PRIMARY_KEY AUTO_INCREMENT
INT_ (mydate)
END_TABLE
TABLE_(b)
INT (id) PRIMARY_KEY AUTO_INCREMENT
INT_ (fk_A) REFERENCES (a)
STRING_ (mytext, 35)
END_TABLE
#include <Core/Core.h>
#include <plugin/sqlite3/Sqlite3.h>
using namespace Upp;
#define SCHEMADIALECT <plugin/sqlite3/Sqlite3Schema.h>
#define MODEL <sqliteTest/ailien.sch>
#include "Sql/sch_header.h"
CONSOLE_APP_MAIN
{
Sqlite3Session sqlite3;
if(!sqlite3.Open(ConfigFile("ailien.db3"))) {
Cout() << "Can't create or open database file\n";
return;
}
#ifdef _DEBUG
sqlite3.SetTrace();
#endif
SqlId a("a"), b("b"), fk_A("fk_A"), mydate("mydate"), id("id"), mytext("mytext");
Sql sql(sqlite3);
Select(id.Of(a), mytext.Of(b))
.From(a)
.InnerJoin(b)
.On(id.Of(a) == fk_A.Of(b))
.Where(id.Of(a) == 2);
while(sql.Fetch())
Cout() << sql[0] << ' ' << sql[1] <<'\n' ;
//Error: Schema join not found ,a, b (if I used a reference join syntax instead of plain old join)
}
select a.id, b.mytext from a join b
where a.id ==2;
|
|
|
Goto Forum:
Current Time: Sat Apr 26 16:13:57 CEST 2025
Total time taken to generate the page: 0.01188 seconds
|