| 1 |
/* |
| 2 |
* -------------------------------------------------------------------------- |
| 3 |
* XooNiPs Xoops modules for Neuroinformatics Platforms |
| 4 |
* Copyright (C) 2005 RIKEN, Japan. All rights reserved. |
| 5 |
* http://sourceforge.jp/projects/xoonips/ |
| 6 |
* -------------------------------------------------------------------------- |
| 7 |
* This program is free software; you can redistribute it and/or |
| 8 |
* modify it under the terms of the GNU General Public License |
| 9 |
* as published by the Free Software Foundation; either version 2 |
| 10 |
* of the License, or (at your option) any later version. |
| 11 |
* |
| 12 |
* This program is distributed in the hope that it will be useful, |
| 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
* GNU General Public License for more details. |
| 16 |
* |
| 17 |
* You should have received a copy of the GNU General Public License |
| 18 |
* along with this program; if not, write to the Free Software |
| 19 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 20 |
* -------------------------------------------------------------------------- |
| 21 |
* |
| 22 |
* SQL鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申criteria鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申 |
| 23 |
* |
| 24 |
* $Revision: 1.2 $ |
| 25 |
* $Log: criteria.h,v $ |
| 26 |
* Revision 1.2 2004/11/25 04:11:08 youi |
| 27 |
* typedef鐃緒申鐃緒申鐃緒申. |
| 28 |
* |
| 29 |
* Revision 1.1 2004/11/24 06:54:21 youi |
| 30 |
* initial version |
| 31 |
* |
| 32 |
* |
| 33 |
*/ |
| 34 |
|
| 35 |
#if !defined( CRITERIA_H ) |
| 36 |
#define CRITERIA_H |
| 37 |
typedef int order_t; |
| 38 |
|
| 39 |
class orderby{ |
| 40 |
private: |
| 41 |
orderby* next; |
| 42 |
char* column; |
| 43 |
int order; |
| 44 |
public: |
| 45 |
const static order_t ASC = 0; |
| 46 |
const static order_t DESC = 1; |
| 47 |
|
| 48 |
orderby( const char* column, int order ); |
| 49 |
~orderby( ); |
| 50 |
|
| 51 |
const char* getColumn( ) const; |
| 52 |
order_t getOrder( ) const; |
| 53 |
}; |
| 54 |
|
| 55 |
class criteria{ |
| 56 |
private: |
| 57 |
int start; //!< 鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申 |
| 58 |
int rows; //!< 鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申(0=鐃緒申鐃緒申鐃緒申) |
| 59 |
orderby** orders; //!< orders鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申 |
| 60 |
int ordersMax; //!< orders鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申 |
| 61 |
int ordersLen; //!< orders鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申 |
| 62 |
int indexOfOrders; //!< orders鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申 |
| 63 |
public: |
| 64 |
criteria( ); |
| 65 |
~criteria( ); |
| 66 |
|
| 67 |
void setLimit( int start, int rows ); |
| 68 |
void addOrderBy( orderby *order ); |
| 69 |
void clearAll( ); |
| 70 |
|
| 71 |
int getLimitStart( ) const; |
| 72 |
int getLimitRows( ) const; |
| 73 |
|
| 74 |
const orderby* headOrderBy( ); |
| 75 |
const orderby* nextOrderBy( ); |
| 76 |
}; |
| 77 |
|
| 78 |
typedef criteria criteria_t; |
| 79 |
#endif |