oapi.cc

00001 /* 
00002    EyeDB Object Database Management System
00003    Copyright (C) 1994-2008 SYSRA
00004    
00005    EyeDB is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009    
00010    EyeDB is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014    
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with this library; if not, write to the Free Software
00017    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA 
00018 */
00019 
00020 /*
00021    Author: Eric Viara <viara@sysra.com>
00022 */
00023 
00024 #include <eyedbconfig.h>
00025 
00026 #include <eyedbsm/eyedbsm.h>
00027 
00028 namespace eyedbsm {
00029 
00030   Status Database::dbCreate(const char *dbfile, unsigned int version,
00031                             const DbCreateDescription &dbc,
00032                             mode_t file_mask, const char *file_group)
00033   {
00034     return eyedbsm::dbCreate(dbfile, version, &dbc, file_mask, file_group);
00035   }
00036 
00037   Status Database::dbDelete(const char *dbfile)
00038   {
00039     return eyedbsm::dbDelete(dbfile);
00040   }
00041 
00042   Status Database::dbMove(const char *dbfile, const DbMoveDescription &dmv)
00043   {
00044     return eyedbsm::dbMove(dbfile, &dmv);
00045   }
00046 
00047   Status Database::dbCopy(const char *dbfile, const DbCopyDescription &dcp)
00048   {
00049     return eyedbsm::dbCopy(dbfile, &dcp);
00050   }
00051 
00052   Status Database::dbInfo(const char *dbfile, DbInfoDescription &info)
00053   {
00054     return eyedbsm::dbInfo(dbfile, &info);
00055   }
00056 
00057   Status Database::dbRelocate(const char *dbfile,
00058                               const DbRelocateDescription &rel)
00059   {
00060     return eyedbsm::dbRelocate(dbfile, &rel);
00061   }
00062 
00063 
00064   Database::Database()
00065   {
00066     dbh = 0;
00067   }
00068 
00069 
00070   Status Database::open(const char *_dbfile, int flags,
00071                         const OpenHints &_hints, int uid)
00072   {
00073     dbfile = strdup(_dbfile);
00074     hints = _hints;
00075     return eyedbsm::dbOpen(dbfile, flags, &hints, uid, &version, &dbh);
00076   }
00077 
00078 
00079   unsigned int Database::getVersion() const
00080   {
00081     return version;
00082   }
00083 
00084   int Database::getOpenFlags() const
00085   {
00086     return eyedbsm::getOpenFlags(dbh);
00087   }
00088 
00089   const char *Database::getDBFile() const {
00090     return dbfile;
00091   }
00092 
00093   const OpenHints &Database::getOpenHints() const {
00094     return hints;
00095   }
00096 
00097   Status Database::close()
00098   {
00099     return eyedbsm::dbClose(dbh);
00100   }
00101 
00102   Status Database::transactionBegin(const TransactionParams &params)
00103   {
00104     return eyedbsm::transactionBegin(dbh, &params);
00105   }
00106 
00107   Status Database::transactionCommit()
00108   {
00109     return eyedbsm::transactionCommit(dbh);
00110   }
00111 
00112   Status Database::transactionAbort()
00113   {
00114     return eyedbsm::transactionAbort(dbh);
00115   }
00116 
00117 
00118   Status Database::transactionParamsSet(const TransactionParams &params)
00119   {
00120     return eyedbsm::transactionParamsSet(dbh, &params);
00121   }
00122 
00123 
00124   Status Database::transactionParamsGet(TransactionParams &params)
00125   {
00126     return eyedbsm::transactionParamsGet(dbh, &params);
00127   }
00128 
00129 
00130   Status Database::transactionLockSet(ObjectLockMode lockmode,
00131                                       ObjectLockMode &olockmode)
00132   {
00133     return eyedbsm::transactionLockSet(dbh, lockmode, &olockmode);
00134   }
00135 
00136 
00137   Status Database::objectCreate(const void *object,
00138                                 unsigned int size, short dspid, Oid &oid)
00139   {
00140     return eyedbsm::objectCreate(dbh, object, size, dspid, &oid);
00141   }
00142 
00143 
00144   Status Database::objectDelete(const Oid & oid)
00145   {
00146     return eyedbsm::objectDelete(dbh, &oid);
00147   }
00148 
00149 
00150   Status Database::objectWrite(int start, int length,
00151                                const void *object, const Oid & oid)
00152   {
00153     return eyedbsm::objectWrite(dbh, start, length, object, &oid);
00154   }
00155 
00156 
00157   Status Database::objectWriteCache(int start,
00158                                     const void *object, const Oid & oid)
00159   {
00160     return eyedbsm::objectWriteCache(dbh, start, object, &oid);
00161   }
00162 
00163 
00164   Status Database::objectRead(int start, int length, void *object,
00165                               LockMode lockmode, short &pdatid,
00166                               unsigned int &psize,
00167                               const Oid & oid)
00168   {
00169     return eyedbsm::objectRead(dbh, start, length, object, lockmode,
00170                                &pdatid, &psize, &oid);
00171   }
00172 
00173 
00174   Status Database::objectReadNoCopy(int start, int length,
00175                                     void *object, LockMode lockmode,
00176                                     short &pdatid, unsigned int &psize,
00177                                     const Oid & oid)
00178   {
00179     return eyedbsm::objectReadNoCopy(dbh, start, length, object, lockmode,
00180                                      &pdatid, &psize, &oid);
00181   }
00182 
00183 
00184   Status Database::objectReadCache(int start, void **object,
00185                                    LockMode lockmode, const Oid & oid)
00186   {
00187     return eyedbsm::objectReadCache(dbh, start, object, lockmode, &oid);
00188   }
00189 
00190 
00191   Status Database::objectSizeGet(unsigned int &size, LockMode lockmode, const Oid & oid)
00192   {
00193     return eyedbsm::objectSizeGet(dbh, &size, lockmode, &oid);
00194   }
00195 
00196 
00197   Status Database::objectCheckAccess(Boolean write,
00198                                      const Oid & oid, Boolean &access)
00199   {
00200     return eyedbsm::objectCheckAccess(dbh, write, &oid, &access);
00201   }
00202 
00203 
00204   Status Database::objectLocationGet(const Oid &oid, ObjectLocation &objloc)
00205   {
00206     return eyedbsm::objectLocationGet(dbh, &oid, &objloc);
00207   }
00208 
00209 
00210   Status Database::objectsLocationGet(const Oid *oid, ObjectLocation *objloc,
00211                                       unsigned int oid_cnt)
00212   {
00213     return eyedbsm::objectsLocationGet(dbh, oid, objloc, oid_cnt);
00214   }
00215 
00216 
00217   Status Database::objectMoveDat(const Oid & oid, short datid)
00218   {
00219     return eyedbsm::objectMoveDat(dbh, &oid, datid);
00220   }
00221 
00222 
00223   Status Database::objectsMoveDat(const Oid * oid,
00224                                   unsigned int oid_cnt, short datid)
00225   {
00226     return eyedbsm::objectsMoveDat(dbh, oid, oid_cnt, datid);
00227   }
00228 
00229 
00230   Status Database::objectMoveDsp(const Oid & oid, short dspid)
00231   {
00232     return eyedbsm::objectMoveDsp(dbh, &oid, dspid);
00233   }
00234 
00235 
00236   Status Database::objectsMoveDsp(const Oid * oid,
00237                                   unsigned int oid_cnt, short dspid)
00238   {
00239     return eyedbsm::objectsMoveDsp(dbh, oid, oid_cnt, dspid);
00240   }
00241 
00242 
00243   Status Database::objectSizeModify(unsigned int size, Boolean copy,
00244                                     const Oid & oid)
00245   {
00246     return eyedbsm::objectSizeModify(dbh, size, copy, &oid);
00247   }
00248 
00249 
00250   Status Database::objectLock(const Oid & oid, LockMode mode,
00251                               LockMode &rmode)
00252   {
00253     return eyedbsm::objectLock(dbh, &oid, mode, &rmode);
00254   }
00255 
00256 
00257   Status Database::objectGetLock(const Oid & oid, LockMode &rmode)
00258   {
00259     return eyedbsm::objectGetLock(dbh, &oid, &rmode);
00260   }
00261 
00262 
00263   Status Database::objectDownLock(const Oid & oid)
00264   {
00265     return eyedbsm::objectDownLock(dbh, &oid);
00266   }
00267 
00268 
00269   Status Database::firstOidDatGet(short datid, Oid &oid, Boolean &found)
00270   {
00271     return eyedbsm::firstOidDatGet(dbh, datid, &oid, &found);
00272   }
00273 
00274   Status Database::nextOidDatGet(short datid, const Oid & baseoid,
00275                                  Oid &nextoid, Boolean &found)
00276   {
00277     return eyedbsm::nextOidDatGet(dbh, datid, &baseoid, &nextoid, &found);
00278   }
00279 
00280 
00281 
00282   Status Database::rootEntrySet(const char *key,
00283                                 const void *data, unsigned int size, Boolean create)
00284   {
00285     return eyedbsm::rootEntrySet(dbh, key, data, size, create);
00286   }
00287 
00288 
00289   Status Database::rootEntryGet(const char *key,
00290                                 void *data, unsigned int maxsize)
00291   {
00292     return eyedbsm::rootEntryGet(dbh, key, data, maxsize);
00293   }
00294 
00295   Status Database::rootEntryDelete(const char *key)
00296   {
00297     return eyedbsm::rootEntryDelete(dbh, key);
00298   }
00299 
00300 
00301   Status Database::suserUnset()
00302   {
00303     return eyedbsm::suserUnset(dbh);
00304   }
00305 
00306 
00307   Status Database::datCreate(const char *file, const char *name,
00308                              unsigned long long maxsize, MapType mtype,
00309                              unsigned int sizeslot, DatType type,
00310                              mode_t file_mask, const char *file_group)
00311   {
00312     return eyedbsm::datCreate(dbh, file, name, maxsize, mtype,
00313                               sizeslot, type, file_mask, file_group);
00314   }
00315 
00316 
00317   Status Database::datMove(const char *datfile, const char *newdatfile)
00318   {
00319     return eyedbsm::datMove(dbh, datfile, newdatfile);
00320   }
00321 
00322 
00323   Status Database::datDelete(const char *datfile)
00324   {
00325     return eyedbsm::datDelete(dbh, datfile);
00326   }
00327 
00328 
00329   Status Database::datResize(const char *datfile,
00330                              unsigned long long newmaxsize)
00331   {
00332     return eyedbsm::datResize(dbh, datfile, newmaxsize);
00333   }
00334 
00335 
00336   Status Database::datMoveObjects(const char *dat_src, const char *dat_dest)
00337   {
00338     return eyedbsm::datMoveObjects(dbh, dat_src, dat_dest);
00339   }
00340 
00341                     
00342   Status Database::datCheck(const char *datfile, short &datid, short &dspid)
00343   {
00344     return eyedbsm::datCheck(dbh, datfile, &datid, &dspid);
00345   }
00346 
00347                     
00348   Status Database::datDefragment(const char *datfile,
00349                                  mode_t file_mask, const char *file_group)
00350   {
00351     return eyedbsm::datDefragment(dbh, datfile, file_mask, file_group);
00352   }
00353 
00354 
00355   Status Database::datRename(const char *datfile, const char *name)
00356   {
00357     return eyedbsm::datRename(dbh, datfile, name);
00358   }
00359 
00360 
00361   Status Database::datGetInfo(const char *datfile, DatafileInfo &info)
00362   {
00363     return eyedbsm::datGetInfo(dbh, datfile, &info);
00364   }
00365 
00366 
00367   Status Database::datGetDspid(short datid, short &dspid)
00368   {
00369     return eyedbsm::datGetDspid(dbh, datid, &dspid);
00370   }
00371 
00372 
00373   Status Database::dspSetDefault(const char *dataspace)
00374   {
00375     return eyedbsm::dspSetDefault(dbh, dataspace);
00376   }
00377 
00378 
00379   Status Database::dspGetDefault(short &dspid)
00380   {
00381     return eyedbsm::dspGetDefault(dbh, &dspid);
00382   }
00383 
00384 
00385   Status Database::dspCreate(const char *dataspace,
00386                              const char **datfiles, unsigned int datfile_cnt)
00387   {
00388     return eyedbsm::dspCreate(dbh, dataspace, datfiles, datfile_cnt);
00389   }
00390 
00391 
00392   Status Database::dspUpdate(const char *dataspace,
00393                              const char **datfiles, unsigned int datfile_cnt)
00394   {
00395     return eyedbsm::dspUpdate(dbh, dataspace, datfiles, datfile_cnt);
00396   }
00397 
00398 
00399   Status Database::dspDelete(const char *dataspace)
00400   {
00401     return eyedbsm::dspDelete(dbh, dataspace);
00402   }
00403 
00404   Status Database::dspRename(const char *dataspace,
00405                              const char *dataspace_new)
00406   {
00407     return eyedbsm::dspRename(dbh, dataspace, dataspace_new);
00408   }
00409 
00410 
00411   Status Database::dspCheck(const char *dataspace, short &dspid,
00412                             short datid[], unsigned int &ndat)
00413   {
00414     return eyedbsm::dspCheck(dbh, dataspace, &dspid, datid, &ndat);
00415   }
00416 
00417                     
00418   Status Database::dspSetCurDat(const char *dataspace,
00419                                 const char *datfile)
00420   {
00421     return eyedbsm::dspSetCurDat(dbh, dataspace, datfile);
00422   }
00423 
00424   Status Database::dspGetCurDat(const char *dataspace, short &datid)
00425   {
00426     return eyedbsm::dspGetCurDat(dbh, dataspace, &datid);
00427   }
00428 
00429 
00430   Status Database::objectNumberSet(unsigned int maxobjs)
00431   {
00432     return eyedbsm::objectNumberSet(dbh, maxobjs);
00433   }
00434 
00435 
00436   Status Database::protectionCreate(const ProtectionDescription &desc,
00437                                     Oid &oid)
00438   {
00439     return eyedbsm::protectionCreate(dbh, &desc, &oid);
00440   }
00441 
00442 
00443   Status Database::protectionDelete(const Oid & oid)
00444   {
00445     return eyedbsm::protectionDelete(dbh, &oid);
00446   }
00447 
00448 
00449   Status Database::protectionModify(const ProtectionDescription &desc,
00450                                     const Oid &oid)
00451   {
00452     return eyedbsm::protectionModify(dbh, &desc, &oid);
00453   }
00454 
00455 
00456   Status Database::protectionGetByName(const char *name,
00457                                        ProtectionDescription **desc,
00458                                        Oid &oid)
00459   {
00460     return eyedbsm::protectionGetByName(dbh, name, desc, &oid);
00461   }
00462 
00463 
00464   Status Database::protectionGetByOid(const Oid &oid,
00465                                       ProtectionDescription **desc)
00466   {
00467     return eyedbsm::protectionGetByOid(dbh, &oid, desc);
00468   }
00469 
00470 
00471   Status Database::protectionListGet(Oid **oid, ProtectionDescription ***desc,
00472                                      unsigned int &nprot)
00473   {
00474     return eyedbsm::protectionListGet(dbh, oid, desc, &nprot);
00475   }
00476 
00477 
00478   Status Database::dbProtectionAdd(const DbProtectionDescription &desc,
00479                                    unsigned int nprot)
00480   {
00481     return eyedbsm::dbProtectionAdd(dbh, &desc, nprot);
00482   }
00483 
00484 
00485   Status Database::dbProtectionGet(DbProtectionDescription **desc,
00486                                    unsigned int &nprot)
00487   {
00488     return eyedbsm::dbProtectionGet(dbh, desc, &nprot);
00489   }
00490 
00491 
00492   Status Database::objectProtectionSet(const Oid & oid,
00493                                        const Oid & protoid)
00494   {
00495     return eyedbsm::objectProtectionSet(dbh, &oid, &protoid);
00496   }
00497 
00498   Status Database::objectProtectionGet(const Oid & oid,
00499                                        Oid *protoid)
00500   {
00501     return eyedbsm::objectProtectionGet(dbh, &oid, protoid);
00502   }
00503 
00504 
00505   Boolean Database::isPhysicalOid(const Oid &oid)
00506   {
00507     return eyedbsm::isPhysicalOid(dbh, &oid);
00508   }
00509 
00510 
00511   Status Database::registerStart(unsigned reg_mask)
00512   {
00513     return eyedbsm::registerStart(dbh, reg_mask);
00514   }
00515 
00516 
00517   Status Database::registerClear()
00518   {
00519     return eyedbsm::registerClear(dbh);
00520   }
00521 
00522   Status Database::registerEnd()
00523   {
00524     return eyedbsm::registerEnd(dbh);
00525   }
00526 
00527   Status Database::registerGet(Register **preg)
00528   {
00529     return eyedbsm::registerGet(dbh, preg);
00530   }
00531 
00532   Database::~Database()
00533   {
00534     free(dbfile);
00535   }
00536 }

Generated on Mon Dec 22 18:15:58 2008 for eyedb by  doxygen 1.5.3