Develop and Download Open Source Software

Browse CVS Repository

Annotation of /xoonips/AL/criteria.cc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (hide annotations) (download) (as text)
Sat Nov 27 00:39:57 2004 UTC (19 years, 4 months ago) by youi
Branch: MAIN
Changes since 1.1: +6 -2 lines
File MIME type: text/x-c++src
orderbyのコンストラクタ内にcolumnメンバ変数の初期化処理を追加.

1 youi 1.1 /*
2     * SQL絎?茵?腟???????我??絎?鐚?筝??号?帥???>散??膊∞??????criteria?????鴻???臂?/span>
3     *
4 youi 1.2 * $Revision: 1.1 $
5     * $Log: criteria.cc,v $
6     * Revision 1.1 2004/11/24 06:54:31 youi
7     * initial version
8     *
9 youi 1.1 *
10     */
11     #include <stdlib.h>
12     #include <string.h>
13    
14     #include "common.h"
15     #include "criteria.h"
16    
17     /**
18     * SQL??RDERBY??┃絎???荐??吟??????????/span>
19     *
20     * @param column ????????
21     * @param order ????鐚?????????絎?(????絎??? orderby::ASC)
22     * @ref orderby::ASC
23     * @ref orderby::DESC
24     *
25     */
26     orderby::orderby( const char* column = "", int order = orderby::ASC ){
27 youi 1.2 this -> column = 0;
28 youi 1.1 setValue( &this -> column, column );
29     this -> order = order;
30     this -> next = 0;
31     }
32    
33     /**
34     *
35     * ???鴻????????/span>
36     *
37     * ???????????<?≪???????????障????
38     *
39     */
40     orderby::~orderby( ){
41     delete this -> column;
42     }
43    
44     /**
45     *
46     * ??????????菴???
47     * @return ????????
48     *
49     */
50     const char* orderby::getColumn( ) const { return column; }
51    
52     /**
53     *
54     * ????鐚??障??????????菴???
55     * @return ????鐚??障????????
56     * @ref orderby::ASC
57     * @ref orderby::DESC
58     *
59     */
60     order_t orderby::getOrder( ) const{ return order; }
61    
62     /**
63     *
64     * SQL????我??絎?(LIMIT)??鐚??純?若????(??????????????????)??膊∞??????????/span>
65     * ??
66     *
67     */
68     criteria::criteria( )
69     {
70     start = 0;
71     rows = 0;
72     indexOfOrders = 0;
73     ordersLen = 0;
74     ordersMax = 16;
75     orders = new orderby*[ ordersMax ];
76     memset( orders, 0, sizeof( orderby* ) * ordersMax );
77     }
78    
79     /**
80     *
81     * ???鴻????????/span>
82     *
83     * addOrderBy?ц申??????orderby?ゃ?潟?鴻?帥?潟?鴻??В?障??茵?????
84     *
85     * @ref addOrderBy
86     *
87     */
88     criteria::~criteria( )
89     {
90     if( orders != 0 ){
91     for( int i = 0; i < ordersLen; i++ ) delete orders[ i ];
92     delete[] orders;
93     }
94     }
95    
96     /**
97     *
98     * SQL絎?茵?腟??????????阪??????膀??蚊??鐚???紮?茵?????違?ф??絎?????.
99     *
100     * @param start ??紮?茵?
101     * @param rows 茵???/span>
102     *
103     */
104     void criteria::setLimit( int start , int rows )
105     {
106     this -> start = start;
107     this -> rows = rows;
108     }
109    
110     /**
111     *
112     * ???????????>散??菴遵??????鐚?QL絎?茵???????????申???????????????????純??/span>
113     * ???>散??????鐚?/span>
114     *
115     * @param order orderby???≪??????/span>
116     *
117     */
118     void criteria::addOrderBy( orderby *order )
119     {
120     if( ordersMax == ordersLen ){
121     //orders?????c?宴???障?с???若?帥?????????э??≦宍????
122     orderby** ptr = new orderby*[ ordersMax * 2 ];
123     memset( ptr, 0, sizeof( orderby* ) * ordersMax * 2 );
124     memcpy( ptr, orders, sizeof( orderby* ) * ordersMax );
125     delete[] orders;
126     ordersMax *= 2;
127     orders = ptr;
128     }
129     orders[ ordersLen ] = order;
130     ordersLen++;
131     }
132    
133     /**
134     *
135     * ??????rderby???????冴??. 2????札????rderby??extOrderBy?у????冴??.<br>
136     * ?祉?????∽?違???鴻???????????????絎???unsafe)?с??
137     *
138     * @return ??????rderby
139     * @return 0 ????篁ヤ???rderby??????
140     * @ref nextOrderBy
141     *
142     */
143     const orderby* criteria::headOrderBy( )
144     {
145     indexOfOrders = 0;
146     if( indexOfOrders >= ordersLen ) return 0;
147     return orders[ indexOfOrders++ ];
148     }
149    
150     /**
151     *
152     * orderby???????冴??.<br>
153     * ?祉?????∽?違???鴻???????????????絎???unsafe)?с??
154     *
155     * @return orderby???ゃ?潟?鴻?帥?潟??/span>
156     * @return 0 ????篁ヤ???rderby??????
157     * @ref headNextOrderBy
158     *
159     */
160     const orderby* criteria::nextOrderBy( )
161     {
162     if( indexOfOrders >= ordersLen ) return 0;
163     return orders[ indexOfOrders++ ];
164     }
165    
166     /**
167     *
168     * LIMIT荐??鐚???????RDERBY荐???????ゃ???障??.
169     *
170     */
171     void criteria::clearAll( )
172     {
173     memset( orders, 0, sizeof( orderby* ) * ordersMax );
174     ordersLen = 0;
175     start = rows = 0;
176     }
177    
178     /**
179     *
180     * LIMIT????紮?茵?
181     *
182     * @return
183     *
184     */
185     int criteria::getLimitStart( ) const { return start; }
186    
187     /**
188     *
189     * LIMIT?????/span>
190     *
191     * @return
192     *
193     */
194     int criteria::getLimitRows( ) const{ return rows; }

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26