Skip to content

Commit

Permalink
This is a minor feature request...
Browse files Browse the repository at this point in the history
  • Loading branch information
Petr Chmelar committed Feb 21, 2012
1 parent 2a74da0 commit bf7b8bc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<type>org.netbeans.modules.cnd.makeproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/make-project/1">
<name>vtcli</name>
<name>vtcli.v1</name>
<make-project-type>0</make-project-type>
<c-extensions/>
<cpp-extensions>cpp</cpp-extensions>
Expand Down
2 changes: 1 addition & 1 deletion src/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<type>org.netbeans.modules.cnd.makeproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/make-project/1">
<name>vtapi</name>
<name>vtapi.v1</name>
<make-project-type>0</make-project-type>
<c-extensions/>
<cpp-extensions>cpp</cpp-extensions>
Expand Down
17 changes: 14 additions & 3 deletions src/query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ bool Query::execute() {
logger->debug(toString(PQcmdTuples(res)) + " row(s) (not)affected");
}
else {
warning(2011, "You should never see this warning since 2011 :(");
warning(2011, "This is a very strange warning you should never see :(");
}
}
}
Expand Down Expand Up @@ -185,7 +185,11 @@ bool Query::whereString(const String& key, const String& value, const String& op
// FIXME: buffer overflow!! use params!
if (value.compare("NULL") == 0) {
where += "IS NULL";
} else {
}
else if (value.compare("NOT NULL") == 0) {
where += "IS NOT NULL";
}
else {
where += oper + " " + String(PQescapeLiteral(connector->conn, value.c_str(), value.length()));
}

Expand Down Expand Up @@ -238,7 +242,14 @@ bool Select::from(const String& table, const String& column) {

// FIXME: vyuzit params (zauvozovkovat nazvy tabulek a datasetu???)
String Select::getQuery() {
if (fromList.empty()) return queryString; // in case of a direct query
if (fromList.empty()) {
if (!queryString.empty()) return queryString; // in case of a direct query
// else add * from this->table
else if (!table.empty()) {
this->from(table, "*");
}
else warning(2012, "No table specified - don't know how to make a query.");
}

queryString = "SELECT ";
String tmpStr = "";
Expand Down

0 comments on commit bf7b8bc

Please sign in to comment.