File indexing completed on 2024-05-12 16:39:38

0001 /* This file is part of the KDE project
0002    Copyright (C) 2004 Lucijan Busch <lucijan@kde.org>
0003 
0004    This library is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU Library General Public
0006    License as published by the Free Software Foundation; either
0007    version 2 of the License, or (at your option) any later version.
0008 
0009    This library is distributed in the hope that it will be useful,
0010    but WITHOUT ANY WARRANTY; without even the implied warranty of
0011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012    Library General Public License for more details.
0013 
0014    You should have received a copy of the GNU Library General Public License
0015    along with this library; see the file COPYING.LIB.  If not, write to
0016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  * Boston, MA 02110-1301, USA.
0018 */
0019 
0020 #ifndef KEXIPARTDATASOURCE_H
0021 #define KEXIPARTDATASOURCE_H
0022 
0023 class KexiProject;
0024 class KDbFieldList;
0025 class KDbCursor;
0026 
0027 namespace KexiPart
0028 {
0029 class DataSourcePrivate;
0030 class Item;
0031 class Part;
0032 
0033 /**
0034  * this class provides a datasource framework for e.g. tables and queries
0035  * using this framework one can query for
0036  *  - a list of datasources
0037  *  - the fileds in datasources
0038  *  - variables (e.g. query variables)
0039  */
0040 class KEXICORE_EXPORT DataSource
0041 {
0042 public:
0043     explicit DataSource(Part *part);
0044     virtual ~DataSource();
0045 
0046     /**
0047      * @returns a list of fileds for the datasource
0048      * @arg id is the document id for the source
0049      */
0050     virtual KDbFieldList *fields(KexiProject *project, const KexiPart::Item &item) = 0;
0051 
0052     /**
0053      * @returns the cursor
0054      */
0055     virtual KDbCursor *cursor(KexiProject *project, const KexiPart::Item &item, bool buffer) = 0;
0056 
0057     /**
0058      * @returns the part providing this datasource
0059      */
0060     Part *part() const;
0061 
0062 private:
0063     DataSourcePrivate * const d;
0064 };
0065 
0066 }
0067 
0068 #endif
0069