Grassroots Infrastructure
The Grassroots Infrastructure is a suite of computing tools to help users and developers use scientific data infrastructure that can easily be interconnected.
sql_clause.h
Go to the documentation of this file.
1 /*
2  * sql_clause.h
3  *
4  * Created on: 11 Dec 2017
5  * Author: billy
6  */
7 
8 #ifndef CORE_SERVER_SQLITE_INCLUDE_SQL_CLAUSE_H_
9 #define CORE_SERVER_SQLITE_INCLUDE_SQL_CLAUSE_H_
10 
11 #include "sqlite_library.h"
12 
13 #include "linked_list.h"
14 #include "byte_buffer.h"
15 
30 typedef struct SQLClause
31 {
33  char *sqlc_key_s;
34 
36  char *sqlc_op_s;
37 
39  char *sqlc_value_s;
40 } SQLClause;
41 
42 
46 typedef struct SQLClauseNode
47 {
50 
54  const char *sqlcn_op_s;
55 
58 
60 
61 
62 
63 #ifdef __cplusplus
64 extern "C"
65 {
66 #endif
67 
68 
69 
79 GRASSROOTS_SQLITE_API SQLClause *AllocateSQLClause (const char *key_s, const char *op_s, const char *value_s);
80 
81 
89 
90 
101 GRASSROOTS_SQLITE_API SQLClauseNode *AllocateSQLClauseNode (const char *key_s, const char *comp_s, const char *value_s, const char *op_s);
102 
103 
112 
113 
124 GRASSROOTS_SQLITE_API bool AddSQLClauseToByteBuffer (const SQLClause *clause_p, ByteBuffer *buffer_p);
125 
126 
138 
139 
140 #ifdef __cplusplus
141 }
142 #endif
143 
144 
145 #endif /* CORE_SERVER_SQLITE_INCLUDE_SQL_CLAUSE_H_ */
SQLClause::FreeSQLClause
void FreeSQLClause(SQLClause *clause_p)
Free a SQLClause.
SQLClauseNode::sqlcn_clause_p
SQLClause * sqlcn_clause_p
The SQLClause.
Definition: sql_clause.h:57
SQLClause::sqlc_value_s
char * sqlc_value_s
The value to use in the query.
Definition: sql_clause.h:39
SQLClauseNode::sqlcn_node
ListItem sqlcn_node
The base ListItem.
Definition: sql_clause.h:49
SQLClause::AddSQLClauseToByteBuffer
bool AddSQLClauseToByteBuffer(const SQLClause *clause_p, ByteBuffer *buffer_p)
Add the string representing a SQLClause to a ByteBuffer to be used as a query.
SQLClauseNode::AllocateSQLClauseNode
SQLClauseNode * AllocateSQLClauseNode(const char *key_s, const char *comp_s, const char *value_s, const char *op_s)
Allocate a SQLClauseNode containing a fully initialised SQLClause.
SQLClause::sqlc_key_s
char * sqlc_key_s
The key to use.
Definition: sql_clause.h:33
GRASSROOTS_SQLITE_API
#define GRASSROOTS_SQLITE_API
Definition: sqlite_library.h:46
SQLClause
A datatype for storing a clause used to query a database.
Definition: sql_clause.h:30
SQLClause::AllocateSQLClause
SQLClause * AllocateSQLClause(const char *key_s, const char *op_s, const char *value_s)
Allocate a SQLClause.
LinkedList
A doubly-linked list that can be traversed in either direction.
Definition: linked_list.h:56
byte_buffer.h
SQLClause::sqlc_op_s
char * sqlc_op_s
The operator such as =, like, <, etc.
Definition: sql_clause.h:36
SQLClauseNode
A datatype for storing a SQLClause on a LinkedList.
Definition: sql_clause.h:46
SQLClauseNode::sqlcn_op_s
const char * sqlcn_op_s
The op for this string such as AND, OR, NOT, etc.
Definition: sql_clause.h:54
SQLClauseNode::FreeSQLClauseNode
void FreeSQLClauseNode(ListItem *node_p)
Free a SQLClauseNode.
linked_list.h
A doubly-linked list.
ByteBuffer
A datatype to allow an automatically growing buffer for appending data to.
Definition: byte_buffer.h:35
sqlite_library.h
SQLClause::AddSQLClausesToByteBuffer
bool AddSQLClausesToByteBuffer(LinkedList *clauses_p, ByteBuffer *buffer_p)
Add the strings representing each of the SQLClauses stored on a LinkedList of SQLClauseNodes to a Byt...
ListItem
A doubly-linked node that points to its predecessor and successor.
Definition: linked_list.h:43