remove typedef enums and inline methods.
This commit is contained in:
parent
02b7b880ed
commit
8582c7f901
|
@ -5,7 +5,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace hsql {
|
namespace hsql {
|
||||||
typedef enum {
|
enum StatementType {
|
||||||
kStmtError, // unused
|
kStmtError, // unused
|
||||||
kStmtSelect,
|
kStmtSelect,
|
||||||
kStmtImport,
|
kStmtImport,
|
||||||
|
@ -19,7 +19,7 @@ namespace hsql {
|
||||||
kStmtExport,
|
kStmtExport,
|
||||||
kStmtRename,
|
kStmtRename,
|
||||||
kStmtAlter
|
kStmtAlter
|
||||||
} StatementType;
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base struct for every SQL statement
|
* Base struct for every SQL statement
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
#include "Table.h"
|
#include "Table.h"
|
||||||
|
|
||||||
namespace hsql {
|
namespace hsql {
|
||||||
typedef enum {
|
enum OrderType {
|
||||||
kOrderAsc,
|
kOrderAsc,
|
||||||
kOrderDesc
|
kOrderDesc
|
||||||
} OrderType;
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description of the order by clause within a select statement
|
* Description of the order by clause within a select statement
|
||||||
|
|
|
@ -11,23 +11,15 @@ namespace hsql {
|
||||||
struct JoinDefinition;
|
struct JoinDefinition;
|
||||||
struct TableRef;
|
struct TableRef;
|
||||||
|
|
||||||
|
// Possible table reference types.
|
||||||
/**
|
enum TableRefType {
|
||||||
* @enum TableRefType
|
|
||||||
* Types table references
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
kTableName,
|
kTableName,
|
||||||
kTableSelect,
|
kTableSelect,
|
||||||
kTableJoin,
|
kTableJoin,
|
||||||
kTableCrossProduct
|
kTableCrossProduct
|
||||||
} TableRefType;
|
};
|
||||||
|
|
||||||
|
// Holds reference to tables. Can be either table names or a select statement.
|
||||||
/**
|
|
||||||
* @struct TableRef
|
|
||||||
* @brief Holds reference to tables. Can be either table names or a select statement.
|
|
||||||
*/
|
|
||||||
struct TableRef {
|
struct TableRef {
|
||||||
TableRef(TableRefType type);
|
TableRef(TableRefType type);
|
||||||
virtual ~TableRef();
|
virtual ~TableRef();
|
||||||
|
@ -42,37 +34,22 @@ namespace hsql {
|
||||||
std::vector<TableRef*>* list;
|
std::vector<TableRef*>* list;
|
||||||
JoinDefinition* join;
|
JoinDefinition* join;
|
||||||
|
|
||||||
|
// Returns true if a schema is set.
|
||||||
|
bool hasSchema();
|
||||||
|
|
||||||
/**
|
// Returns the alias, if it is set. Otherwise the name.
|
||||||
* Convenience accessor methods
|
char* getName();
|
||||||
*/
|
|
||||||
inline bool hasSchema() {
|
|
||||||
return schema != NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline char* getName() {
|
|
||||||
if (alias != NULL) return alias;
|
|
||||||
else return name;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Possible types of joins.
|
||||||
/**
|
enum JoinType {
|
||||||
* @enum JoinType
|
|
||||||
* Types of joins
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
kJoinInner,
|
kJoinInner,
|
||||||
kJoinOuter,
|
kJoinOuter,
|
||||||
kJoinLeft,
|
kJoinLeft,
|
||||||
kJoinRight,
|
kJoinRight,
|
||||||
} JoinType;
|
};
|
||||||
|
|
||||||
|
// Definition of a join construct.
|
||||||
/**
|
|
||||||
* @struct JoinDefinition
|
|
||||||
* @brief Definition of a join table
|
|
||||||
*/
|
|
||||||
struct JoinDefinition {
|
struct JoinDefinition {
|
||||||
JoinDefinition();
|
JoinDefinition();
|
||||||
virtual ~JoinDefinition();
|
virtual ~JoinDefinition();
|
||||||
|
@ -84,7 +61,5 @@ namespace hsql {
|
||||||
JoinType type;
|
JoinType type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace hsql
|
} // namespace hsql
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -180,9 +180,6 @@ namespace hsql {
|
||||||
delete where;
|
delete where;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TableRef
|
// TableRef
|
||||||
TableRef::TableRef(TableRefType type) :
|
TableRef::TableRef(TableRefType type) :
|
||||||
type(type),
|
type(type),
|
||||||
|
@ -200,6 +197,15 @@ namespace hsql {
|
||||||
delete list;
|
delete list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TableRef::hasSchema() {
|
||||||
|
return schema != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
char* TableRef::getName() {
|
||||||
|
if (alias != NULL) return alias;
|
||||||
|
else return name;
|
||||||
|
}
|
||||||
|
|
||||||
// JoinDefinition
|
// JoinDefinition
|
||||||
JoinDefinition::JoinDefinition() :
|
JoinDefinition::JoinDefinition() :
|
||||||
left(NULL),
|
left(NULL),
|
||||||
|
@ -213,6 +219,4 @@ namespace hsql {
|
||||||
delete condition;
|
delete condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace hsql
|
} // namespace hsql
|
Loading…
Reference in New Issue