Work on mysql and sql.
This commit is contained in:
1 parent
2e715a4d08
commit
387203f4b3
7 files changed
+42
-16
No files matched your search
+13
-7
@@ -5,16 +5,15 @@
|
||||
namespace jet {
|
||||
|
||||
__mysql::__mysql(coreutils::ZString &in, coreutils::MString &parent, Global &global) : Tag(in, parent, global) {
|
||||
processContainer(container);
|
||||
|
||||
|
||||
if(!variableDefined("host"))
|
||||
coreutils::Exception("host must be specified for mysql tag.");
|
||||
throw coreutils::Exception("host must be specified for mysql tag.");
|
||||
if(!variableDefined("database"))
|
||||
coreutils::Exception("database must be specified for mysql tag.");
|
||||
throw coreutils::Exception("database must be specified for mysql tag.");
|
||||
if(!variableDefined("user"))
|
||||
coreutils::Exception("user must be specified for mysql tag.");
|
||||
throw coreutils::Exception("user must be specified for mysql tag.");
|
||||
if(!variableDefined("password"))
|
||||
coreutils::Exception("password must be specified for mysql tag.");
|
||||
throw coreutils::Exception("password must be specified for mysql tag.");
|
||||
|
||||
sessionId = variables["sessionid"];
|
||||
|
||||
@@ -22,6 +21,10 @@ namespace jet {
|
||||
|
||||
mysql = mysql_init(NULL);
|
||||
mysql = mysql_real_connect(mysql, variables["host"].c_str(), variables["user"].c_str(), variables["password"].c_str(), variables["database"].c_str(), 0, NULL, 0);
|
||||
|
||||
std::cout << "mysql: " << mysql << std::endl;
|
||||
|
||||
processContainer(container);
|
||||
|
||||
}
|
||||
|
||||
@@ -32,8 +35,11 @@ namespace jet {
|
||||
}
|
||||
|
||||
void __mysql::query(coreutils::MString query) {
|
||||
mysql_real_query(mysql, query.getData(), query.getLength());
|
||||
std::cout << "q: " << query << std::endl;
|
||||
int rc = mysql_real_query(mysql, query.getData(), query.getLength());
|
||||
std::cout << "rc: " << rc << std::endl;
|
||||
result = mysql_store_result(mysql);
|
||||
std::cout << "result: " << result << std::endl;
|
||||
if(result) {
|
||||
row = mysql_fetch_row(result);
|
||||
fieldLength = mysql_fetch_lengths(result);
|
||||
|
||||
Reference in new issue
Block a user