Develop and Download Open Source Software

Browse CVS Repository

Annotation of /xoonips/AL/commonal.cc

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


Revision 1.2 - (hide annotations) (download) (as text)
Thu Nov 25 08:55:19 2004 UTC (19 years, 4 months ago) by youi
Branch: MAIN
Changes since 1.1: +44 -31 lines
File MIME type: text/x-c++src
引数の型を修正.
freeResultを追加.

1 youi 1.1 /*
2     *
3 youi 1.2 * $Revision: 1.1 $
4     * $Log: commonal.cc,v $
5     * Revision 1.1 2004/11/25 05:14:58 youi
6     * initial version
7     *
8 youi 1.1 *
9     */
10    
11     #include <stdio.h>
12     #include <string.h>
13     #include <mysql.h>
14    
15     #include "common.h"
16     #include "account.h"
17     #include "group.h"
18     #include "session.h"
19     #include "criteria.h"
20     #include "commonal.h"
21    
22     static MYSQL* mysql = NULL; //!< MySQL????潟????/span>
23    
24     /**
25     *
26     * ???若?帥???若?鴻????????
27     *
28     * @param host ???若?帥???若?鴻?????鴻????
29     * @param user ???若?帥???若?鴻???≪???祉?鴻???????若?九??
30     * @param password 筝?荐????若?吟?????鴻???若??
31     * @param dbname ???若?帥???若?鴻??????
32     * @param prefix XOOPS???若?帥???若?鴻???若??????REFIX
33     * @return result_t
34     * @refer result_t
35     */
36     result_t initializeDB( const char* host, const char* user, const char* password, const char* dbname, const char* prefix )
37     {
38     // ?≪??・膓?筝???????筝???????/span>
39     if ( mysql != NULL )
40     mysql_close( mysql );
41    
42     // ????????・膓?
43     mysql = mysql_init(NULL);
44     if ( mysql == NULL ){
45     return RES_DB_INITIALIZE_ERROR;
46     }
47     char *unix_socket = NULL; // ?
48     uint flag = 0; // ?
49     if ( NULL == mysql_real_connect( mysql, host, user, password, dbname, 3306, unix_socket, flag ) ){
50     return RES_DB_CONNECT_ERROR;
51     }
52    
53 youi 1.2 return RES_OK;
54 youi 1.1 }
55    
56    
57     /**
58     *
59     * Platform???若?倶?粋??倶????緇?
60     *
61     * @param
62     * @return
63     *
64     */
65 youi 1.2 bool isActivated( sessionid_t sid, userid_t uid )
66 youi 1.1 {
67     return false;
68     }
69    
70     /**
71     *
72     * Platform???若?倶?粋??倶??紊???/span>
73     *
74     * @param
75     * @return
76     *
77     */
78 youi 1.2 result_t activate( sessionid_t sid, userid_t uid, bool activate )
79 youi 1.1 {
80     return RES_ERROR;
81     }
82    
83     /**
84     *
85     * ?≪?????潟????/span>
86     *
87     * @param
88     * @return
89     *
90     */
91 youi 1.2 int getAccountCount( sessionid_t sid )
92 youi 1.1 {
93     return 0;
94     }
95    
96     /**
97     *
98     * ?≪?????潟??????/span>
99     *
100     * @param
101     * @return
102     *
103     */
104 youi 1.2 result_t deleteAccount( sessionid_t sid, userid_t uid )
105 youi 1.1 {
106     return RES_ERROR;
107     }
108    
109     /**
110     *
111     * ?≪?????潟?????怨??
112     *
113     * @param
114     * @return
115     *
116     */
117 youi 1.2 result_t getAccount( sessionid_t sid, userid_t uid, const account_t** )
118 youi 1.1 {
119     return RES_ERROR;
120     }
121    
122     /**
123     *
124     * ?≪?????潟?????怨??
125     *
126     * @param
127     * @return
128     *
129     */
130 youi 1.2 result_t getAccounts( sessionid_t sid, const userid_t* uids, int uidsLen, const criteria_t* cri, const account_t** accounts, int* accountsLen )
131 youi 1.1 {
132     return RES_ERROR;
133     }
134    
135     /**
136     *
137     * ?≪?????潟???脂??/span>
138     *
139     * @param
140     * @return
141     *
142     */
143 youi 1.2 result_t insertAccount( sessionid_t sid, const account_t* account )
144 youi 1.1 {
145     return RES_ERROR;
146     }
147    
148     /**
149     *
150     * ?≪?????潟??紊???/span>
151     *
152     * @param
153     * @return
154     *
155     */
156 youi 1.2 result_t updateAccount( sessionid_t sid, const account_t* account )
157 youi 1.1 {
158     return RES_ERROR;
159     }
160    
161     /**
162     *
163     * ???若??D筝?荀?/span>
164     *
165     * @param
166     * @return
167     *
168     */
169 youi 1.2 result_t dumpUids( sessionid_t sid, const criteria_t* cri, userid_t** uids, int* uidsLen )
170 youi 1.1 {
171     return RES_ERROR;
172     }
173    
174     /**
175     *
176     * ?違???若????/span>
177     *
178     * @param
179     * @return
180     *
181     */
182 youi 1.2 int getGroupCount( sessionid_t sid )
183 youi 1.1 {
184     return 0;
185     }
186    
187     /**
188     *
189     * ??絮??違???若??筝?荀у??
190     *
191     * @param
192     * @return
193     *
194     */
195 youi 1.2 result_t getGroupsByUid( sessionid_t sid, userid_t uid, const criteria_t* cri, groupid_t** gids, int* gidsLen )
196 youi 1.1 {
197     return RES_ERROR;
198     }
199    
200     /**
201     *
202     * ?違???若??膊∞??罔????????
203     *
204     * @param
205     * @return
206     *
207     */
208 youi 1.2 bool isGroupAdmin( sessionid_t sid, groupid_t gid, userid_t uid )
209 youi 1.1 {
210     return RES_ERROR;
211     }
212    
213     /**
214     *
215     * ?違???若??ID筝?荀?/span>
216     *
217     * @param
218     * @return
219     *
220     */
221 youi 1.2 result_t dumpGids( sessionid_t sid, const criteria_t* cri, groupid_t** gids, int* gidsLen )
222 youi 1.1 {
223     return RES_ERROR;
224     }
225    
226     /**
227     *
228     * ?違???若??膊∞????ID??緇?
229     *
230     * @param
231     * @return
232     *
233     */
234 youi 1.2 result_t dumpGroupAdmins( sessionid_t sid, groupid_t gid, const criteria_t* cri, userid_t** uids, int* uidsLen )
235 youi 1.1 {
236     return RES_ERROR;
237     }
238    
239     /**
240     *
241     * ?違???若????絮????若?九????/span>
242     *
243     * @param
244     * @return
245     *
246     */
247 youi 1.2 result_t deleteMember( sessionid_t sid, groupid_t gid, userid_t uid )
248 youi 1.1 {
249     return RES_ERROR;
250     }
251    
252     /**
253     *
254     * ?違???若????絮????若?区申??
255     *
256     * @param
257     * @return
258     *
259     */
260 youi 1.2 result_t insertMember( sessionid_t sid, groupid_t gid, userid_t uid )
261 youi 1.1 {
262     return RES_ERROR;
263     }
264    
265     /**
266     *
267     * ?違???若????絮????若?九??
268     *
269     * @param
270     * @return
271     *
272     */
273 youi 1.2 result_t getMembers( sessionid_t sid, groupid_t gid, const criteria_t* cri, userid_t** uids, int* uidsLen )
274 youi 1.1 {
275     return RES_ERROR;
276     }
277    
278     /**
279     *
280     * ?違???若????????/span>
281     *
282     * @param
283     * @return
284     *
285     */
286 youi 1.2 result_t deleteGroup( sessionid_t sid, groupid_t gid )
287 youi 1.1 {
288     return RES_ERROR;
289     }
290    
291     /**
292     *
293     * ?違???若?????脂??/span>
294     *
295     * @param
296     * @return
297     *
298     */
299 youi 1.2 result_t insertGroup( sessionid_t sid, const group_t* group )
300 youi 1.1 {
301     return RES_ERROR;
302     }
303    
304     /**
305     *
306     * ?違???若???????/span>
307     *
308     * @param
309     * @return
310     *
311     */
312 youi 1.2 result_t updateGroup( sessionid_t sid, const group_t* group )
313 youi 1.1 {
314     return RES_ERROR;
315     }
316    
317     /**
318     *
319     * ?違???若?????怨??
320     *
321     * @param
322     * @return
323     *
324     */
325 youi 1.2 result_t getGroup( sessionid_t sid, groupid_t gid, const group_t** group )
326 youi 1.1 {
327     return RES_ERROR;
328     }
329    
330     /**
331     *
332     * ?違???若?????怨??
333     *
334     * @param
335     * @return
336     *
337     */
338 youi 1.2 result_t getGroups( sessionid_t sid, groupid_t* gids, int gidsLen, const criteria_t* cri, const group_t** groups, int* groupsLen )
339 youi 1.1 {
340     return RES_ERROR;
341     }
342    
343     /**
344     *
345     * ?≪?????若?炊┤???????
346     *
347     * @param
348     * @return
349     *
350     */
351 youi 1.2 bool isModerator( sessionid_t sid, userid_t uid )
352 youi 1.1 {
353     return RES_ERROR;
354     }
355    
356     /**
357     *
358     * ???若??D??緇?
359     *
360     * @param
361     * @return
362     *
363     */
364 youi 1.2 result_t getUid( const char* uname, userid_t* uid )
365 youi 1.1 {
366     return RES_ERROR;
367     }
368    
369     /**
370     *
371     * ???違?ゃ?活?荐若???祉???激?с?割???
372     *
373     * @param
374     * @return
375     *
376     */
377 youi 1.2 result_t loginUser(const char* uname, const char* passwd, sessionid_t* sessions )
378 youi 1.1 {
379     return RES_ERROR;
380     }
381    
382     /**
383     *
384     * ???違?≪???????祉???激?с?括?篋?
385     *
386     * @param
387     * @return
388     *
389     */
390 youi 1.2 void logoutUser( sessionid_t sid ){}
391 youi 1.1
392     /**
393     *
394     * ?祉???激?с?潟?????.<br>
395     * XOOPS??ession???若????????蚊??????sess_id?????essionid??膈???????
396     * ?逸?session_t??篏?????????
397 youi 1.2 * ???若?帥???若?鴻???祉???激?с?潟????違?????宴??荐??蚊????
398 youi 1.1 *
399     * @param
400     * @return
401     *
402     */
403 youi 1.2 result_t createSession( const char* sessionid, userid_t uid, unsigned long remoteHost, sessionid_t* sessions )
404 youi 1.1 {
405     return RES_ERROR;
406     }
407    
408     /**
409     *
410     * ?祉???激?с?潟???膣違??session_t?у??????.<br>
411     *
412     * @param
413     * @return
414     *
415     */
416 youi 1.2 result_t getSessionDetail( sessionid_t sess_id, const session_t** session )
417 youi 1.1 {
418     return RES_ERROR;
419     }
420 youi 1.2
421     void freeResult( account_t* ptr ){ delete[] ptr; }
422    
423     void freeResult( group_t* ptr ){ delete[] ptr; }
424    
425     void freeResult( session_t* ptr ){ delete[] ptr; }
426    
427     void freeResult( int* ptr ){ delete[] ptr; }
428    

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