PixelLightAPI  .
DatabaseQueryResult.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: DatabaseQueryResult.h                          *
00003  *
00004  *  Copyright (C) 2002-2011 The PixelLight Team (http://www.pixellight.org/)
00005  *
00006  *  This file is part of PixelLight.
00007  *
00008  *  PixelLight is free software: you can redistribute it and/or modify
00009  *  it under the terms of the GNU Lesser General Public License as published by
00010  *  the Free Software Foundation, either version 3 of the License, or
00011  *  (at your option) any later version.
00012  *
00013  *  PixelLight is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016  *  GNU Lesser General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU Lesser General Public License
00019  *  along with PixelLight. If not, see <http://www.gnu.org/licenses/>.
00020 \*********************************************************/
00021 
00022 
00023 #ifndef __PLDATABASE_DATABASEQUERYRESULT_H__
00024 #define __PLDATABASE_DATABASEQUERYRESULT_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include <PLCore/String/String.h>
00032 #include <PLCore/Container/Array.h>
00033 #include <PLCore/Container/HashMap.h>
00034 #include "PLDatabase/PLDatabase.h"
00035 
00036 
00037 //[-------------------------------------------------------]
00038 //[ Namespace                                             ]
00039 //[-------------------------------------------------------]
00040 namespace PLDatabase {
00041 
00042 
00043 //[-------------------------------------------------------]
00044 //[ Forward declarations                                  ]
00045 //[-------------------------------------------------------]
00046 class DatabaseQuery;
00047 
00048 
00049 //[-------------------------------------------------------]
00050 //[ Classes                                               ]
00051 //[-------------------------------------------------------]
00052 /**
00053 *  @brief
00054 *    Abstract database query result base class
00055 */
00056 class DatabaseQueryResult {
00057 
00058 
00059     //[-------------------------------------------------------]
00060     //[ Public functions                                      ]
00061     //[-------------------------------------------------------]
00062     public:
00063         /**
00064         *  @brief
00065         *    Destructor
00066         */
00067         PLDATABASE_API virtual ~DatabaseQueryResult();
00068 
00069         /**
00070         *  @brief
00071         *    Returns the database query this data base query result is in
00072         *
00073         *  @return
00074         *    The database query this data base query result is in
00075         */
00076         PLDATABASE_API DatabaseQuery &GetQuery() const;
00077 
00078 
00079     //[-------------------------------------------------------]
00080     //[ Public virtual DatabaseQueryResult functions          ]
00081     //[-------------------------------------------------------]
00082     public:
00083         /**
00084         *  @brief
00085         *    Returns whether all query results are processed or not
00086         *
00087         *  @return
00088         *    'true' if all query results are processed, else 'false'
00089         */
00090         virtual bool IsEmpty() const = 0;
00091 
00092         /**
00093         *  @brief
00094         *    Resets the query result to the first row
00095         */
00096         virtual void FirstRow() = 0;
00097 
00098         /**
00099         *  @brief
00100         *    Fetches the field list
00101         *
00102         *  @return
00103         *    Reference to the current field list
00104         */
00105         virtual const PLCore::Array<PLCore::String> &FetchFieldList() = 0;
00106 
00107         /**
00108         *  @brief
00109         *    Fetches current row from cursor and moves forward
00110         *
00111         *  @return
00112         *    Pointer to the current row map, a null pointer on error (do NOT delete this!)
00113         */
00114         virtual const PLCore::HashMap<PLCore::String, PLCore::String> *FetchRow() = 0;
00115 
00116 
00117     //[-------------------------------------------------------]
00118     //[ Protected functions                                   ]
00119     //[-------------------------------------------------------]
00120     protected:
00121         /**
00122         *  @brief
00123         *    Constructor
00124         *
00125         *  @param[in] cParentQuery
00126         *    Database query this database query result is in
00127         */
00128         PLDATABASE_API DatabaseQueryResult(DatabaseQuery &cParentQuery);
00129 
00130 
00131     //[-------------------------------------------------------]
00132     //[ Protected data                                        ]
00133     //[-------------------------------------------------------]
00134     protected:
00135         PLCore::Array<PLCore::String>                   m_lstFields;    /**< List of fields */
00136         PLCore::HashMap<PLCore::String, PLCore::String> m_mapRow;       /**< Row map */
00137 
00138 
00139     //[-------------------------------------------------------]
00140     //[ Private functions                                     ]
00141     //[-------------------------------------------------------]
00142     private:
00143         /**
00144         *  @brief
00145         *    Copy constructor
00146         *
00147         *  @param[in] cSource
00148         *    Source to copy from
00149         */
00150         DatabaseQueryResult(const DatabaseQueryResult &cSource);
00151 
00152         /**
00153         *  @brief
00154         *    Copy operator
00155         *
00156         *  @param[in] cSource
00157         *    Source to copy from
00158         *
00159         *  @return
00160         *    Reference to this instance
00161         */
00162         DatabaseQueryResult &operator =(const DatabaseQueryResult &cSource);
00163 
00164 
00165     //[-------------------------------------------------------]
00166     //[ Private data                                          ]
00167     //[-------------------------------------------------------]
00168     private:
00169         DatabaseQuery *m_pParentQuery;  /**< Database query this database query result is in (always valid!) */
00170 
00171 
00172 };
00173 
00174 
00175 //[-------------------------------------------------------]
00176 //[ Namespace                                             ]
00177 //[-------------------------------------------------------]
00178 } // PLDatabase
00179 
00180 
00181 #endif // __PLDATABASE_DATABASEQUERYRESULT_H__


PixelLight PixelLight 0.9.10-R1
Copyright (C) 2002-2011 by The PixelLight Team
Last modified Fri Dec 23 2011 15:50:52
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported