mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Replace std::vector<unsigned char> with Blob
This commit is contained in:
@@ -207,11 +207,11 @@ int SqliteDatabase::getBinary(int colIndex,unsigned char* buf,int maxSize)
|
||||
return(size);
|
||||
}
|
||||
|
||||
std::vector<unsigned char> SqliteDatabase::getBinary(int colIndex)
|
||||
Blob SqliteDatabase::getBinary(int colIndex)
|
||||
{
|
||||
const unsigned char* blob = reinterpret_cast<const unsigned char*>(sqlite3_column_blob(mCurrentStmt, colIndex));
|
||||
size_t iSize = sqlite3_column_bytes(mCurrentStmt, colIndex);
|
||||
std::vector<unsigned char> vucResult;
|
||||
Blob vucResult;
|
||||
|
||||
vucResult.resize(iSize);
|
||||
std::copy(blob, blob+iSize, vucResult.begin());
|
||||
@@ -324,7 +324,7 @@ int SqliteStatement::bindStatic(int position, const void *data, int length)
|
||||
return sqlite3_bind_blob(statement, position, data, length, SQLITE_STATIC);
|
||||
}
|
||||
|
||||
int SqliteStatement::bindStatic(int position, const std::vector<unsigned char>& value)
|
||||
int SqliteStatement::bindStatic(int position, Blob const& value)
|
||||
{
|
||||
return sqlite3_bind_blob(statement, position, &value.front(), value.size(), SQLITE_STATIC);
|
||||
}
|
||||
@@ -359,10 +359,10 @@ const void* SqliteStatement::peekBlob(int column)
|
||||
return sqlite3_column_blob(statement, column);
|
||||
}
|
||||
|
||||
std::vector<unsigned char> SqliteStatement::getBlob(int column)
|
||||
Blob SqliteStatement::getBlob(int column)
|
||||
{
|
||||
int size = sqlite3_column_bytes(statement, column);
|
||||
std::vector<unsigned char> ret(size);
|
||||
Blob ret(size);
|
||||
memcpy(&(ret.front()), sqlite3_column_blob(statement, column), size);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
bool getBool(int colIndex);
|
||||
// returns amount stored in buf
|
||||
int getBinary(int colIndex,unsigned char* buf,int maxSize);
|
||||
std::vector<unsigned char> getBinary(int colIndex);
|
||||
Blob getBinary(int colIndex);
|
||||
uint64 getBigInt(int colIndex);
|
||||
|
||||
sqlite3* peekConnection() { return mConnection; }
|
||||
@@ -86,7 +86,7 @@ public:
|
||||
// positions start at 1
|
||||
int bind(int position, const void *data, int length);
|
||||
int bindStatic(int position, const void *data, int length);
|
||||
int bindStatic(int position, const std::vector<unsigned char>& value);
|
||||
int bindStatic(int position, Blob const& value);
|
||||
|
||||
int bind(int position, const std::string& value);
|
||||
int bindStatic(int position, const std::string& value);
|
||||
@@ -98,7 +98,7 @@ public:
|
||||
int size(int column);
|
||||
|
||||
const void* peekBlob(int column);
|
||||
std::vector<unsigned char> getBlob(int column);
|
||||
Blob getBlob(int column);
|
||||
|
||||
std::string getString(int column);
|
||||
const char* peekString(int column);
|
||||
|
||||
@@ -86,7 +86,7 @@ int Database::getBinary(const char* colName,unsigned char* buf,int maxSize)
|
||||
return(0);
|
||||
}
|
||||
|
||||
std::vector<unsigned char> Database::getBinary(const std::string& strColName)
|
||||
Blob Database::getBinary(const std::string& strColName)
|
||||
{
|
||||
int index;
|
||||
|
||||
@@ -95,7 +95,7 @@ std::vector<unsigned char> Database::getBinary(const std::string& strColName)
|
||||
return getBinary(index);
|
||||
}
|
||||
|
||||
return std::vector<unsigned char>();
|
||||
return Blob ();
|
||||
}
|
||||
|
||||
std::string Database::getStrBinary(const std::string& strColName)
|
||||
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
|
||||
// returns amount stored in buf
|
||||
int getBinary(const char* colName, unsigned char* buf, int maxSize);
|
||||
std::vector<unsigned char> getBinary(const std::string& strColName);
|
||||
Blob getBinary(const std::string& strColName);
|
||||
|
||||
uint64 getBigInt(const char* colName);
|
||||
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
virtual bool getBool(int colIndex)=0;
|
||||
virtual int getBinary(int colIndex,unsigned char* buf,int maxSize)=0;
|
||||
virtual uint64 getBigInt(int colIndex)=0;
|
||||
virtual std::vector<unsigned char> getBinary(int colIndex)=0;
|
||||
virtual Blob getBinary(int colIndex)=0;
|
||||
|
||||
// int getSingleDBValueInt(const char* sql);
|
||||
// float getSingleDBValueFloat(const char* sql);
|
||||
|
||||
Reference in New Issue
Block a user