Definition at line 68 of file credit.h.
typedef std::auto_ptr<PersCredit> OSB_LIB::PersCredit::AutoPtr |
Short-cut for an auto pointer.
For details see quality manual, implementation patterns: Virtual copy construction.
Reimplemented from OSB_LIB::PersProductItem.
OSB_LIB::PersCredit::PersCredit | ( | const Money & | credit | ) | [inline, explicit] |
bool OSB_LIB::PersCredit::add | ( | const OSB_DB::Session & | session, | |
const Money & | money, | |||
long | objVs, | |||
bool | uptodate | |||
) |
Top up the credit and update it in the database.
This function based on the same currency code, otherwise it will throw OsbException.
The caller should read data from database and then lock it before using this function.
session | Oracle session. | |
money | Money to be added. | |
objVs | Old Object version. It will be updated to the new one. | |
uptodate | Return true if the object version is uptodate. |
OsbException | It throws OsbException(169) if currency code mismatch currency code. |
virtual bool OSB_LIB::PersCredit::canConfig | ( | ) | const [virtual] |
AutoPtr OSB_LIB::PersCredit::clone | ( | ) | const |
Virtual copy construction.
For details see quality manual, implementation patterns.
Reimplemented from OSB_LIB::PersProductItem.
PersProductItem* OSB_LIB::PersCredit::clone_ | ( | ) | const [private, virtual] |
Internal virtual copy constructor.
For details see quality manual, implementation patterns.
Implements OSB_LIB::PersProductItem.
const Money& OSB_LIB::PersCredit::credit | ( | ) | const [inline] |
bool OSB_LIB::PersCredit::deduct | ( | const OSB_DB::Session & | session, | |
const Money & | money, | |||
long | objVs, | |||
bool | uptodate | |||
) |
Deduct the credit and update it in the database.
This function based on the same currency code, otherwise it will throw OsbException.
The caller should read data from database and then lock it before using this function.
session | Oracle session. | |
money | Money to be deducted. | |
objVs | Old Object version. It will be updated to the new one. | |
uptodate | Return true if the object version is uptodate. |
OsbException | It throws OsbException(169) if currency code mismatch currency code. |
bool OSB_LIB::PersCredit::delSpecific | ( | const OSB_DB::Session & | session | ) | [private, virtual] |
Delete a personalized credit from the database.
session | Database session to use, transactions are not commited. |
Implements OSB_LIB::PersProductItem.
bool OSB_LIB::PersCredit::insSpecific | ( | const OSB_DB::Session & | session | ) | [private, virtual] |
Insert a personalized credit to the database.
session | Database session to use, transactions are not commited. |
Implements OSB_LIB::PersProductItem.
bool OSB_LIB::PersCredit::lock | ( | const OSB_DB::Session & | session | ) |
Lock the credit in the database.
Lock() does not commit. The lock applies to all sessions. If the locker commits, it can also be used across multiple transactions. In this case, any database session can later release the lock.
If the locker does not commit, all other sessions see the lock as held.
In the meantime, only the session that set the lock can release it by calling unlock(). The effect of this unlock is only visible for this session (i.e., within the same transaction, it can subsequently set the lock again).
In any case, the resource is only seen as released from another session after the transaction which unlocked it is completed.
There is no blocking mode for lock(). It always works in non-blocking mode.
session | Oracle session. |
virtual std::string OSB_LIB::PersCredit::personalization | ( | ) | const [virtual] |
Personalization of pers credit.
Provide the personalization of a CreditItem as string. The content is the credit.
Implements OSB_LIB::PersProductItem.
bool OSB_LIB::PersCredit::readSpecific | ( | const OSB_DB::Session & | session | ) | [private, virtual] |
Read the specific credit from the database.
session | Oracle session. |
Implements OSB_LIB::PersProductItem.
Type OSB_LIB::PersCredit::type | ( | ) | const [virtual] |
bool OSB_LIB::PersCredit::unlock | ( | const OSB_DB::Session & | session, | |
bool | nowait | |||
) |
Unlock the credit in the database.
Unlock() does not commit. However, other sessions see the lock as released only after the transaction which unlocked it is completed.
Calling unlock() for a lock which is not held has no effect.
If unlock() is called in blocking mode from a session other than that which acquired the lock and before the locker commits, then unlock will block until the locker completes its transaction. If unlock() is called in non-blocking mode, it returns false in this case.
session | Oracle session. | |
nowait | If the argument is false (blocking mode) then unlock() waits for the database resource to be released if it is busy. If it is true (non-blocking mode), unlock() immediately returns false if the lock could not be released because the database resource was busy. |
bool OSB_LIB::PersCredit::updSpecific | ( | const OSB_DB::Session & | session | ) | [private, virtual] |
Update a personalized credit in the database.
session | Database session to use, transactions are not commited. |
Implements OSB_LIB::PersProductItem.
friend class OSB_DB::PersCreditGw [friend] |
Money OSB_LIB::PersCredit::credit_ [private] |
const Type OSB_LIB::PersCredit::type_ [static] |