mirror of
https://bitbucket.org/theswgsource/src-1.2.git
synced 2026-07-31 01:15:48 -04:00
newer standards prefer nullptr over NULL - this is most of them but there are others too
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
/* Bindable.h
|
||||
*
|
||||
* Defines classes based on built-in simple types that know how to bind themselves to
|
||||
* database queries and support null values.
|
||||
* database queries and support nullptr values.
|
||||
*
|
||||
* Each class supports the following functions:
|
||||
* bool isNull -- test whether the value is null
|
||||
* void setToNull -- set the value to null
|
||||
* getValue -- return the value (make sure you test for null before calling this. The results
|
||||
* are undefined if the Bindable is null.)
|
||||
* bool isNull -- test whether the value is nullptr
|
||||
* void setToNull -- set the value to nullptr
|
||||
* getValue -- return the value (make sure you test for nullptr before calling this. The results
|
||||
* are undefined if the Bindable is nullptr.)
|
||||
* setValue -- set the value
|
||||
*
|
||||
* ODBC version
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace DB {
|
||||
explicit Bindable(int _indicator);
|
||||
|
||||
/**
|
||||
* The size of the data, or -1 for NULL.
|
||||
* The size of the data, or -1 for nullptr.
|
||||
*/
|
||||
int indicator;
|
||||
};
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
namespace DB {
|
||||
|
||||
/** Represents a bool in C++, bound to a CHAR(1) column. The column can have the values 'Y' or 'N'.
|
||||
* TODO: use a boolean type in the database, if we can find one that allows NULL's and is fairly
|
||||
* TODO: use a boolean type in the database, if we can find one that allows nullptr's and is fairly
|
||||
* portable. (May not exist -- according to the docs, Oracle does not have a boolean datatype.)
|
||||
*/
|
||||
class BindableBool : public Bindable
|
||||
|
||||
@@ -133,11 +133,11 @@ namespace DB
|
||||
std::string getValueASCII() const;
|
||||
|
||||
/** Allocate a new string and copy the buffer to it. The caller takes responsibility
|
||||
for delete[]ing it later. (If the string is NULL, this returns a null pointer.)
|
||||
for delete[]ing it later. (If the string is nullptr, this returns a nullptr pointer.)
|
||||
*/
|
||||
char *makeCopyOfValue() const;
|
||||
|
||||
/** Set the value of the bindable string from another (null-terminated) string
|
||||
/** Set the value of the bindable string from another (nullptr-terminated) string
|
||||
|
||||
If the source buffer is too big, it FATAL's. Another alternative would be to have
|
||||
it truncate the string. Right now, it's better to FATAL to avoid hard-to-find bugs
|
||||
@@ -168,7 +168,7 @@ namespace DB
|
||||
|
||||
private:
|
||||
|
||||
char m_value[S+1]; // column of size S, plus one byte for a trailing null
|
||||
char m_value[S+1]; // column of size S, plus one byte for a trailing nullptr
|
||||
};
|
||||
|
||||
// ======================================================================
|
||||
@@ -206,7 +206,7 @@ namespace DB
|
||||
{
|
||||
if (isNull())
|
||||
{
|
||||
return strncpy(buffer,"\0",1); // in the database, a zero-length string and a NULL aren't really
|
||||
return strncpy(buffer,"\0",1); // in the database, a zero-length string and a nullptr aren't really
|
||||
// the same thing, but this is the closest we can do here.
|
||||
}
|
||||
return strncpy(buffer,m_value,(bufsize>(S+1))?(S+1):bufsize);
|
||||
@@ -259,7 +259,7 @@ namespace DB
|
||||
}
|
||||
FATAL((i==S+1) && (m_value[S]!='\0'),("Attempt to save string \"%s\" to the database. It is too long for the column.",buffer));
|
||||
indicator=i; // set indicator to actual length of string
|
||||
// m_value[S]='\0'; // guarantee null terminator -- uncomment if you remove the above FATAL
|
||||
// m_value[S]='\0'; // guarantee nullptr terminator -- uncomment if you remove the above FATAL
|
||||
}
|
||||
|
||||
template<int S>
|
||||
|
||||
@@ -143,7 +143,7 @@ namespace DB
|
||||
|
||||
private:
|
||||
|
||||
char m_value[S+1]; // column of size S, plus one byte for a trailing null
|
||||
char m_value[S+1]; // column of size S, plus one byte for a trailing nullptr
|
||||
};
|
||||
|
||||
// ======================================================================
|
||||
|
||||
@@ -33,9 +33,9 @@ namespace DB
|
||||
* Combines the values in this row with the values in newRow.
|
||||
*
|
||||
* For each column:
|
||||
* If the column is null in newRow, do nothing. (Leave the value
|
||||
* If the column is nullptr in newRow, do nothing. (Leave the value
|
||||
* in this row unchanged.)
|
||||
* If the column is not null in newRow, replace the value in this
|
||||
* If the column is not nullptr in newRow, replace the value in this
|
||||
* row with the value in newRow.
|
||||
*/
|
||||
virtual void combine(const DB::Row &newRow) =0;
|
||||
|
||||
@@ -29,7 +29,7 @@ using namespace DB;
|
||||
Mutex Server::ms_profileMutex;
|
||||
bool Server::ms_enableProfiling = false;
|
||||
bool Server::ms_enableVerboseMode = false;
|
||||
DB::Profiler *Server::ms_profiler = NULL;
|
||||
DB::Profiler *Server::ms_profiler = nullptr;
|
||||
int Server::ms_reconnectTime=0;
|
||||
int Server::ms_maxErrorCountBeforeDisconnect=5;
|
||||
int Server::ms_maxErrorCountBeforeBailout=10;
|
||||
@@ -51,7 +51,7 @@ Server::SesListElem::SesListElem (Session *_ses, SesListElem *_next) : ses (_ses
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
Server::Server(const char *_dsn, const char *_uid, const char *_pwd, bool useMemoryManager) :
|
||||
sessionList (NULL),
|
||||
sessionList (nullptr),
|
||||
sessionListLock(),
|
||||
m_useMemoryManager(useMemoryManager)
|
||||
{
|
||||
@@ -194,7 +194,7 @@ Session *Server::popSession()
|
||||
else
|
||||
{
|
||||
sessionListLock.leave();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ void Server::endProfiling()
|
||||
{
|
||||
ms_profileMutex.enter();
|
||||
delete ms_profiler;
|
||||
ms_profiler = NULL;
|
||||
ms_profiler = nullptr;
|
||||
ms_enableProfiling = false;
|
||||
ms_profileMutex.leave();
|
||||
}
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
// ======================================================================
|
||||
|
||||
/**
|
||||
* A unicode-string-compatible class that encodes a null value as a single space
|
||||
* A unicode-string-compatible class that encodes a nullptr value as a single space
|
||||
*/
|
||||
class NullEncodedStandardString
|
||||
{
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
// ======================================================================
|
||||
|
||||
/**
|
||||
* A unicode-string-compatible class that encodes a null value as a single space
|
||||
* A unicode-string-compatible class that encodes a nullptr value as a single space
|
||||
*/
|
||||
class NullEncodedUnicodeString
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user