Source: query.h


Annotated List
Files
Globals
Hierarchy
Index
#ifndef QUERY_H
#define QUERY_H

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif


#include <qstring.h>
#include <qstringlist.h>

#include "dataobject.h"

namespace KDB {

class Recordset;

/***
 * representation of a stored query. trough this object we access the fields and
 * parameters of the query, if any.
 */

class Query :public DataObject{

    Q_OBJECT

public:

    Query( const char * name );
    virtual ~Query();

    /**
     * append a new field to the output list of the query
     * it works only in design mode 
     */
    virtual void addField(const QString &table, const QString &name) = 0;

    /**
     * add a table to the existing output list of tables
     */
    virtual void addTable(const QString &name) = 0;

    /**
     * add a condition (where clause) to the query
     */
    virtual void addCondition(const QString &condition) = 0;

    /**
     * return the SQL code associated to the query.
     * if the query is in design mode, it will build with the actual
     * tables, fields and conditions
     */
    virtual QString SQL() = 0;

    /**
     * creates a recordset based on this query.
     */
    virtual Recordset * openRecordset() = 0;

    /**
     * returns true if the query is in design mode
     */
    virtual bool isDesign() = 0;
     
protected:

    QString m_SQL;

    QStringList m_fields;
    QStringList m_tables;
    QStringList m_conditions;

};

}

#endif

Generated by: pradu@server.rete.casa on Fri Jul 28 15:15:55 2000, using kdoc 2.0a36.