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.3 - (hide annotations) (download) (as text)
Thu Nov 25 11:13:59 2004 UTC (19 years, 4 months ago) by youi
Branch: MAIN
Changes since 1.2: +17 -1 lines
File MIME type: text/x-c++src
getLastErrorString/setLastErrorStringを定義.

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

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