1
0
Fork 0

some more cleanup

This commit is contained in:
Jan Steemann 2013-02-01 15:29:37 +01:00
parent eaf4166b3e
commit 6c64dbd105
4 changed files with 19 additions and 32 deletions

View File

@ -1210,30 +1210,6 @@ int TRI_FinishTransaction (TRI_transaction_t* const trx) {
return res;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief get the pointer to a collection after it has been initialised
////////////////////////////////////////////////////////////////////////////////
TRI_vocbase_col_t* TRI_GetCollectionTransaction (const TRI_transaction_t* const trx,
const TRI_transaction_cid_t cid) {
size_t i, n;
assert(trx->_status == TRI_TRANSACTION_RUNNING);
n = trx->_collections._length;
// process collections in forward order
for (i = 0; i < n; ++i) {
TRI_transaction_collection_t* collection;
collection = (TRI_transaction_collection_t*) TRI_AtVectorPointer(&trx->_collections, i);
if (cid == collection->_cid) {
return collection->_collection;
}
}
return NULL;
}
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////

View File

@ -423,13 +423,6 @@ int TRI_AbortTransaction (TRI_transaction_t* const);
int TRI_FinishTransaction (TRI_transaction_t* const);
////////////////////////////////////////////////////////////////////////////////
/// @brief get the pointer to a collection after it has been initialised
////////////////////////////////////////////////////////////////////////////////
struct TRI_vocbase_col_s* TRI_GetCollectionTransaction (const TRI_transaction_t* const,
const TRI_transaction_cid_t);
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////

View File

@ -91,6 +91,12 @@ var ArangoStatement = require("org/arangodb/arango-statement").ArangoStatement;
/// @{
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief index id regex
////////////////////////////////////////////////////////////////////////////////
ArangoDatabase.indexRegex = /^([a-zA-Z0-9\-_]+)\/([0-9]+)$/;
////////////////////////////////////////////////////////////////////////////////
/// @brief append the waitForSync parameter to a URL
////////////////////////////////////////////////////////////////////////////////
@ -152,6 +158,18 @@ ArangoDatabase.prototype._documenturl = function (id, expectedName) {
////////////////////////////////////////////////////////////////////////////////
ArangoDatabase.prototype._indexurl = function (id, expectedName) {
if (typeof id === "string") {
var pa = ArangoDatabase.indexRegex.exec(id);
if (pa === null && expectedName !== undefined) {
id = expectedName + "/" + id;
}
}
else if (typeof id === "number" && expectedName !== undefined) {
// stringify a numeric id
id = expectedName + "/" + id;
}
var s = id.split("/");
if (s.length !== 2) {

View File

@ -232,7 +232,7 @@ namespace triagens {
_writeBuffer.appendText("User-Agent: VOC-Client/1.0\r\n");
// do basic authorization
if (_pathToBasicAuth.size() > 0) {
if (! _pathToBasicAuth.empty()) {
string foundPrefix;
string foundValue;
std::vector< std::pair<std::string, std::string> >::iterator i = _pathToBasicAuth.begin();