00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <eyedbconfig.h>
00025
00026
00027 #include <eyedblib/math.h>
00028
00029 #include <math.h>
00030 #include <sstream>
00031
00032 #include <eyedb/eyedb.h>
00033 #include <oql_p.h>
00034 #include <eyedb/oqlctb.h>
00035 #include "comp_time.h"
00036
00037 using std::ostringstream;
00038 using namespace eyedb;
00039
00040 #define CHKCONN(CONN, MSG) \
00041 OqlCtbConnection *CONN = (OqlCtbConnection *)_o; \
00042 \
00043 if (!(CONN)) \
00044 return Exception::make(MSG ": invalid null object"); \
00045 \
00046 if (!(CONN)->conn) \
00047 { \
00048 (CONN)->conn = new Connection(); \
00049 (CONN)->conn->setOQLInfo(CONN); \
00050 }
00051
00052 #define CHK2CONN(CONN, MSG) \
00053 OqlCtbConnection *CONN = (OqlCtbConnection *)_o; \
00054 \
00055 if (!(CONN)) \
00056 return Exception::make(MSG ": invalid null object"); \
00057 \
00058 if (!(CONN)->conn) \
00059 return Exception::make(MSG ": connection is not opened")
00060
00061 #define CHKDB(DB, MSG) \
00062 OqlCtbDatabase *DB = (OqlCtbDatabase *)_o; \
00063 \
00064 if (!(DB)) \
00065 return Exception::make(MSG ": invalid null object"); \
00066 \
00067 if (!(DB)->xdb) \
00068 { \
00069 const char *dbname = (DB)->getDbname().c_str(); \
00070 int dbid = (DB)->getDbid(); \
00071 if ((!dbname || !*dbname) && !dbid) \
00072 return Exception::make(MSG ": database name or dbid must not set"); \
00073 \
00074 const char *dbmdb = (DB)->getDbmdb().c_str(); \
00075 if (!dbname || !*dbname) \
00076 (DB)->xdb = new Database(dbid, (*dbmdb ? dbmdb : 0)); \
00077 else \
00078 (DB)->xdb = new Database(dbname, (*dbmdb ? dbmdb : 0)); \
00079 (DB)->xdb->setOQLInfo(DB); \
00080 }
00081
00082 #define CHK2DB(DB, MSG) \
00083 OqlCtbDatabase *DB = (OqlCtbDatabase *)_o; \
00084 \
00085 if (!(DB)) \
00086 return Exception::make(MSG ": invalid null object"); \
00087 \
00088 if (!(DB)->xdb) \
00089 return Exception::make(MSG ": database is not opened")
00090
00091 #define POSTDB(DB, S) \
00092 if (!S) { \
00093 (DB)->setDbname((DB)->xdb->getName()); \
00094 (DB)->setDbid((DB)->xdb->getDbid()); \
00095 (DB)->setDbmdb((DB)->xdb->getDBMDB()); \
00096 }
00097
00098 static void
00099 not_impl(const char *msg)
00100 {
00101 fprintf(stderr, "oqlctbmthfe.cc: %s not implemented\n", msg);
00102 }
00103
00104
00105
00106
00107
00108 Status
00109 __method_static_OUT_string_getConfigValue_eyedb__IN_string(Database *_db, FEMethod_C *_m, const char * name, char * &retarg)
00110 {
00111 const char *x = eyedb::ClientConfig::getCValue(name);
00112 retarg = Argument::dup(x ? x : "");
00113 return Success;
00114 }
00115
00116
00117
00118
00119
00120 Status
00121 __method_static_OUT_string_getVersion_eyedb(Database *_db, FEMethod_C *_m, char * &retarg)
00122 {
00123 retarg = Argument::dup(eyedb::getVersion());
00124 return Success;
00125 }
00126
00127
00128
00129
00130
00131 Status
00132 __method_static_OUT_int32_getVersionNumber_eyedb(Database *_db, FEMethod_C *_m, eyedblib::int32 &retarg)
00133 {
00134 retarg = eyedb::getVersionNumber();
00135 return Success;
00136 }
00137
00138
00139
00140
00141
00142 Status
00143 __method_static_OUT_string_getArchitecture_eyedb(Database *_db, FEMethod_C *_m, char * &retarg)
00144 {
00145 retarg = Argument::dup(Architecture::getArchitecture()->getArch());
00146 return Success;
00147 }
00148
00149
00150
00151
00152
00153 Status
00154 __method_static_OUT_string_getCompilationTime_eyedb(Database *_db, FEMethod_C *_m, char * &retarg)
00155 {
00156 retarg = Argument::dup(getCompilationTime());
00157 return Success;
00158 }
00159
00160
00161
00162
00163
00164 Status
00165 __method__OUT_oid_getOid_object(Database *_db, FEMethod_C *_m, Object *_o, Oid &retarg)
00166 {
00167
00168 retarg = _o->getOid();
00169 return Success;
00170 }
00171
00172
00173
00174
00175
00176 Status
00177 __method__OUT_object_REF__getObject_object(eyedb::Database *_db, eyedb::FEMethod_C *_m, eyedb::Object *_o, eyedb::Object * &retarg)
00178 {
00179 retarg = _o;
00180 _o->incrRefCount();
00181 return Success;
00182 }
00183
00184 static OqlCtbDatafile *
00185 makeDatafile(Database *db, const Datafile *dat)
00186 {
00187 if (!dat)
00188 return 0;
00189
00190 OqlCtbDatafile *rdat = new OqlCtbDatafile(db);
00191
00192 rdat->xdatfile = const_cast<Datafile*>(dat);
00193 rdat->setId(dat->getId());
00194 rdat->setDspid(dat->getDspid());
00195 rdat->setFile(dat->getFile());
00196 rdat->setName(dat->getName());
00197 rdat->setMtype(dat->getMaptype() ==
00198 eyedbsm::BitmapType ?
00199 OqlCtbMapType::BitmapType :
00200 OqlCtbMapType::LinkmapType);
00201 rdat->setMaxsize(dat->getMaxsize());
00202 rdat->setSlotsize(dat->getSlotsize());
00203 rdat->setDtype(dat->isPhysical() ?
00204 OqlCtbDatType::PhysicalOidType :
00205 OqlCtbDatType::LogicalOidType);
00206
00207 return rdat;
00208 }
00209
00210 static OqlCtbDataspace *
00211 makeDataspace(Database *db, const Dataspace *dsp)
00212 {
00213 if (!dsp)
00214 return 0;
00215
00216 OqlCtbDataspace *rdsp = new OqlCtbDataspace(db);
00217
00218 rdsp->xdataspace = const_cast<Dataspace*>(dsp);
00219 rdsp->setId(dsp->getId());
00220 rdsp->setName(dsp->getName());
00221
00222 unsigned int datafile_cnt;
00223 const Datafile **datafiles = dsp->getDatafiles(datafile_cnt);
00224 OqlCtbDatafile **rdatafiles = new OqlCtbDatafile*[datafile_cnt];
00225 for (int n = 0; n < datafile_cnt; n++) {
00226 OqlCtbDatafile *rdat = makeDatafile(db, datafiles[n]);
00227 rdat->setDsp(rdsp);
00228 rdsp->setDatafiles(n, rdat);
00229 }
00230
00231 return rdsp;
00232 }
00233
00234
00235
00236
00237
00238 Status
00239 __method__OUT_dataspace_REF__getDataspace_object(Database *_db, FEMethod_C *_m, Object *_o, OqlCtbDataspace * &rdataspace)
00240 {
00241 const Dataspace *dataspace;
00242 Status s = _o->getDataspace(dataspace);
00243 if (s)
00244 return s;
00245
00246 rdataspace = makeDataspace(_db, dataspace);
00247 return Success;
00248 }
00249
00250
00251
00252
00253
00254 Status
00255 __method__OUT_void_setDataspace_object__IN_dataspace_REF_(Database *_db, FEMethod_C *_m, Object *_o, OqlCtbDataspace * dsp)
00256 {
00257 return _o->setDataspace(dsp->xdataspace);
00258 }
00259
00260
00261
00262
00263
00264 Status
00265 __method__OUT_void_move_object__IN_dataspace_REF_(Database *_db, FEMethod_C *_m, Object *_o, OqlCtbDataspace * dsp)
00266 {
00267 return _o->move(dsp->xdataspace);
00268 }
00269
00270
00271
00272
00273
00274 Status
00275 __method__OUT_void_store_object(Database *_db, FEMethod_C *_m, Object *_o)
00276 {
00277 return _o->store();
00278 }
00279
00280
00281
00282
00283
00284 Status
00285 __method__OUT_void_setDatabase_object__IN_database_REF_(Database *_db, FEMethod_C *_m, Object *_o, OqlCtbDatabase * db)
00286 {
00287 if (!db->xdb)
00288 return Exception::make("object::setDatabase(in database *): "
00289 "database is not opened");
00290
00291 return _o->setDatabase(db->xdb);
00292 }
00293
00294
00295
00296
00297
00298
00299
00300
00301 static Status
00302 toStringRealize(Database *_db, Object *_o, int flags, char * &retarg)
00303 {
00304 Object *o = _o;
00305 #ifdef AUTO_GARB
00306 gbxAutoGarb _;
00307 #endif
00308
00309 if ((flags & OqlCtbToStringFlags::FullRecursTrace) &&
00310 o->getOid().isValid()) {
00311 Status s = _db->reloadObject(o->getOid(), o, RecMode::FullRecurs);
00312 if (s) return s;
00313 }
00314
00315 Status status;
00316 std::string str = o->toString(flags, (flags & OqlCtbToStringFlags::FullRecursTrace ? RecMode::FullRecurs : RecMode::NoRecurs), &status);
00317 retarg = Argument::dup(str.c_str());
00318
00319 #ifndef AUTO_GARB
00320 if (o != _o) {
00321
00322
00323 o->release();
00324 }
00325 #endif
00326
00327 return status;
00328 }
00329
00330 Status
00331 __method__OUT_string_toString_object(Database *_db, FEMethod_C *_m, Object *_o, char * &retarg)
00332 {
00333 return toStringRealize(_db, _o, 0, retarg);
00334 }
00335
00336
00337
00338
00339
00340 Status
00341 __method__OUT_string_toString_object__IN_int32(Database *_db, FEMethod_C *_m, Object *_o, const eyedblib::int32 flags, char * &retarg)
00342 {
00343 return toStringRealize(_db, _o, flags, retarg);
00344 }
00345
00346
00347
00348
00349
00350 Status
00351 __method__OUT_database_REF__getDatabase_object(Database *_db, FEMethod_C *_m, Object *_o, OqlCtbDatabase * &retarg)
00352 {
00353 retarg = (OqlCtbDatabase *)(_o->getDatabase()->getOQLInfo());
00354
00355 if (retarg)
00356 {
00357 Database *db = retarg->xdb;
00358 retarg = new OqlCtbDatabase(*retarg);
00359 retarg->xdb = db;
00360 }
00361 else
00362 {
00363 const Class *clsdb = _db->getSchema()->getClass("database");
00364 if (clsdb)
00365 {
00366 Database *xdb = _o->getDatabase();
00367 retarg = new OqlCtbDatabase(xdb);
00368 retarg->setDbname(xdb->getName());
00369 retarg->setDbid(xdb->getDbid());
00370 retarg->setDbmdb(xdb->getDBMDB());
00371 retarg->xdb = xdb;
00372 xdb->setOQLInfo(retarg);
00373 }
00374 }
00375
00376
00377 return Success;
00378 }
00379
00380
00381
00382
00383
00384 Status
00385 __method__OUT_object_REF__clone_object(Database *_db, FEMethod_C *_m, Object *_o, Object * &retarg)
00386 {
00387 retarg = _o->clone();
00388 return Success;
00389 }
00390
00391
00392
00393
00394
00395 Status
00396 __method__OUT_int64_getCTime_object(Database *_db, FEMethod_C *_m, Object *_o, eyedblib::int64 &retarg)
00397 {
00398 retarg = _o->getCTime();
00399 return Success;
00400 }
00401
00402
00403
00404
00405
00406 Status
00407 __method__OUT_int64_getMTime_object(Database *_db, FEMethod_C *_m, Object *_o, eyedblib::int64 &retarg)
00408 {
00409 retarg = _o->getMTime();
00410 return Success;
00411 }
00412
00413
00414
00415
00416
00417 Status
00418 __method__OUT_string_getStringCTime_object(Database *_db, FEMethod_C *_m, Object *_o, char * &retarg)
00419 {
00420 retarg = Argument::dup(_o->getStringCTime());
00421 return Success;
00422 }
00423
00424
00425
00426
00427
00428 Status
00429 __method__OUT_string_getStringMTime_object(Database *_db, FEMethod_C *_m, Object *_o, char * &retarg)
00430 {
00431 retarg = Argument::dup(_o->getStringMTime());
00432 return Success;
00433 }
00434
00435
00436
00437
00438
00439 Status
00440 __method__OUT_bool_isRemoved_object(Database *_db, FEMethod_C *_m, Object *_o, Bool &retarg)
00441 {
00442 retarg = (Bool)_o->isRemoved();
00443 return Success;
00444 }
00445
00446
00447
00448
00449
00450 Status
00451 __method__OUT_bool_isModify_object(Database *_db, FEMethod_C *_m, Object *_o, Bool &retarg)
00452 {
00453 retarg = (Bool)_o->isModify();
00454 return Success;
00455 }
00456
00457
00458
00459
00460
00461 Status
00462 __method__OUT_void_setLock_object__IN_lock_mode(Database *_db, FEMethod_C *_m, Object *_o, const OqlCtbLockMode::Type mode)
00463 {
00464 return _o->setLock((LockMode)mode);
00465 }
00466
00467
00468
00469
00470
00471 Status
00472 __method__OUT_void_setLock_object__IN_lock_mode__OUT_int32(Database *_db, FEMethod_C *_m, Object *_o, const OqlCtbLockMode::Type mode, eyedblib::int32 &rmode)
00473 {
00474 LockMode _rmode;
00475 Status s = _o->setLock((LockMode)mode, _rmode);
00476 rmode = _rmode;
00477 return s;
00478 }
00479
00480
00481
00482
00483
00484 Status
00485 __method__OUT_void_getLock_object__OUT_lock_mode(Database *_db, FEMethod_C *_m, Object *_o, OqlCtbLockMode::Type &rmode)
00486 {
00487 LockMode _rmode;
00488 Status s = _o->getLock(_rmode);
00489 rmode = (OqlCtbLockMode::Type)_rmode;
00490 return s;
00491 }
00492
00493
00494
00495
00496
00497 Status
00498 __method__OUT_void_open_connection(Database *_db, FEMethod_C *_m, Object *_o)
00499 {
00500 CHKCONN(conn, "connection::open()");
00501 return conn->conn->open();
00502 }
00503
00504
00505
00506
00507
00508 Status
00509 __method__OUT_void_open_connection__IN_string__IN_string(Database *_db, FEMethod_C *_m, Object *_o, const char * host, const char * port)
00510 {
00511 CHKCONN(conn, "connection::open(in string host, in string port)");
00512 return conn->conn->open(host, port);
00513 }
00514
00515
00516
00517
00518
00519 Status
00520 __method__OUT_void_close_connection(Database *_db, FEMethod_C *_m, Object *_o)
00521 {
00522 CHK2CONN(conn, "connection::close()");
00523 return conn->conn->close();
00524 }
00525
00526
00527
00528
00529
00530 Status
00531 __method__OUT_void_open_database__IN_connection_REF___IN_int32(Database *_db, FEMethod_C *_m, Object *_o, OqlCtbConnection * conn, const eyedblib::int32 mode)
00532 {
00533 CHKDB(db, "database::open(in connection conn, in int mode)");
00534 Status s = db->xdb->open(((OqlCtbConnection *)conn)->conn,
00535 (Database::OpenFlag)(mode|_DBOpenLocal));
00536 POSTDB(db, s);
00537 return s;
00538 }
00539
00540
00541
00542
00543
00544 Status
00545 __method__OUT_void_open_database__IN_connection_REF___IN_int32__IN_string__IN_string(Database *_db, FEMethod_C *_m, Object *_o, OqlCtbConnection * conn, const eyedblib::int32 mode, const char * userauth, const char * passwdauth)
00546 {
00547 CHKDB(db, "database::open(in connection *, in int mode, in string user, in string passwd)");
00548 Status s = db->xdb->open(((OqlCtbConnection *)conn)->conn,
00549 (Database::OpenFlag)(mode|_DBOpenLocal), userauth, passwdauth);
00550 POSTDB(db, s);
00551 return s;
00552 }
00553
00554
00555
00556
00557
00558 Status
00559 __method__OUT_void_open_database__IN_int32(Database *_db, FEMethod_C *_m, Object *_o, const eyedblib::int32 mode)
00560 {
00561 CHKDB(db, "database::open(in int mode)");
00562 Status s = db->xdb->open(_db->getConnection(), (Database::OpenFlag)(mode|_DBOpenLocal));
00563
00564 POSTDB(db, s);
00565 return s;
00566 }
00567
00568
00569
00570
00571
00572 Status
00573 __method__OUT_void_open_database__IN_int32__IN_string__IN_string(Database *_db, FEMethod_C *_m, Object *_o, const eyedblib::int32 mode, const char * userauth, const char * passwdauth)
00574 {
00575 CHKDB(db, "database::open(in int mode, in string user, in string passwd)");
00576 Status s = db->xdb->open(_db->getConnection(), (Database::OpenFlag)(mode|_DBOpenLocal),
00577 userauth, passwdauth);
00578 POSTDB(db, s);
00579 return s;
00580 }
00581
00582
00583
00584
00585
00586 Status
00587 __method__OUT_void_close_database(Database *_db, FEMethod_C *_m, Object *_o)
00588 {
00589 CHK2DB(db, "database::close()");
00590 return db->xdb->close();
00591 }
00592
00593
00594
00595
00596
00597 Status
00598 __method__OUT_void_create_database(Database *_db, FEMethod_C *_m, Object *_o)
00599 {
00600 CHKDB(db, "database::create()");
00601 return db->xdb->create(_db->getConnection());
00602 }
00603
00604
00605
00606
00607
00608 Status
00609 __method__OUT_void_create_database__IN_string__IN_string(Database *_db, FEMethod_C *_m, Object *_o, const char * userauth, const char * passwdauth)
00610 {
00611 CHKDB(db, "database::create(userauth, passwduth)");
00612 return db->xdb->create(_db->getConnection(), userauth, passwdauth);
00613 }
00614
00615
00616
00617
00618
00619 Status
00620 __method__OUT_void_destroy_database(Database *_db, FEMethod_C *_m, Object *_o)
00621 {
00622 CHKDB(db, "database::destroy()");
00623 Status s = db->xdb->remove(_db->getConnection());
00624 return s;
00625 }
00626
00627
00628
00629
00630
00631 Status
00632 __method__OUT_void_destroy_database__IN_string__IN_string(Database *_db, FEMethod_C *_m, Object *_o, const char * userauth, const char * passwdauth)
00633 {
00634 CHKDB(db, "database::destroy(userauth, passwdauth)");
00635 return db->xdb->remove(_db->getConnection(), userauth, passwdauth);
00636 }
00637
00638
00639
00640
00641
00642 Status
00643 __method__OUT_void_rename_database__IN_string(Database *_db, FEMethod_C *_m, Object *_o, const char * newname)
00644 {
00645 CHKDB(db, "database::rename(newname)");
00646 return db->xdb->rename(_db->getConnection(), newname);
00647 }
00648
00649
00650
00651
00652
00653 Status
00654 __method__OUT_void_rename_database__IN_string__IN_string__IN_string(Database *_db, FEMethod_C *_m, Object *_o, const char * newname, const char * userauth, const char * passwdauth)
00655 {
00656 CHKDB(db, "database::rename(newname, userauth, passwdauth)");
00657 return db->xdb->rename(_db->getConnection(), newname, userauth, passwdauth);
00658 }
00659
00660
00661
00662
00663
00664 Status
00665 __method_static_OUT_bool_isAutoPersistMode_database(Database *_db, FEMethod_C *_m, Bool &retarg)
00666 {
00667 retarg = (Bool)oqml_auto_persist;
00668 return Success;
00669 }
00670
00671
00672
00673
00674
00675 Status
00676 __method_static_OUT_void_setAutoPersistMode_database__IN_bool(Database *_db, FEMethod_C *_m, const Bool arg1)
00677 {
00678 oqml_auto_persist = OQMLBOOL(arg1);
00679 return Success;
00680 }
00681
00682
00683
00684
00685
00686 Status
00687 __method__OUT_bool_isDefaultDatabase_database(Database *_db, FEMethod_C *_m, Object *_o, Bool &retarg)
00688 {
00689 CHK2DB(db, "database::isDefaultDatabase()");
00690 retarg = (oqml_default_db == db ? True : False);
00691 return Success;
00692 }
00693
00694
00695
00696
00697
00698 Status
00699 __method__OUT_void_setDefaultDatabase_database(Database *_db, FEMethod_C *_m, Object *_o)
00700 {
00701 CHK2DB(db, "database::setDefaultDatabase()");
00702 oqml_default_db = db;
00703 return Success;
00704 }
00705
00706
00707
00708
00709
00710 Status
00711 __method__OUT_connection_REF__getConnection_database(Database *_db, FEMethod_C *_m, Object *_o, OqlCtbConnection * &retarg)
00712 {
00713 retarg = (OqlCtbConnection *)(_o->getDatabase()->getConnection()->getOQLInfo());
00714 if (!retarg)
00715 {
00716 Connection *conn =_o->getDatabase()->getConnection();
00717 retarg = new OqlCtbConnection();
00718 retarg->conn = conn;
00719 conn->setOQLInfo(retarg);
00720 }
00721
00722 return Success;
00723 }
00724
00725
00726
00727
00728
00729 Status
00730 __method__OUT_int32_getOpenMode_database(Database *_db, FEMethod_C *_m, Object *_o, eyedblib::int32 &retarg)
00731 {
00732 CHK2DB(db, "database::getOpenMode()");
00733 retarg = db->xdb->getOpenFlag();
00734 return Success;
00735 }
00736
00737
00738
00739
00740
00741 Status
00742 __method__OUT_bool_getCommitOnClose_database(Database *_db, FEMethod_C *_m, Object *_o, Bool &retarg)
00743 {
00744 CHK2DB(db, "database::getCommitOnClose()");
00745 retarg = (Bool)db->xdb->getCommitOnClose();
00746 return Success;
00747 }
00748
00749
00750
00751
00752
00753 Status
00754 __method__OUT_void_setCommitOnClose_database__IN_bool(Database *_db, FEMethod_C *_m, Object *_o, const Bool arg1)
00755 {
00756 CHK2DB(db, "database::setCommitOnClose(in int)");
00757 db->xdb->setCommitOnClose((Bool)arg1);
00758 return Success;
00759 }
00760
00761
00762
00763
00764
00765 Status
00766 __method__OUT_int32_getVersionNumber_database(Database *_db, FEMethod_C *_m, Object *_o, eyedblib::int32 &retarg)
00767 {
00768 CHK2DB(db, "database::getVersionNumber()");
00769 retarg = db->xdb->getVersionNumber();
00770 return Success;
00771 }
00772
00773
00774
00775
00776
00777 Status
00778 __method__OUT_string_getVersion_database(Database *_db, FEMethod_C *_m, Object *_o, char * &retarg)
00779 {
00780 CHK2DB(db, "database::getVersion()");
00781 retarg = Argument::dup(db->xdb->getVersion());
00782 return Success;
00783 }
00784
00785
00786
00787
00788
00789 Status
00790 __method__OUT_void_removeObject_database__IN_oid(Database *_db, FEMethod_C *_m, Object *_o, const Oid arg1)
00791 {
00792 CHK2DB(db, "database::removeObject(in oid)");
00793 return db->xdb->removeObject(arg1);
00794 }
00795
00796
00797
00798
00799
00800 Status
00801 __method__OUT_void_uncacheObject_database__IN_object_REF_(Database *_db, FEMethod_C *_m, Object *_o, Object * arg1)
00802 {
00803 CHK2DB(db, "database::uncacheObject(in object *)");
00804 db->xdb->uncacheObject(arg1);
00805 return Success;
00806 }
00807
00808
00809
00810
00811
00812 Status
00813 __method__OUT_void_uncacheObject_database__IN_oid(Database *_db, FEMethod_C *_m, Object *_o, const Oid arg1)
00814 {
00815 CHK2DB(db, "database::uncacheObject(in oid)");
00816 db->xdb->uncacheObject(arg1);
00817 return Success;
00818 }
00819
00820
00821
00822
00823
00824 Status
00825 __method__OUT_void_transactionBegin_database__IN_int32__IN_int32__IN_int32__IN_int32__IN_int32__IN_int32(Database *_db, FEMethod_C *_m, Object *_o, const eyedblib::int32 trsmode, const eyedblib::int32 lockmode, const eyedblib::int32 recovmode, const eyedblib::int32 _magorder, const eyedblib::int32 ratioalrt, const eyedblib::int32 wait_timeout)
00826 {
00827 CHK2DB(db, "database::transactionBegin()");
00828
00829 TransactionParams params;
00830 params.trsmode = (TransactionMode)trsmode;
00831 params.lockmode = (TransactionLockMode)lockmode;
00832 params.recovmode = (RecoveryMode)recovmode;
00833 params.magorder = _magorder;
00834 params.ratioalrt = ratioalrt;
00835 params.wait_timeout = wait_timeout;
00836
00837 return db->xdb->transactionBegin(params);
00838 }
00839
00840
00841
00842
00843
00844 Status
00845 __method__OUT_void_transactionBegin_database(Database *_db, FEMethod_C *_m, Object *_o)
00846 {
00847 CHK2DB(db, "database::transactionBegin()");
00848 return db->xdb->transactionBegin();
00849 }
00850
00851
00852
00853
00854
00855 Status
00856 __method__OUT_void_transactionCommit_database(Database *_db, FEMethod_C *_m, Object *_o)
00857 {
00858 CHK2DB(db, "database::transactionCommit()");
00859 return db->xdb->transactionCommit();
00860 }
00861
00862
00863
00864
00865
00866 Status
00867 __method__OUT_void_transactionAbort_database(Database *_db, FEMethod_C *_m, Object *_o)
00868 {
00869 CHK2DB(db, "database::transactionAbort()");
00870 return db->xdb->transactionAbort();
00871 }
00872
00873
00874
00875
00876 Status
00877 __method__OUT_bool_isInTransaction_database(Database *_db, FEMethod_C *_m, Object *_o, Bool &retarg)
00878 {
00879 CHK2DB(db, "database::isInTransaction()");
00880 retarg = (Bool)db->xdb->isInTransaction();
00881 return Success;
00882 }
00883
00884
00885
00886
00887
00888 Status
00889 __method__OUT_datafile_REF__ARRAY__getDatafiles_database(Database *_db, FEMethod_C *_m, Object *_o, OqlCtbDatafile * * &rdatafiles, int &rdatafile_cnt)
00890 {
00891 CHK2DB(db, "database::getDatafiles()");
00892
00893 const Datafile **datafiles;
00894 unsigned int cnt;
00895 Status s = db->xdb->getDatafiles(datafiles, cnt);
00896 if (s)
00897 return s;
00898
00899 rdatafile_cnt = cnt;
00900 rdatafiles = new OqlCtbDatafile*[rdatafile_cnt];
00901 for (int n = 0; n < rdatafile_cnt; n++)
00902 rdatafiles[n] = makeDatafile(db->xdb, datafiles[n]);
00903
00904 return Success;
00905 }
00906
00907
00908
00909
00910
00911 Status
00912 __method__OUT_datafile_REF__getDatafile_database__IN_string(Database *_db, FEMethod_C *_m, Object *_o, const char * name, OqlCtbDatafile * &rdatafile)
00913 {
00914 CHK2DB(db, "database::getDatafile(in string)");
00915
00916 const Datafile *datafile;
00917 Status s = db->xdb->getDatafile(name, datafile);
00918 if (s)
00919 return s;
00920
00921 rdatafile = makeDatafile(db->xdb, datafile);
00922
00923 return Success;
00924 }
00925
00926
00927
00928
00929
00930 Status
00931 __method__OUT_datafile_REF__getDatafile_database__IN_int16(Database *_db, FEMethod_C *_m, Object *_o, const eyedblib::int16 id, OqlCtbDatafile * &rdatafile)
00932 {
00933 CHK2DB(db, "database::getDatafile(in int16)");
00934
00935 const Datafile *datafile;
00936 Status s = db->xdb->getDatafile(id, datafile);
00937 if (s)
00938 return s;
00939
00940 rdatafile = makeDatafile(db->xdb, datafile);
00941
00942 return Success;
00943 }
00944
00945
00946
00947
00948
00949 Status
00950 __method__OUT_dataspace_REF__ARRAY__getDataspaces_database(Database *_db, FEMethod_C *_m, Object *_o, OqlCtbDataspace * * &rdataspaces, int &rdataspaces_cnt)
00951 {
00952
00953 CHK2DB(db, "dataspace*[] database::getDataspaces()");
00954 const Dataspace **dataspaces;
00955 unsigned int cnt;
00956 Status s = db->xdb->getDataspaces(dataspaces, cnt);
00957 if (s)
00958 return s;
00959
00960 rdataspaces_cnt = cnt;
00961 rdataspaces = new OqlCtbDataspace*[cnt];
00962
00963 for (int n = 0; n < cnt; n++)
00964 rdataspaces[n] = makeDataspace(db->xdb, dataspaces[n]);
00965
00966 return Success;
00967 }
00968
00969
00970
00971
00972
00973 Status
00974 __method__OUT_dataspace_REF__getDataspace_database__IN_string(Database *_db, FEMethod_C *_m, Object *_o, const char * name, OqlCtbDataspace * &rdsp)
00975 {
00976 CHK2DB(db, "dataspace* database::getDataspace(in string)");
00977 const Dataspace *dataspace;
00978 Status s = db->xdb->getDataspace(name, dataspace);
00979 if (s || !dataspace)
00980 return s;
00981 rdsp = makeDataspace(db->xdb, dataspace);
00982 return Success;
00983 }
00984
00985
00986
00987
00988
00989 Status
00990 __method__OUT_dataspace_REF__getDataspace_database__IN_int16(Database *_db, FEMethod_C *_m, Object *_o, const eyedblib::int16 id, OqlCtbDataspace * &rdsp)
00991 {
00992 CHK2DB(db, "dataspace* database::getDataspace(in int16)");
00993 const Dataspace *dataspace;
00994 Status s = db->xdb->getDataspace(id, dataspace);
00995 if (s || !dataspace)
00996 return s;
00997 rdsp = makeDataspace(db->xdb, dataspace);
00998 return Success;
00999 }
01000
01001
01002
01003
01004
01005 Status
01006 __method__OUT_dataspace_REF__getDefaultDataspace_database(Database *_db, FEMethod_C *_m, Object *_o, OqlCtbDataspace * &rdataspace)
01007 {
01008 CHK2DB(db, "dataspace* database::getDefaultDataspace()");
01009 const Dataspace *dataspace;
01010 Status s = db->xdb->getDefaultDataspace(dataspace);
01011 if (s)
01012 return s;
01013
01014 rdataspace = makeDataspace(db->xdb, dataspace);
01015 return Success;
01016 }
01017
01018
01019
01020
01021
01022 Status
01023 __method__OUT_void_setDefaultDataspace_database__IN_dataspace_REF_(Database *_db, FEMethod_C *_m, Object *_o, OqlCtbDataspace * dataspace)
01024 {
01025 CHK2DB(db, "void database::setDefaultDataspace(in dataspace *)");
01026 return db->xdb->setDefaultDataspace(dataspace->xdataspace);
01027 }
01028
01029
01030
01031
01032
01033 Status
01034 __method__OUT_void_moveObjects_database__IN_oid_ARRAY___IN_dataspace_REF_(Database *_db, FEMethod_C *_m, Object *_o, const Oid *oids, int oid_cnt, OqlCtbDataspace * dsp)
01035 {
01036 OidArray oid_arr(oids, oid_cnt);
01037
01038 return _db->moveObjects(oid_arr, dsp->xdataspace);
01039 }
01040
01041
01042
01043
01044
01045 Status
01046 __method__OUT_void_setObjectLock_database__IN_oid__IN_lock_mode(Database *_db, FEMethod_C *_m, Object *_o, const Oid _oid, const OqlCtbLockMode::Type mode)
01047 {
01048 CHK2DB(db, "database::setObjectLock(oid, mode)");
01049 return db->xdb->setObjectLock(_oid, (LockMode)mode);
01050 }
01051
01052
01053
01054
01055
01056 Status
01057 __method__OUT_void_setObjectLock_database__IN_oid__IN_lock_mode__OUT_lock_mode(Database *_db, FEMethod_C *_m, Object *_o, const Oid _oid, const OqlCtbLockMode::Type mode, OqlCtbLockMode::Type &rmode)
01058 {
01059 CHK2DB(db, "database::setObjectLock(oid, mode, rmode)");
01060 LockMode _rmode;
01061 Status s = db->xdb->setObjectLock(_oid, (LockMode)mode, _rmode);
01062 rmode = (OqlCtbLockMode::Type)_rmode;
01063 return s;
01064 }
01065
01066
01067
01068
01069
01070 Status
01071 __method__OUT_void_getObjectLock_database__IN_oid__OUT_lock_mode(Database *_db, FEMethod_C *_m, Object *_o, const Oid _oid, OqlCtbLockMode::Type &rmode)
01072 {
01073 CHK2DB(db, "database::getObjectLock(oid, rmode)");
01074 LockMode _rmode;
01075 Status s = db->xdb->getObjectLock(_oid, _rmode);
01076 rmode = (OqlCtbLockMode::Type)_rmode;
01077 return s;
01078 }
01079
01080
01081
01082
01083
01084 Status
01085 __method__OUT_void_updateSchema_database__IN_string__IN_string(Database *_db, FEMethod_C *_m, Object *_o, const char * odlfile, const char * package)
01086 {
01087 CHK2DB(db, "database::updateSchema(odlfile, package)");
01088 return db->xdb->updateSchema(odlfile, package);
01089 }
01090
01091
01092
01093
01094
01095 Status
01096 __method__OUT_void_updateSchema_database__IN_string__IN_string__IN_string__IN_string(Database *_db, FEMethod_C *_m, Object *_o, const char * odlfile, const char * package, const char * schname, const char * db_prefix)
01097 {
01098 CHK2DB(db, "database::updateSchema(odlfile, package, schname, db_prefix)");
01099 return db->xdb->updateSchema(odlfile, package, schname, db_prefix);
01100 }
01101
01102
01103
01104
01105
01106 Status
01107 __method__OUT_void_updateSchema_database__IN_string__IN_string__IN_string__IN_string__IN_string__IN_string(Database *_db, FEMethod_C *_m, Object *_o, const char * odlfile, const char * package, const char * schname, const char * db_prefix, const char * cpp_cmd, const char * cpp_flags)
01108 {
01109 CHK2DB(db, "database::updateSchema(odlfile, package, schname, db_prefix, cpp_cmd, cpp_flags)");
01110 return db->xdb->updateSchema(odlfile, package, schname, db_prefix,
01111 0, cpp_cmd, cpp_flags);
01112 }
01113
01114
01115
01116
01117
01118 Status
01119 __method_static_OUT_float_acos_math__IN_float(Database *_db, FEMethod_C *_m, const double arg1, double &retarg)
01120 {
01121 retarg = acos(arg1);
01122 return Success;
01123 }
01124
01125
01126
01127
01128
01129 Status
01130 __method_static_OUT_float_asin_math__IN_float(Database *_db, FEMethod_C *_m, const double arg1, double &retarg)
01131 {
01132 retarg = asin(arg1);
01133 return Success;
01134 }
01135
01136
01137
01138
01139
01140 Status
01141 __method_static_OUT_float_atan_math__IN_float(Database *_db, FEMethod_C *_m, const double arg1, double &retarg)
01142 {
01143 retarg = atan(arg1);
01144 return Success;
01145 }
01146
01147
01148
01149
01150
01151 Status
01152 __method_static_OUT_float_atan2_math__IN_float__IN_float(Database *_db, FEMethod_C *_m, const double arg1, const double arg2, double &retarg)
01153 {
01154 retarg = atan2(arg1, arg2);
01155 return Success;
01156 }
01157
01158
01159
01160
01161
01162 Status
01163 __method_static_OUT_float_cos_math__IN_float(Database *_db, FEMethod_C *_m, const double arg1, double &retarg)
01164 {
01165 retarg = cos(arg1);
01166 return Success;
01167 }
01168
01169
01170
01171
01172
01173 Status
01174 __method_static_OUT_float_sin_math__IN_float(Database *_db, FEMethod_C *_m, const double arg1, double &retarg)
01175 {
01176 retarg = sin(arg1);
01177 return Success;
01178 }
01179
01180
01181
01182
01183
01184 Status
01185 __method_static_OUT_float_tan_math__IN_float(Database *_db, FEMethod_C *_m, const double arg1, double &retarg)
01186 {
01187 retarg = tan(arg1);
01188 return Success;
01189 }
01190
01191
01192
01193
01194
01195 Status
01196 __method_static_OUT_float_cosh_math__IN_float(Database *_db, FEMethod_C *_m, const double arg1, double &retarg)
01197 {
01198 retarg = cosh(arg1);
01199 return Success;
01200 }
01201
01202
01203
01204
01205
01206 Status
01207 __method_static_OUT_float_sinh_math__IN_float(Database *_db, FEMethod_C *_m, const double arg1, double &retarg)
01208 {
01209 retarg = sinh(arg1);
01210 return Success;
01211 }
01212
01213
01214
01215
01216
01217 Status
01218 __method_static_OUT_float_tanh_math__IN_float(Database *_db, FEMethod_C *_m, const double arg1, double &retarg)
01219 {
01220 retarg = tanh(arg1);
01221 return Success;
01222 }
01223
01224
01225
01226
01227
01228 Status
01229 __method_static_OUT_float_exp_math__IN_float(Database *_db, FEMethod_C *_m, const double arg1, double &retarg)
01230 {
01231 retarg = exp(arg1);
01232 return Success;
01233 }
01234
01235
01236
01237
01238
01239 Status
01240 __method_static_OUT_float_log_math__IN_float(Database *_db, FEMethod_C *_m, const double arg1, double &retarg)
01241 {
01242 retarg = log(arg1);
01243 return Success;
01244 }
01245
01246
01247
01248
01249
01250 Status
01251 __method_static_OUT_float_log10_math__IN_float(Database *_db, FEMethod_C *_m, const double arg1, double &retarg)
01252 {
01253 retarg = log10(arg1);
01254 return Success;
01255 }
01256
01257
01258
01259
01260
01261 Status
01262 __method_static_OUT_float_pow_math__IN_float__IN_float(Database *_db, FEMethod_C *_m, const double arg1, const double arg2, double &retarg)
01263 {
01264 retarg = pow(arg1, arg2);
01265 return Success;
01266 }
01267
01268
01269
01270
01271
01272 Status
01273 __method_static_OUT_float_sqrt_math__IN_float(Database *_db, FEMethod_C *_m, const double arg1, double &retarg)
01274 {
01275 retarg = sqrt(arg1);
01276 return Success;
01277 }
01278
01279
01280
01281
01282
01283 Status
01284 __method_static_OUT_float_ceil_math__IN_float(Database *_db, FEMethod_C *_m, const double arg1, double &retarg)
01285 {
01286 retarg = ceil(arg1);
01287 return Success;
01288 }
01289
01290
01291
01292
01293
01294 Status
01295 __method_static_OUT_float_fabs_math__IN_float(Database *_db, FEMethod_C *_m, const double arg1, double &retarg)
01296 {
01297 retarg = fabs(arg1);
01298 return Success;
01299 }
01300
01301
01302
01303
01304
01305 Status
01306 __method_static_OUT_float_floor_math__IN_float(Database *_db, FEMethod_C *_m, const double arg1, double &retarg)
01307 {
01308 retarg = floor(arg1);
01309 return Success;
01310 }
01311
01312
01313
01314
01315
01316 Status
01317 __method_static_OUT_float_fmod_math__IN_float__IN_float(Database *_db, FEMethod_C *_m, const double arg1, const double arg2, double &retarg)
01318 {
01319 retarg = fmod(arg1, arg2);
01320 return Success;
01321 }
01322
01323
01324
01325
01326
01327 Status
01328 __method_static_OUT_float_erf_math__IN_float(Database *_db, FEMethod_C *_m, const double arg1, double &retarg)
01329 {
01330 retarg = erf(arg1);
01331 return Success;
01332 }
01333
01334
01335
01336
01337
01338 Status
01339 __method_static_OUT_float_erfc_math__IN_float(Database *_db, FEMethod_C *_m, const double arg1, double &retarg)
01340 {
01341 retarg = erfc(arg1);
01342 return Success;
01343 }
01344
01345
01346
01347
01348
01349 Status
01350 __method_static_OUT_float_gamma_math__IN_float(Database *_db, FEMethod_C *_m, const double arg1, double &retarg)
01351 {
01352 retarg = gamma(arg1);
01353 return Success;
01354 }
01355
01356
01357
01358
01359
01360 Status
01361 __method_static_OUT_float_hypot_math__IN_float__IN_float(Database *_db, FEMethod_C *_m, const double arg1, const double arg2, double &retarg)
01362 {
01363 retarg = hypot(arg1, arg2);
01364 return Success;
01365 }
01366
01367
01368
01369
01370
01371 Status
01372 __method_static_OUT_int32_isnan_math__IN_float(Database *_db, FEMethod_C *_m, const double arg1, eyedblib::int32 &retarg)
01373 {
01374 retarg = eyedblib::eyedb_isnan(arg1);
01375 return Success;
01376 }
01377
01378
01379
01380
01381
01382 Status
01383 __method_static_OUT_float_j0_math__IN_float(Database *_db, FEMethod_C *_m, const double arg1, double &retarg)
01384 {
01385 retarg = j0(arg1);
01386 return Success;
01387 }
01388
01389
01390
01391
01392
01393 Status
01394 __method_static_OUT_float_j1_math__IN_float(Database *_db, FEMethod_C *_m, const double arg1, double &retarg)
01395 {
01396 retarg = j1(arg1);
01397 return Success;
01398 }
01399
01400
01401
01402
01403
01404 Status
01405 __method_static_OUT_float_jn_math__IN_int32__IN_float(Database *_db, FEMethod_C *_m, const eyedblib::int32 arg1, const double arg2, double &retarg)
01406 {
01407 retarg = jn(arg1, arg2);
01408 return Success;
01409 }
01410
01411
01412
01413
01414
01415 Status
01416 __method_static_OUT_float_lgamma_math__IN_float(Database *_db, FEMethod_C *_m, const double arg1, double &retarg)
01417 {
01418 retarg = lgamma(arg1);
01419 return Success;
01420 }
01421
01422
01423
01424
01425
01426 Status
01427 __method_static_OUT_float_y0_math__IN_float(Database *_db, FEMethod_C *_m, const double arg1, double &retarg)
01428 {
01429 retarg = y0(arg1);
01430 return Success;
01431 }
01432
01433
01434
01435
01436
01437 Status
01438 __method_static_OUT_float_y1_math__IN_float(Database *_db, FEMethod_C *_m, const double arg1, double &retarg)
01439 {
01440 retarg = y1(arg1);
01441 return Success;
01442 }
01443
01444
01445
01446
01447
01448 Status
01449 __method_static_OUT_float_yn_math__IN_int32__IN_float(Database *_db, FEMethod_C *_m, const eyedblib::int32 arg1, const double arg2, double &retarg)
01450 {
01451 retarg = yn(arg1, arg2);
01452 return Success;
01453 }
01454
01455
01456
01457
01458
01459 Status
01460 __method_static_OUT_float_acosh_math__IN_float(Database *_db, FEMethod_C *_m, const double arg1, double &retarg)
01461 {
01462 retarg = acosh(arg1);
01463 return Success;
01464 }
01465
01466
01467
01468
01469
01470 Status
01471 __method_static_OUT_float_asinh_math__IN_float(Database *_db, FEMethod_C *_m, const double arg1, double &retarg)
01472 {
01473 retarg = asinh(arg1);
01474 return Success;
01475 }
01476
01477
01478
01479
01480
01481 Status
01482 __method_static_OUT_float_atanh_math__IN_float(Database *_db, FEMethod_C *_m, const double arg1, double &retarg)
01483 {
01484 retarg = atanh(arg1);
01485 return Success;
01486 }
01487
01488
01489
01490
01491
01492 Status
01493 __method_static_OUT_float_cbrt_math__IN_float(Database *_db, FEMethod_C *_m, const double arg1, double &retarg)
01494 {
01495 retarg = cbrt(arg1);
01496 return Success;
01497 }
01498
01499
01500
01501
01502
01503 Status
01504 __method_static_OUT_float_logb_math__IN_float(Database *_db, FEMethod_C *_m, const double arg1, double &retarg)
01505 {
01506 retarg = logb(arg1);
01507 return Success;
01508 }
01509
01510
01511
01512
01513
01514 Status
01515 __method_static_OUT_float_nextafter_math__IN_float__IN_float(Database *_db, FEMethod_C *_m, const double arg1, const double arg2, double &retarg)
01516 {
01517 retarg = nextafter(arg1, arg2);
01518 return Success;
01519 }
01520
01521
01522
01523
01524
01525 Status
01526 __method_static_OUT_float_remainder_math__IN_float__IN_float(Database *_db, FEMethod_C *_m, const double arg1, const double arg2, double &retarg)
01527 {
01528 retarg = remainder(arg1, arg2);
01529 return Success;
01530 }
01531
01532
01533
01534
01535
01536 Status
01537 __method_static_OUT_float_scalb_math__IN_float__IN_float(Database *_db, FEMethod_C *_m, const double arg1, const double arg2, double &retarg)
01538 {
01539 retarg = scalb(arg1, arg2);
01540 return Success;
01541 }
01542
01543
01544
01545
01546
01547 Status
01548 __method_static_OUT_float_expm1_math__IN_float(Database *_db, FEMethod_C *_m, const double arg1, double &retarg)
01549 {
01550 retarg = expm1(arg1);
01551 return Success;
01552 }
01553
01554
01555
01556
01557
01558 Status
01559 __method_static_OUT_int32_ilogb_math__IN_float(Database *_db, FEMethod_C *_m, const double arg1, eyedblib::int32 &retarg)
01560 {
01561 retarg = ilogb(arg1);
01562 return Success;
01563 }
01564
01565
01566
01567
01568
01569 Status
01570 __method_static_OUT_float_log1p_math__IN_float(Database *_db, FEMethod_C *_m, const double arg1, double &retarg)
01571 {
01572 retarg = log1p(arg1);
01573 return Success;
01574 }
01575
01576
01577
01578
01579
01580 Status
01581 __method_static_OUT_float_rint_math__IN_float(Database *_db, FEMethod_C *_m, const double arg1, double &retarg)
01582 {
01583 retarg = rint(arg1);
01584 return Success;
01585 }
01586
01587
01588
01589
01590
01591 Status
01592 __method__OUT_dataspace_REF__getDefaultInstanceDataspace_class(Database *_db, FEMethod_C *_m, Object *_o, OqlCtbDataspace * &rdsp)
01593 {
01594
01595 Class *cls = (Class *)_o;
01596 const Dataspace *dataspace;
01597 Status s = cls->getDefaultInstanceDataspace(dataspace);
01598 if (s)
01599 return s;
01600
01601 rdsp = makeDataspace(_db, dataspace);
01602 return Success;
01603 }
01604
01605
01606
01607
01608
01609 Status
01610 __method__OUT_void_setDefaultInstanceDataspace_class__IN_dataspace_REF_(Database *_db, FEMethod_C *_m, Object *_o, OqlCtbDataspace * dsp)
01611 {
01612 Class *cls = (Class *)_o;
01613
01614 Status s = cls->setDefaultInstanceDataspace(dsp->xdataspace);
01615 if (s)
01616 return s;
01617
01618 return Success;
01619 }
01620
01621
01622
01623
01624
01625 Status
01626 __method__OUT_void_moveInstances_class__IN_dataspace_REF_(Database *_db, FEMethod_C *_m, Object *_o, OqlCtbDataspace * dsp)
01627 {
01628 Class *cls = (Class *)_o;
01629
01630 Status s = cls->moveInstances(dsp->xdataspace);
01631 if (s)
01632 return s;
01633
01634 return Success;
01635 }
01636
01637
01638
01639
01640
01641 Status
01642 __method__OUT_int32_getCount_index(Database *_db, FEMethod_C *_m, Object *_o, eyedblib::int32 &retarg)
01643 {
01644 Index *idx = (Index *)_o;
01645 Status s = Attribute::openMultiIndexRealize(_db, idx);
01646 if (s) return s;
01647 retarg = idx->idx->getCount();
01648 return Success;
01649 }
01650
01651 static Status
01652 indexGetStats(Database *_db, Object *_o, Bool full, char * &retarg)
01653 {
01654 std::string stats;
01655 Index *idx = (Index *)_o;
01656 Status s = idx->getStats(stats, True, full);
01657 if (s) return s;
01658
01659 retarg = strdup((std::string("Index: '") + idx->getAttrpath() + "';\n" +
01660 "Oid: " + idx->getOid().toString() + ";\n" + stats).c_str());
01661 return Success;
01662 }
01663
01664
01665
01666
01667
01668 Status
01669 __method__OUT_string_getStats_index(Database *_db, FEMethod_C *_m, Object *_o, char * &retarg)
01670 {
01671 return indexGetStats(_db, _o, False, retarg);
01672 }
01673
01674
01675
01676
01677
01678 Status
01679 __method__OUT_string_getStats_index__IN_bool(Database *_db, FEMethod_C *_m, Object *_o, const Bool full, char * &retarg)
01680 {
01681 return indexGetStats(_db, _o, full, retarg);
01682 }
01683
01684
01685
01686
01687
01688 Status
01689 __method__OUT_string_getImplementation_index__IN_bool(Database *_db, FEMethod_C *_m, Object *_o, const Bool local, char * &retarg)
01690 {
01691 Index *idx = (Index *)_o;
01692 IndexImpl *idximpl;
01693 Status s = idx->getImplementation(idximpl, local);
01694 if (s) return s;
01695 retarg = strdup(idximpl->toString().c_str());
01696 if (idximpl)
01697 idximpl->release();
01698 return Success;
01699 }
01700
01701
01702
01703
01704
01705 Status
01706 __method__OUT_dataspace_REF__getDefaultDataspace_index(Database *_db, FEMethod_C *_m, Object *_o, OqlCtbDataspace * &rdsp)
01707 {
01708 Index *idx = (Index *)_o;
01709 const Dataspace *dataspace;
01710 Status s = idx->getDefaultDataspace(dataspace);
01711 if (s)
01712 return s;
01713
01714 rdsp = makeDataspace(_db, dataspace);
01715 return Success;
01716 }
01717
01718
01719
01720
01721
01722 Status
01723 __method__OUT_void_setDefaultDataspace_index__IN_dataspace_REF_(Database *_db, FEMethod_C *_m, Object *_o, OqlCtbDataspace * dsp)
01724 {
01725 Index *idx = (Index *)_o;
01726 return idx->setDefaultDataspace(dsp->xdataspace);
01727 }
01728
01729
01730
01731
01732
01733 Status
01734 __method__OUT_void_move_index__IN_dataspace_REF_(Database *_db, FEMethod_C *_m, Object *_o, OqlCtbDataspace * dsp)
01735 {
01736 Index *idx = (Index *)_o;
01737 return idx->move(dsp->xdataspace);
01738 }
01739
01740
01741
01742
01743
01744 static Status
01745 getIndexImpl(Database *db, int idxtype, const char *hints,
01746 IndexImpl *&idximpl)
01747 {
01748 IndexImpl::Type type;
01749 if (idxtype == HashIndexType)
01750 type = IndexImpl::Hash;
01751 else if (idxtype == BTreeIndexType)
01752 type = IndexImpl::BTree;
01753 else
01754 return Exception::make(IDB_ERROR, "invalid index type: expected "
01755 "HASH_INDEX_TYPE (%d) or BTREE_INDEX_TYPE (%d)",
01756 HashIndexType, BTreeIndexType);
01757 return IndexImpl::make(db, type, hints, idximpl);
01758 }
01759
01760 Status
01761 __method__OUT_string_simulate_index__IN_int32__IN_string__IN_bool(Database *_db, FEMethod_C *_m, Object *_o, const eyedblib::int32 idxtype, const char * hints, const Bool full, char * &retarg)
01762 {
01763 Status s;
01764 Index *idx = (Index *)_o;
01765
01766 IndexImpl *idximpl;
01767 s = getIndexImpl(_db, idxtype, hints, idximpl);
01768 if (s) return s;
01769 std::string stats;
01770 s = idx->simulate(*idximpl, stats, True, full);
01771 if (s) return s;
01772 retarg = strdup(stats.c_str());
01773 return Success;
01774 }
01775
01776
01777
01778
01779
01780 Status
01781 __method__OUT_void_reimplement_index__IN_string(Database *_db, FEMethod_C *_m, Object *_o, const char * hints)
01782 {
01783 Status s;
01784 Index *idx = (Index *)_o;
01785
01786 IndexImpl *idximpl;
01787 s = getIndexImpl(_db, idx->asHashIndex() ? HashIndexType :
01788 BTreeIndexType, hints, idximpl);
01789 if (s) return s;
01790
01791 idx->setImplementation(idximpl);
01792 if (idximpl)
01793 idximpl->release();
01794 return idx->store();
01795 }
01796
01797
01798
01799
01800
01801 Status
01802 __method__OUT_oid_reimplement_index__IN_int32__IN_string(Database *_db, FEMethod_C *_m, Object *_o, const eyedblib::int32 idxtype, const char * hints, Oid &retarg)
01803 {
01804 Status s;
01805 Index *idx = (Index *)_o;
01806
01807 IndexImpl *idximpl;
01808 s = getIndexImpl(_db, idxtype, hints, idximpl);
01809 if (s) return s;
01810 Index *idxn;
01811 s = idx->reimplement(*idximpl, idxn);
01812 if (s) return s;
01813 retarg = idxn->getOid();
01814 return Success;
01815 }
01816
01817
01818
01819
01820
01821 Status
01822 __method__OUT_int32_getCount_collection(Database *_db, FEMethod_C *_m, Object *_o, eyedblib::int32 &retarg)
01823 {
01824 retarg = dynamic_cast<Collection *>(_o)->getCount();
01825 return Success;
01826 }
01827
01828 static Status
01829 collectionGetImplStats(Database *_db, Object *_o, Bool full, char * &retarg)
01830 {
01831 Collection *coll = (Collection *)_o;
01832 if (coll->asCollArray()) {
01833 std::string stats1, stats2;
01834 Status s = coll->asCollArray()->getImplStats(stats1, stats2, True, full);
01835 if (s) return s;
01836
01837 retarg = strdup
01838 ((std::string("Collection: '") + coll->getName() + "';\n" +
01839 "Oid: " + coll->getOidC().toString() + ";\n" +
01840 "First Index Statistics:\n" + stats1 + "\n" +
01841 "Second Index Statistics:\n" + stats2).c_str());
01842
01843 return Success;
01844 }
01845
01846 std::string stats;
01847 Status s = coll->getImplStats(stats, True, full);
01848 if (s) return s;
01849
01850 retarg = strdup
01851 ((std::string("Collection: '") + coll->getName() + "';\n" +
01852 "Oid: " + coll->getOidC().toString() + ";\n" + stats).c_str());
01853
01854 return Success;
01855 }
01856
01857
01858
01859
01860
01861 Status
01862 __method__OUT_string_getImplStats_collection(Database *_db, FEMethod_C *_m, Object *_o, char * &retarg)
01863 {
01864 return collectionGetImplStats(_db, _o, False, retarg);
01865 }
01866
01867
01868
01869
01870
01871 Status
01872 __method__OUT_bool_isLiteral_collection(Database *_db, FEMethod_C *_m, Object *_o, Bool &retarg)
01873 {
01874 retarg = dynamic_cast<Collection *>(_o)->isLiteral();
01875 return Success;
01876 }
01877
01878
01879
01880
01881
01882 Status
01883 __method__OUT_bool_isPureLiteral_collection(eyedb::Database *_db, eyedb::FEMethod_C *_m, eyedb::Object *_o, eyedb::Bool &retarg)
01884 {
01885
01886 retarg = dynamic_cast<Collection *>(_o)->isPureLiteral();
01887 return eyedb::Success;
01888 }
01889
01890
01891
01892
01893
01894 Status
01895 __method__OUT_bool_isLiteralObject_collection(eyedb::Database *_db, eyedb::FEMethod_C *_m, eyedb::Object *_o, eyedb::Bool &retarg)
01896 {
01897 retarg = dynamic_cast<Collection *>(_o)->isLiteralObject();
01898 return eyedb::Success;
01899 }
01900
01901
01902
01903
01904
01905 Status
01906 __method__OUT_void_setLiteralObject_collection(eyedb::Database *_db, eyedb::FEMethod_C *_m, eyedb::Object *_o)
01907 {
01908 return dynamic_cast<Collection *>(_o)->setLiteralObject(true);
01909 }
01910
01911
01912
01913
01914
01915 Status
01916 __method__OUT_oid_getLiteralOid_collection(Database *_db, FEMethod_C *_m, Object *_o, Oid &retarg)
01917 {
01918 if (dynamic_cast<Collection *>(_o)->isLiteral())
01919 retarg = dynamic_cast<Collection *>(_o)->getOidC();
01920 return Success;
01921 }
01922
01923
01924
01925
01926
01927 Status
01928 __method__OUT_string_getImplStats_collection__IN_bool(Database *_db, FEMethod_C *_m, Object *_o, const Bool full, char * &retarg)
01929 {
01930 return collectionGetImplStats(_db, _o, full, retarg);
01931 }
01932
01933
01934
01935
01936
01937 Status
01938 __method__OUT_dataspace_REF__getDefaultDataspace_collection(Database *_db, FEMethod_C *_m, Object *_o, OqlCtbDataspace * &rdsp)
01939 {
01940 Collection *coll = (Collection *)_o;
01941 const Dataspace *dataspace;
01942 Status s = coll->getDefaultDataspace(dataspace);
01943 if (s)
01944 return s;
01945
01946 rdsp = makeDataspace(_db, dataspace);
01947 return Success;
01948 }
01949
01950
01951
01952
01953
01954 Status
01955 __method__OUT_void_setDefaultDataspace_collection__IN_dataspace_REF_(Database *_db, FEMethod_C *_m, Object *_o, OqlCtbDataspace * dsp)
01956 {
01957 Collection *coll = (Collection *)_o;
01958
01959 Status s = coll->setDefaultDataspace(dsp->xdataspace);
01960 if (s)
01961 return s;
01962
01963 return Success;
01964 }
01965
01966
01967
01968
01969
01970 Status
01971 __method__OUT_void_moveElements_collection__IN_dataspace_REF_(Database *_db, FEMethod_C *_m, Object *_o, OqlCtbDataspace * dsp)
01972 {
01973 Collection *coll = (Collection *)_o;
01974
01975 Status s = coll->moveElements(dsp->xdataspace);
01976 if (s)
01977 return s;
01978
01979 return Success;
01980 }
01981
01982
01983
01984
01985
01986
01987 Status
01988 __method__OUT_string_getImplementation_collection__IN_bool(Database *_db, FEMethod_C *_m, Object *_o, const Bool local, char * &retarg)
01989 {
01990 Collection *coll = (Collection *)_o;
01991 CollImpl *collimpl;
01992 Status s = coll->getImplementation(collimpl, local);
01993 if (s) return s;
01994 if (collimpl->getIndexImpl()) {
01995 retarg = strdup(collimpl->getIndexImpl()->toString().c_str());
01996 }
01997 else if (collimpl->getType() == CollImpl::NoIndex) {
01998 retarg = strdup("noindex");
01999 }
02000 else {
02001 retarg = strdup("<unknown>");
02002 }
02003 return Success;
02004 }
02005
02006
02007
02008
02009
02010 Status
02011 __method__OUT_string_simulate_collection__IN_int32__IN_string__IN_bool(Database *_db, FEMethod_C *_m, Object *_o, const eyedblib::int32 idxtype, const char * hints, const Bool full, char * &retarg)
02012 {
02013 Status s;
02014 Collection *coll = (Collection *)_o;
02015 IndexImpl *idximpl = 0;
02016
02017 s = getIndexImpl(_db, idxtype, hints, idximpl);
02018 if (s) return s;
02019
02020 std::string stats;
02021 CollImpl *collimpl = new CollImpl((CollImpl::Type)idxtype, idximpl);
02022 s = coll->simulate(*collimpl, stats, True, full);
02023 if (s) return s;
02024 collimpl->release();
02025 idximpl->release();
02026 retarg = strdup(stats.c_str());
02027 return Success;
02028 }
02029
02030
02031
02032
02033
02034 Status
02035 __method__OUT_void_reimplement_collection__IN_int32__IN_string(Database *_db, FEMethod_C *_m, Object *_o, const eyedblib::int32 idxtype, const char * hints)
02036 {
02037 Status s;
02038 Collection *coll = (Collection *)_o;
02039
02040 IndexImpl *idximpl = 0;
02041 if (idxtype == CollImpl::HashIndex || idxtype == CollImpl::BTreeIndex) {
02042 s = getIndexImpl(_db, idxtype, hints, idximpl);
02043 if (s) return s;
02044 }
02045
02046 CollImpl *collimpl = new CollImpl((CollImpl::Type)idxtype, idximpl);
02047 coll->setImplementation(collimpl);
02048
02049 if (idximpl) {
02050 idximpl->release();
02051 }
02052
02053 collimpl->release();
02054
02055 if (coll->isLiteral()) {
02056 return coll->getMasterObject(true)->store();
02057 }
02058 return coll->store();
02059 }
02060
02061
02062
02063
02064
02065 Status
02066 __method__OUT_string_getName_collection(eyedb::Database *_db, eyedb::FEMethod_C *_m, eyedb::Object *_o, char * &retarg)
02067 {
02068 retarg = Argument::dup(dynamic_cast<Collection *>(_o)->getName());
02069 return eyedb::Success;
02070 }
02071
02072
02073
02074
02075
02076 Status
02077 __method__OUT_void_setName_collection__IN_string(eyedb::Database *_db, eyedb::FEMethod_C *_m, eyedb::Object *_o, const char * name)
02078 {
02079 Collection* coll = dynamic_cast<Collection *>(_o);
02080 coll->setName(name);
02081 return coll->store();
02082 }
02083
02084
02085
02086
02087
02088 Status
02089 __method__OUT_bool_isIn_collection__IN_oid(eyedb::Database *_db, eyedb::FEMethod_C *_m, eyedb::Object *_o, const Oid obj, eyedb::Bool &retarg)
02090 {
02091 return dynamic_cast<Collection *>(_o)->isIn(obj, retarg);
02092 }
02093
02094
02095
02096
02097
02098
02099
02100 Status
02101 __method__OUT_oid_ARRAY__getElements_collection__IN_oid(eyedb::Database *_db, eyedb::FEMethod_C *_m, eyedb::Object *_o, const Oid obj, Oid * &retarg, int &retarg_cnt)
02102 {
02103 return Exception::make(IDB_ERROR, "oid[] collection::getElements(in oid) not yet implemented");
02104 }
02105
02106
02107
02108
02109
02110 Status
02111 __method__OUT_oid_retrieveAt_array__IN_int32(eyedb::Database *_db, eyedb::FEMethod_C *_m, eyedb::Object *_o, const eyedblib::int32 arg1, Oid &retarg)
02112 {
02113 return Exception::make(IDB_ERROR, "oid array::retrieveAt(in int32) not yet implemented");
02114 }
02115
02116
02117
02118
02119
02120
02121 Status
02122 __method__OUT_void_addTo_bag__IN_oid(eyedb::Database *_db, eyedb::FEMethod_C *_m, eyedb::Object *_o, const Oid obj)
02123 {
02124 return Exception::make(IDB_ERROR, "void bag::addTo(in oid) not yet implemented");
02125 }
02126
02127
02128
02129
02130
02131 Status
02132 __method__OUT_void_suppress_bag__IN_oid(eyedb::Database *_db, eyedb::FEMethod_C *_m, eyedb::Object *_o, const Oid obj)
02133 {
02134 return Exception::make(IDB_ERROR, "void bag::suppress(in oid) not yet implemented");
02135 }
02136
02137
02138
02139
02140
02141 Status
02142 __method__OUT_void_setInAt_array__IN_int32__IN_oid(eyedb::Database *_db, eyedb::FEMethod_C *_m, eyedb::Object *_o, const eyedblib::int32 pos, const Oid obj)
02143 {
02144 return Exception::make(IDB_ERROR, "void array::setInAt(in int32, in oid) not yet implemented");
02145 }
02146
02147
02148
02149
02150
02151 Status
02152 __method__OUT_void_append_array__IN_oid(eyedb::Database *_db, eyedb::FEMethod_C *_m, eyedb::Object *_o, const Oid obj)
02153 {
02154 return Exception::make(IDB_ERROR, "void array::append(in oid) not yet implemented");
02155 }
02156
02157
02158
02159
02160
02161 Status
02162 __method__OUT_void_suppressAt_array__IN_int32(eyedb::Database *_db, eyedb::FEMethod_C *_m, eyedb::Object *_o, const eyedblib::int32 arg1)
02163 {
02164 return Exception::make(IDB_ERROR, "void array::suppressAt(in int32) not yet implemented");
02165 }
02166
02167
02168
02169
02170
02171 Status
02172 __method__OUT_void_addTo_set__IN_oid(eyedb::Database *_db, eyedb::FEMethod_C *_m, eyedb::Object *_o, const Oid obj)
02173 {
02174 return Exception::make(IDB_ERROR, "void set::addTo(in oid) not yet implemented");
02175 }
02176
02177
02178
02179
02180
02181 Status
02182 __method__OUT_void_suppress_set__IN_oid(eyedb::Database *_db, eyedb::FEMethod_C *_m, eyedb::Object *_o, const Oid obj)
02183 {
02184 return Exception::make(IDB_ERROR, "void set::suppress(in oid) not yet implemented");
02185 }