29 lines
894 B
C
29 lines
894 B
C
|
|
#ifndef CODEBUILDER_H
|
|||
|
|
#define CODEBUILDER_H
|
|||
|
|
|
|||
|
|
#include "Pgsql_declare.h"
|
|||
|
|
#include <QString>
|
|||
|
|
|
|||
|
|
class LanguageConfig;
|
|||
|
|
class QTextStream;
|
|||
|
|
|
|||
|
|
class CodeBuilder {
|
|||
|
|
public:
|
|||
|
|
void GenCodeForExecutingQuery(QTextStream &q, const QString &query, const Pgsql::Result &result);
|
|||
|
|
void GenReturnStructDefinition(QTextStream &q, const Pgsql::Result &result) const;
|
|||
|
|
|
|||
|
|
// Generating code for performing query and going through the result
|
|||
|
|
// - Code for executing the query
|
|||
|
|
// - Code for looping the result
|
|||
|
|
// - Code for processing a single row
|
|||
|
|
// - Declaration of struct for holding single row result
|
|||
|
|
QString columnNameToVariableName(QString column_name) const;
|
|||
|
|
QString getTypeName(Oid dbtype) const;
|
|||
|
|
private:
|
|||
|
|
std::shared_ptr<const LanguageConfig> m_configuration;
|
|||
|
|
|
|||
|
|
void genFieldDeclaration(QTextStream &q, const QString &format, const QString &column_name, Oid column_type) const;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
#endif // CODEBUILDER_H
|