This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "pch.h" | |
#include "CBlobRecordset.h" | |
CBlobRecordset::CBlobRecordset(CDatabase* db) : CRecordset(db) { | |
szErrorMessage[0] = 0; | |
nError = 0; | |
szSQLState[0] = 0; | |
} | |
long CBlobRecordset::GetBlobData(int nField, LPVOID pBuffer, int nBufferSize) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "pch.h" | |
#include "CBlobDatabase.h" | |
CBlobDatabase::CBlobDatabase() : CDatabase() { | |
m_nImageLen = 0; | |
m_pabImage = nullptr; | |
} | |
void CBlobDatabase::BindParameters(HSTMT hstmt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string CharArrayToHex(char* data, size_t len) | |
{ | |
constexpr char hexmap[] = { '0', '1', '2', '3', '4', '5', '6', '7', | |
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; | |
std::string s(len * 2, ' '); | |
unsigned char p; | |
for (int i = 0; i < len; ++i) { | |
p = data[i]; | |
s[2 * i] = hexmap[(p & 0xF0) >> 4]; | |
s[2 * i + 1] = hexmap[p & 0x0F]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE myTable(FileName nvarchar(60), | |
FileType nvarchar(60), Document varbinary(max)) | |
INSERT INTO myTable(FileName, FileType, Document) | |
SELECT 'ConnectionManager.pdb' AS FileName, | |
'.pdb' AS FileType, | |
* FROM OPENROWSET(BULK N'D:\TEST\BIN\ConnectionManager.pdb', SINGLE_BLOB) AS Document |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POINT CDefaultAppFont::GetFontSize(CFont* pFont,CHAR *str) | |
{ | |
POINT p = { 0 }; | |
auto mainWindow = AfxGetApp()->GetMainWnd(); | |
if (mainWindow != NULL) { | |
auto hDC = GetWindowDC(mainWindow->m_hWnd); | |
CDC* pDC = CDC::FromHandle(hDC); | |
CFont* pOldFont = pDC->SelectObject(pFont); | |
SIZE sizeText; | |
if (str == NULL) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SIZE TextRect = { 0 }; | |
RECT textrect = { 0 }; | |
GetClientRect(hWnd, &rect); | |
textrect = rect; | |
DrawText(hdc, buff, -1, &textrect, DT_CALCRECT); | |
float rowCount = ((float)textrect.right / (float)(rect.right - rect.left)) + 0.9999; | |
rect.top += ((rect.bottom - rect.top) - (textrect.bottom *(int)rowCount))/ 2; | |
DrawText(hdc, buff, -1, rect, DT_CENTER | DT_WORDBREAK | DT_EXPANDTABS); | |
SelectObject(hdc, hOldFont); | |
::SetTextColor(hdc, oldtxtColor); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function show_elements(elements, specifiedDisplay) { | |
elements = elements.length ? elements : [elements]; | |
for (var index = 0; index < elements.length; index++) { | |
elements[index].style.display = specifiedDisplay || 'block'; | |
} | |
} | |
/* | |
// Usage: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
// global compilation flag configuring windows sdk headers | |
// preventing inclusion of min and max macros clashing with <limits> | |
#define NOMINMAX 1 | |
// override byte to prevent clashes with <cstddef> | |
typedef unsigned char byte; | |
// Define min max macros required by GDI+ headers. | |
#ifndef max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TEST_METHOD(wildcard_match) { | |
PgSQL pgsql; | |
bool ret; | |
ret = pgsql.match("n*ck", "novick"); | |
Assert::AreEqual<bool>(true, ret, L"\"n*ck\", \"novick\" ", LINE_INFO()); | |
ret = pgsql.match("nov?ck*", "novickfornovick"); | |
Assert::AreEqual<bool>(true, ret, L"\"nov?ck*\", \"novickfornovick\" ", LINE_INFO()); | |
ret = pgsql.match("n*k", "nov"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int PgSQL_Dump::RestoreFromDump(ConnInfo* connInfo, string targetFileName) { | |
int ret = 0; | |
stringstream ss; | |
string connectionString; | |
for (auto& elemItem : connInfo->configInfo) { | |
if (elemItem.key.compare("CONFIG_STRING") == 0) { | |
connectionString = elemItem.value; | |
break; |
NewerOlder