Darryl Pogue
13 years ago
9 changed files with 0 additions and 2257 deletions
@ -1,51 +0,0 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools |
||||
Copyright (C) 2011 Cyan Worlds, Inc. |
||||
|
||||
This program is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
This program is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU General Public License |
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7 |
||||
|
||||
If you modify this Program, or any covered work, by linking or |
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
||||
(or a modified version of those libraries), |
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
||||
licensors of this Program grant you additional |
||||
permission to convey the resulting work. Corresponding Source for a |
||||
non-source form of such a combination shall include the source code for |
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
||||
work. |
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
||||
or by snail mail at: |
||||
Cyan Worlds, Inc. |
||||
14617 N Newport Hwy |
||||
Mead, WA 99021 |
||||
|
||||
*==LICENSE==*/ |
||||
/*****************************************************************************
|
||||
* |
||||
* $/Plasma20/Sources/Plasma/NucleusLib/pnSqlLib/Intern.h |
||||
*
|
||||
***/ |
||||
|
||||
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNSQLLIB_INTERN_H |
||||
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnSqlLib/Intern.h included more than once" |
||||
#endif |
||||
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNSQLLIB_INTERN_H |
@ -1,62 +0,0 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools |
||||
Copyright (C) 2011 Cyan Worlds, Inc. |
||||
|
||||
This program is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
This program is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU General Public License |
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7 |
||||
|
||||
If you modify this Program, or any covered work, by linking or |
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
||||
(or a modified version of those libraries), |
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
||||
licensors of this Program grant you additional |
||||
permission to convey the resulting work. Corresponding Source for a |
||||
non-source form of such a combination shall include the source code for |
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
||||
work. |
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
||||
or by snail mail at: |
||||
Cyan Worlds, Inc. |
||||
14617 N Newport Hwy |
||||
Mead, WA 99021 |
||||
|
||||
*==LICENSE==*/ |
||||
/*****************************************************************************
|
||||
* |
||||
* $/Plasma20/Sources/Plasma/NucleusLib/pnSqlLib/Pch.h |
||||
*
|
||||
***/ |
||||
|
||||
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNSQLLIB_PCH_H |
||||
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnSqlLib/Pch.h included more than once" |
||||
#endif |
||||
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNSQLLIB_PCH_H |
||||
|
||||
#include "pnUtils/pnUtils.h" |
||||
#include "pnNetBase/pnNetBase.h" |
||||
#include "pnAsyncCore/pnAsyncCore.h" |
||||
|
||||
// Include ODBC API
|
||||
#include <sql.h> |
||||
#include <sqlext.h> |
||||
|
||||
#include "Private/pnSqlAllIncludes.h" |
||||
#include "Intern.h" |
@ -1,55 +0,0 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools |
||||
Copyright (C) 2011 Cyan Worlds, Inc. |
||||
|
||||
This program is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
This program is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU General Public License |
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7 |
||||
|
||||
If you modify this Program, or any covered work, by linking or |
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
||||
(or a modified version of those libraries), |
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
||||
licensors of this Program grant you additional |
||||
permission to convey the resulting work. Corresponding Source for a |
||||
non-source form of such a combination shall include the source code for |
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
||||
work. |
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
||||
or by snail mail at: |
||||
Cyan Worlds, Inc. |
||||
14617 N Newport Hwy |
||||
Mead, WA 99021 |
||||
|
||||
*==LICENSE==*/ |
||||
/*****************************************************************************
|
||||
* |
||||
* $/Plasma20/Sources/Plasma/NucleusLib/pnSqlLib/Private/pnSqlAllIncludes.h |
||||
*
|
||||
***/ |
||||
|
||||
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNSQLLIB_PRIVATE_PNSQLALLINCLUDES_H |
||||
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnSqlLib/Private/pnSqlAllIncludes.h included more than once" |
||||
#endif |
||||
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNSQLLIB_PRIVATE_PNSQLALLINCLUDES_H |
||||
|
||||
|
||||
#include "pnSqlConn.h" |
||||
#include "pnSqlUtil.h" |
File diff suppressed because it is too large
Load Diff
@ -1,308 +0,0 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools |
||||
Copyright (C) 2011 Cyan Worlds, Inc. |
||||
|
||||
This program is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
This program is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU General Public License |
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7 |
||||
|
||||
If you modify this Program, or any covered work, by linking or |
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
||||
(or a modified version of those libraries), |
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
||||
licensors of this Program grant you additional |
||||
permission to convey the resulting work. Corresponding Source for a |
||||
non-source form of such a combination shall include the source code for |
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
||||
work. |
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
||||
or by snail mail at: |
||||
Cyan Worlds, Inc. |
||||
14617 N Newport Hwy |
||||
Mead, WA 99021 |
||||
|
||||
*==LICENSE==*/ |
||||
/*****************************************************************************
|
||||
* |
||||
* $/Plasma20/Sources/Plasma/NucleusLib/pnSqlLib/Private/pnSqlConn.h |
||||
*
|
||||
***/ |
||||
|
||||
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNSQLLIB_PRIVATE_PNSQLCONN_H |
||||
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnSqlLib/Private/pnSqlConn.h included more than once" |
||||
#endif |
||||
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNSQLLIB_PRIVATE_PNSQLCONN_H |
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* |
||||
* Types |
||||
* |
||||
***/ |
||||
|
||||
struct SqlConn; |
||||
struct SqlStmt; |
||||
struct SqlTrans; |
||||
|
||||
typedef void (* FSqlBindPrepare)( |
||||
SqlStmt * stmt, |
||||
ARRAY(uint8_t) * bindData |
||||
); |
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* |
||||
* Init API |
||||
* |
||||
***/ |
||||
|
||||
SqlConn * SqlConnCreate ( |
||||
const wchar_t connectStr[], |
||||
unsigned maxConnections, |
||||
unsigned transTimeoutMs |
||||
); |
||||
void SqlConnShutdown (SqlConn * conn); |
||||
void SqlConnDestroy (SqlConn * conn); |
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* |
||||
* Ad-hoc query API |
||||
* |
||||
* For queries that will be performed and therefore don't want to incur |
||||
* binding and preparing overhead. |
||||
* |
||||
***/ |
||||
|
||||
SqlStmt * SqlConnAllocStmt ( |
||||
SqlConn * conn |
||||
); |
||||
void SqlConnFreeStmt ( |
||||
SqlStmt * stmt |
||||
); |
||||
void SqlStmtSetAttr ( |
||||
SqlStmt * stmt, |
||||
int attr, |
||||
void * valPtr, |
||||
int strLen |
||||
); |
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* |
||||
* "Optimized" query API |
||||
* |
||||
* The "prepare" function will only be called once for a statement, and it |
||||
* will retain its bindings and memory set by the prepare function until |
||||
* SqlConnDisconnect is called (i.e. until program shutdown). |
||||
* |
||||
*
|
||||
* |
||||
***/ |
||||
|
||||
SqlStmt * SqlConnAllocStmt ( |
||||
SqlConn * conn, |
||||
FSqlBindPrepare prepare, |
||||
uint8_t ** bindData // [OUT]
|
||||
); |
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* |
||||
* Error handling |
||||
* |
||||
***/ |
||||
|
||||
typedef void (* FSqlConnErrorHandler)( |
||||
int result, |
||||
const wchar_t function[], |
||||
const wchar_t command[], |
||||
const char diagnostics[], // double-null terminated
|
||||
void * userParam |
||||
); |
||||
|
||||
void SqlConnSetErrorHandler ( |
||||
SqlStmt * stmt, |
||||
FSqlConnErrorHandler handler, |
||||
void * userParam |
||||
); |
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* |
||||
* Output binding |
||||
* |
||||
***/ |
||||
|
||||
// Reset all changes done by SqlConnBindCol*() functions
|
||||
void SqlConnBindColReset (SqlStmt * stmt); |
||||
|
||||
// Obtain multiple rows in a result set by rows or columns
|
||||
void SqlConnBindColMode ( |
||||
SqlStmt * stmt, |
||||
SQLUINTEGER * rowCount, // SQL_ATTR_ROWS_FETCHED_PTR
|
||||
SQLUINTEGER structSize, // SQL_ATTR_ROW_BIND_TYPE
|
||||
SQLUINTEGER arraySize, // SQL_ATTR_ROW_ARRAY_SIZE
|
||||
SQLUSMALLINT * statusArray // SQL_ATTR_ROW_STATUS_PTR
|
||||
); |
||||
|
||||
// Bind parameters of various types
|
||||
void SqlConnBindCol ( |
||||
SqlStmt * stmt, |
||||
SQLINTEGER targetType, |
||||
SQLPOINTER targetValue, |
||||
SQLINTEGER bufferLength, |
||||
SQLINTEGER * indPtr |
||||
); |
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* |
||||
* Parameter binding |
||||
* |
||||
***/ |
||||
|
||||
// Reset all changes done by SqlConnBindParameter*() functions
|
||||
void SqlConnBindParameterReset (SqlStmt * stmt); |
||||
|
||||
// Set multiple rows in an output set by rows or columns
|
||||
void SqlConnBindParameterMode ( |
||||
SqlStmt * stmt, |
||||
SQLUINTEGER * processCount, // SQL_ATTR_PARAMS_PROCESSED_PTR
|
||||
SQLUINTEGER structSize, // SQL_ATTR_PARAM_BIND_TYPE
|
||||
SQLUINTEGER arraySize, // SQL_ATTR_PARAMSET_SIZE
|
||||
SQLUSMALLINT * statusArray // SQL_ATTR_PARAM_STATUS_PTR
|
||||
); |
||||
|
||||
// Bind parameters of various types
|
||||
void SqlConnBindParameter ( |
||||
SqlStmt * stmt, |
||||
SQLINTEGER inputOutputType, |
||||
SQLINTEGER valueType, |
||||
SQLINTEGER parameterType, |
||||
SQLUINTEGER columnSize, |
||||
SQLINTEGER decimalDigits, |
||||
SQLPOINTER parameterValuePtr, |
||||
SQLINTEGER bufferLength, |
||||
SQLINTEGER * indPtr |
||||
); |
||||
void SqlConnBindParameterInt ( |
||||
SqlStmt * stmt, |
||||
SQLINTEGER inputOutputType, |
||||
SQLINTEGER * parameterValuePtr, |
||||
SQLINTEGER * indPtr |
||||
); |
||||
void SqlConnBindParameterUInt ( |
||||
SqlStmt * stmt, |
||||
SQLINTEGER inputOutputType, |
||||
SQLUINTEGER * parameterValuePtr, |
||||
SQLINTEGER * indPtr |
||||
); |
||||
void SqlConnBindParameterString ( |
||||
SqlStmt * stmt, |
||||
SQLINTEGER inputOutputType, |
||||
SQLUINTEGER columnSize, // bytes, NOT chars
|
||||
SQLWCHAR * parameterValuePtr, |
||||
SQLINTEGER * indPtr |
||||
); |
||||
void SqlConnBindParameterStringA ( |
||||
SqlStmt * stmt, |
||||
SQLINTEGER inputOutputType, |
||||
SQLUINTEGER columnSize, // bytes, NOT chars
|
||||
SQLCHAR * parameterValuePtr, |
||||
SQLINTEGER * indPtr |
||||
); |
||||
|
||||
/****************************************************************************
|
||||
* |
||||
* Execution |
||||
* |
||||
***/ |
||||
|
||||
int SqlConnExecDirect ( |
||||
SqlStmt * stmt, |
||||
const wchar_t string[] |
||||
); |
||||
int SqlConnPrepare ( |
||||
SqlStmt * stmt, |
||||
const wchar_t string[] |
||||
); |
||||
int SqlConnExecute ( |
||||
SqlStmt * stmt |
||||
); |
||||
int SqlConnFetch ( |
||||
SqlStmt * stmt |
||||
); |
||||
int SqlConnMoreResults ( |
||||
SqlStmt * stmt |
||||
); |
||||
int SqlConnParamData ( |
||||
SqlStmt * stmt, |
||||
SQLPOINTER * put |
||||
); |
||||
bool SqlConnPutData ( |
||||
SqlStmt * stmt, |
||||
SQLPOINTER data, |
||||
SQLINTEGER bytes |
||||
); |
||||
int SqlConnGetData ( |
||||
SqlStmt * stmt, |
||||
SQLINTEGER columnNumber, |
||||
SQLINTEGER targetType, |
||||
SQLPOINTER targetValue, |
||||
SQLINTEGER bufferLength, |
||||
SQLINTEGER * indPtr |
||||
); |
||||
void SqlConnCloseCursor ( |
||||
SqlStmt * stmt |
||||
); |
||||
int SqlConnNumResultCols ( |
||||
SqlStmt * stmt |
||||
); |
||||
int SqlConnDescribeCol ( |
||||
SqlStmt * stmt, |
||||
SQLSMALLINT columnNumber, |
||||
SQLWCHAR * columnName, |
||||
SQLSMALLINT bufferLength, |
||||
SQLSMALLINT * nameLengthPtr, |
||||
SQLSMALLINT * dataTypePtr, |
||||
SQLUINTEGER * columnSizePtr, |
||||
SQLSMALLINT * decimalDigitsPtr, |
||||
SQLSMALLINT * nullablePtr |
||||
); |
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* |
||||
* Performance API |
||||
* |
||||
***/ |
||||
|
||||
enum { |
||||
kSqlConnPerfConnDesired, |
||||
kSqlConnPerfConnCurrent, |
||||
kSqlConnPerfConnPending, |
||||
kSqlConnPerfConnCheckDead, |
||||
kSqlConnPerfCacheHits, |
||||
kSqlConnPerfCacheMisses, |
||||
kSqlConnNumPerf |
||||
}; |
||||
|
||||
unsigned SqlConnGetPerf (unsigned id); |
@ -1,196 +0,0 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools |
||||
Copyright (C) 2011 Cyan Worlds, Inc. |
||||
|
||||
This program is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
This program is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU General Public License |
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7 |
||||
|
||||
If you modify this Program, or any covered work, by linking or |
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
||||
(or a modified version of those libraries), |
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
||||
licensors of this Program grant you additional |
||||
permission to convey the resulting work. Corresponding Source for a |
||||
non-source form of such a combination shall include the source code for |
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
||||
work. |
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
||||
or by snail mail at: |
||||
Cyan Worlds, Inc. |
||||
14617 N Newport Hwy |
||||
Mead, WA 99021 |
||||
|
||||
*==LICENSE==*/ |
||||
/*****************************************************************************
|
||||
* |
||||
* $/Plasma20/Sources/Plasma/NucleusLib/pnSqlLib/Private/pnSqlUtil.cpp |
||||
*
|
||||
***/ |
||||
|
||||
#include "../Pch.h" |
||||
#pragma hdrstop |
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* |
||||
* Exports |
||||
* |
||||
***/ |
||||
|
||||
//===========================================================================
|
||||
void SqlConnBindParameterInputGuid ( |
||||
SqlStmt * stmt, |
||||
Uuid * uuid, |
||||
SQLINTEGER * uuidLen |
||||
) { |
||||
SqlConnBindParameter( |
||||
stmt, |
||||
SQL_PARAM_INPUT, |
||||
SQL_C_BINARY, |
||||
SQL_BINARY, |
||||
sizeof(Uuid), |
||||
0, |
||||
uuid, |
||||
sizeof(Uuid), |
||||
uuidLen |
||||
); |
||||
} |
||||
|
||||
//===========================================================================
|
||||
void SqlConnBindParameterOutputGuid ( |
||||
SqlStmt * stmt, |
||||
Uuid * uuid, |
||||
SQLINTEGER * uuidLen |
||||
) { |
||||
SqlConnBindParameter( |
||||
stmt, |
||||
SQL_PARAM_OUTPUT, |
||||
SQL_C_BINARY, |
||||
SQL_BINARY, |
||||
sizeof(Uuid), |
||||
0, |
||||
uuid, |
||||
sizeof(Uuid), |
||||
uuidLen |
||||
); |
||||
} |
||||
|
||||
//===========================================================================
|
||||
void SqlConnBindParameterBigInt ( |
||||
SqlStmt * stmt, |
||||
SQLINTEGER inputOutputType, |
||||
SQLBIGINT * parameterValuePtr, |
||||
SQLINTEGER * indPtr |
||||
) { |
||||
SqlConnBindParameter( |
||||
stmt, |
||||
inputOutputType, |
||||
SQL_C_SBIGINT, |
||||
SQL_BIGINT, |
||||
sizeof(uint64_t), |
||||
0, |
||||
parameterValuePtr, |
||||
0, |
||||
indPtr |
||||
); |
||||
} |
||||
|
||||
//===========================================================================
|
||||
bool SqlConnGetBlobData ( |
||||
SqlStmt * stmt, |
||||
unsigned colIndex, |
||||
ARRAY(uint8_t) * buffer, |
||||
unsigned * bytesAdded |
||||
) { |
||||
// Since a number of routines use this function, set the chunk size to be
|
||||
// fairly large to avoid the necessity of reallocing the block, and further
|
||||
// to prevent memory fragmentation by allocating variously sized blocks.
|
||||
// In for a penny, in for a pound...
|
||||
const unsigned CHUNK_SIZE = 32 * 1024; |
||||
SQLINTEGER length = CHUNK_SIZE - 1; |
||||
unsigned bytes = buffer->Bytes(); |
||||
*bytesAdded = 0 - bytes; |
||||
for (;;) { |
||||
// Allocate memory that is evenly aligned to CHUNK_SIZE, which
|
||||
// reduces memory fragmentation by allocating on 32K multiples.
|
||||
// Use SetCount() instead of New() to ensure that this is true
|
||||
// even if the buffer already contains data.
|
||||
buffer->SetCount( |
||||
MathNextMultiplePow2( |
||||
buffer->Bytes() + length, |
||||
CHUNK_SIZE |
||||
) |
||||
); |
||||
|
||||
// Read column data
|
||||
int result = SqlConnGetData( |
||||
stmt, |
||||
colIndex, |
||||
SQL_C_BINARY, |
||||
buffer->Ptr() + bytes, |
||||
buffer->Bytes() - bytes, |
||||
&length |
||||
); |
||||
|
||||
// Handle SQL_NO_TOTAL and SQL_NULL_DATA values
|
||||
if (length < 0) { |
||||
buffer->ZeroCount(); |
||||
*bytesAdded = 0; |
||||
return result == SQL_SUCCESS; |
||||
} |
||||
|
||||
// Keep getting data until we have the entire buffer
|
||||
if (result == SQL_SUCCESS_WITH_INFO) { |
||||
// length contains the number of remaining bytes
|
||||
bytes = buffer->Bytes(); |
||||
continue; |
||||
} |
||||
|
||||
// Is the buffer complete?
|
||||
if (result == SQL_SUCCESS) { |
||||
buffer->SetCountFewer(length + bytes); |
||||
*bytesAdded += buffer->Bytes(); |
||||
return true; |
||||
} |
||||
|
||||
// An error occurred
|
||||
break; |
||||
} |
||||
|
||||
buffer->ZeroCount(); |
||||
*bytesAdded = 0; |
||||
return false; |
||||
} |
||||
|
||||
//===========================================================================
|
||||
int SqlConnPutBlobData ( |
||||
SqlStmt * stmt, |
||||
unsigned bytes, |
||||
const uint8_t data[] |
||||
) { |
||||
int result; |
||||
SQLPOINTER putPtr; |
||||
while (SQL_NEED_DATA == (result = SqlConnParamData(stmt, &putPtr))) { |
||||
if (!SqlConnPutData(stmt, const_cast<uint8_t *>(data), bytes)) |
||||
return SQL_ERROR; |
||||
} |
||||
return result; |
||||
} |
@ -1,86 +0,0 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools |
||||
Copyright (C) 2011 Cyan Worlds, Inc. |
||||
|
||||
This program is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
This program is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU General Public License |
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7 |
||||
|
||||
If you modify this Program, or any covered work, by linking or |
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
||||
(or a modified version of those libraries), |
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
||||
licensors of this Program grant you additional |
||||
permission to convey the resulting work. Corresponding Source for a |
||||
non-source form of such a combination shall include the source code for |
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
||||
work. |
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
||||
or by snail mail at: |
||||
Cyan Worlds, Inc. |
||||
14617 N Newport Hwy |
||||
Mead, WA 99021 |
||||
|
||||
*==LICENSE==*/ |
||||
/*****************************************************************************
|
||||
* |
||||
* $/Plasma20/Sources/Plasma/NucleusLib/pnSqlLib/Private/pnSqlUtil.h |
||||
*
|
||||
***/ |
||||
|
||||
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNSQLLIB_PRIVATE_PNSQLUTIL_H |
||||
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnSqlLib/Private/pnSqlUtil.h included more than once" |
||||
#endif |
||||
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNSQLLIB_PRIVATE_PNSQLUTIL_H |
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* |
||||
* SqlUtil API |
||||
* |
||||
***/ |
||||
|
||||
void SqlConnBindParameterInputGuid ( |
||||
SqlStmt * stmt, |
||||
Uuid * uuid, |
||||
SQLINTEGER * uuidLen |
||||
); |
||||
void SqlConnBindParameterOutputGuid ( |
||||
SqlStmt * stmt, |
||||
Uuid * uuid, |
||||
SQLINTEGER * uuidLen |
||||
); |
||||
void SqlConnBindParameterBigInt ( |
||||
SqlStmt * stmt, |
||||
SQLINTEGER inputOutputType, |
||||
SQLBIGINT * parameterValuePtr, |
||||
SQLINTEGER * indPtr |
||||
); |
||||
bool SqlConnGetBlobData ( |
||||
SqlStmt * stmt, |
||||
unsigned colIndex, |
||||
ARRAY(uint8_t) * buffer, |
||||
unsigned * bytesAdded |
||||
); |
||||
int SqlConnPutBlobData ( |
||||
SqlStmt * stmt, |
||||
unsigned bytes, |
||||
const uint8_t data[] |
||||
); |
@ -1,59 +0,0 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools |
||||
Copyright (C) 2011 Cyan Worlds, Inc. |
||||
|
||||
This program is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
This program is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU General Public License |
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7 |
||||
|
||||
If you modify this Program, or any covered work, by linking or |
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
||||
(or a modified version of those libraries), |
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
||||
licensors of this Program grant you additional |
||||
permission to convey the resulting work. Corresponding Source for a |
||||
non-source form of such a combination shall include the source code for |
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
||||
work. |
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
||||
or by snail mail at: |
||||
Cyan Worlds, Inc. |
||||
14617 N Newport Hwy |
||||
Mead, WA 99021 |
||||
|
||||
*==LICENSE==*/ |
||||
/*****************************************************************************
|
||||
* |
||||
* $/Plasma20/Sources/Plasma/NucleusLib/pnSqlLib/pnSqlLib.h |
||||
*
|
||||
***/ |
||||
|
||||
#ifndef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNSQLLIB_PNSQLLIB_H |
||||
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNSQLLIB_PNSQLLIB_H |
||||
|
||||
|
||||
// Include ODBC API
|
||||
#include <sql.h> |
||||
#include <sqlext.h> |
||||
|
||||
#include "Private/pnSqlAllIncludes.h" |
||||
|
||||
|
||||
#endif // PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNSQLLIB_PNSQLLIB_H
|
Loading…
Reference in new issue