4 #include <samchon/library/TSQLi.hpp> 20 shared_ptr<SQLi> sqli(
new TSQLi());
24 sqli->connect(
"211.239.161.211",
"REDPRINTING_TEST",
"redprinting_test",
"redprinting");
26 auto stmt = sqli->createStatement();
28 wstring name = L
"고길동";
29 wstring department = L
"홍보부 ;
stmt->prepare(L"INSERT INTO 한글테이블 (번호, 이름, 부서) VALUES (?, ?, ?)", uid, name, department);
stmt->execute();
stmt->executeDirectly(u8"SELECT * FROM 한글테이블");
while (stmt->fetch())
{
int uid = stmt->at<int>(0);
const string &name = stmt->at<string>(1);
const string &department = stmt->at<string>(2);
cout << uid << endl;
cout << name << endl;
cout << department << endl;
}
}
catch (exception &e)
{
cout << e.what() << endl;
}
};
}
}
}";
31 stmt->prepare(L
"INSERT INTO 한글테이블 (번호, 이름, 부서) VALUES (?, ?, ?)", uid, name, department);
34 stmt->executeDirectly(u8
"SELECT * FROM 한글테이블 );
while (stmt->fetch())
{
int uid = stmt->at<int>(0);
const string &name = stmt->at<string>(1);
const string &department = stmt->at<string>(2);
cout << uid << endl;
cout << name << endl;
cout << department << endl;
}
}
catch (exception &e)
{
cout << e.what() << endl;
}
};
}
}
}");
38 int uid = stmt->at<
int>(0);
39 const string &name = stmt->at<
string>(1);
40 const string &department = stmt->at<
string>(2);
44 cout << department << endl;
49 cout << e.what() << endl;
A SQL interface for T-SQL.