// The constructed where clause below has a sub-query within it "SELECT MIN(NAME) FROM %s"
// to achieve a single row (in this case the first name in alphabetical order).
- Contact->whereStr.Printf("NAME = (SELECT MIN(NAME) FROM %s)",Contact->tableName);
+ // commented out because PostgreSQL can't do this
+ //Contact->whereStr.Printf("NAME = (SELECT MIN(NAME) FROM %s)",Contact->tableName);
// NOTE: (const char*) returns a pointer which may not be valid later, so this is short term use only
Contact->where = (char*) (const char*) Contact->whereStr;
}
}
+ // commented out because PostgreSQL can't do this
+
// Previous record not available, retrieve first record in table
- Contact->whereStr = "NAME = (SELECT MIN(NAME) FROM ";
- Contact->whereStr += Contact->tableName;
- Contact->whereStr += ")";
+ //Contact->whereStr = "NAME = (SELECT MIN(NAME) FROM ";
+ //Contact->whereStr += Contact->tableName;
+ //Contact->whereStr += ")";
+
Contact->where = (char*) (const char*) Contact->whereStr;
if (!Contact->Query())
{
// display it, if the query string has changed.
if (strcmp(qryWhere, (const char*) Contact->qryWhereStr))
{
- Contact->orderBy = "NAME";
- Contact->whereStr = "NAME = (SELECT MIN(NAME) FROM ";
- Contact->whereStr += CONTACT_TABLE_NAME;
+
+ // commented out because PostgreSQL can't do this
+ Contact->whereStr = "";
+ //Contact->orderBy = "NAME";
+ //Contact->whereStr = "NAME = (SELECT MIN(NAME) FROM ";
+ //Contact->whereStr += CONTACT_TABLE_NAME;
// Append the query where string (if there is one)
Contact->qryWhereStr = qryWhere;
Contact->whereStr += Contact->qryWhereStr;
}
// Close the expression with a right paren
- Contact->whereStr += ")";
+ // Contact->whereStr += ")";
// Requery the table
Contact->where = (char*) (const char*) Contact->whereStr;
if (!Contact->Query())
// Query the first record in the table
Contact->orderBy = "NAME";
- Contact->whereStr = "NAME = (SELECT MIN(NAME) FROM ";
- Contact->whereStr += CONTACT_TABLE_NAME;
- Contact->whereStr += ")";
+ // commented out because PostgreSQL can't do this
+ //Contact->whereStr = "NAME = (SELECT MIN(NAME) FROM ";
+ //Contact->whereStr += CONTACT_TABLE_NAME;
+ //Contact->whereStr += ")";
Contact->where = (char*) (const char*) Contact->whereStr;
if (!Contact->Query())
{
wxString w;
-
- w = "NAME = (SELECT MIN(NAME) FROM ";
- w += Contact->tableName;
- w += " WHERE NAME > '";
+ // commented out because PostgreSQL can't do this
+ //w = "NAME = (SELECT MIN(NAME) FROM ";
+ //w += Contact->tableName;
+ // w += " WHERE NAME > '";
+ w = "(NAME > '";
w += Contact->Name;
w += "'";
{
wxString w;
- w = "NAME = (SELECT MAX(NAME) FROM ";
- w += Contact->tableName;
- w += " WHERE NAME < '";
+ // commented out because PostgreSQL can't do this
+ //w = "NAME = (SELECT MAX(NAME) FROM ";
+ //w += Contact->tableName;
+ //w += " WHERE NAME < '";
+ w = "(NAME < '";
w += Contact->Name;
w += "'";