示例#1
0
namespace Application {

wchar_t version[] =
#ifdef QGAMETRAINER_VERSION
L"" QGAMETRAINER_VERSION
#else
L"SCM (compiled on " WIDEN(__DATE__) L" at " WIDEN(__TIME__) L")"
#endif
;

void init() {
	QCoreApplication::setOrganizationName(organization);
	QCoreApplication::setApplicationName(name);

	QString localeName = QLocale::system().name();

#ifdef Q_OS_WIN32
	// Under Windows we may want to put Qt plugins in the application's directory
	QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath());
	QString qtTranslatorName = QString::fromWCharArray(L"qt_%1").arg(localeName);
	QTranslator *qtTranslator = new QTranslator(QCoreApplication::instance());
	qtTranslator->load(qtTranslatorName);
	QCoreApplication::installTranslator(qtTranslator);
#endif

	QString appTranslatorName = QString::fromWCharArray(L":/qm/%1").arg(localeName);
	QTranslator *appTranslator = new QTranslator(QCoreApplication::instance());
	appTranslator->load(appTranslatorName);
	QCoreApplication::installTranslator(appTranslator);
}

QDir createSettingDir() {
	static QDir res;
	static bool created = false;
	if (!created) {
		QSettings dummySettings(QSettings::IniFormat, QSettings::UserScope, organization, QString::fromWCharArray(L"a"));
		QDir organizationDir(QFileInfo(dummySettings.fileName()).path());
		res = QDir(QFileInfo(organizationDir, name).filePath());
		if (!res.exists()) {
			QDir().mkpath(res.path());
		}
	}
	return res;
}

QSettings &settings() {
	static QSettings *settings = NULL;
	if (settings == NULL) {
		settings = new QSettings(QSettings::IniFormat, QSettings::UserScope, organization, name, QCoreApplication::instance());
	}
	return *settings;
}

}
/**
 * Set a filesystem GUID according to the filesystem name
 * We use a static ID for the first 8 bytes, and then roll the lowercase name
 * for the last 8 bytes (eg. exfat => {'e', 'x', 'f', 'a', 't', 'e', 'x', 'f'})
 */
EFI_GUID *
GetFSGuid(VOID)
{
	INTN i, j, k, Len = StrLen(WIDEN(STRINGIFY(DRIVERNAME)));
	static EFI_GUID Guid = { 0xEF1F5EF1, 0xF17E, 0x5857, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } };
	CHAR16 *FsName = WIDEN(STRINGIFY(DRIVERNAME));
	const CHAR16 *PlusName = L"plus";
    EFI_UNICODE_COLLATION_PROTOCOL *UnicodeCollation;
	UINT8 Data4[12];	/* +4 so that we can also reduce something like "1234567plus" into "1234567+" */
    EFI_STATUS Status = EFI_SUCCESS;

    Status = gBS->LocateProtocol(&gEfiUnicodeCollation2ProtocolGuid, NULL, (VOID**)&UnicodeCollation);
    if (EFI_ERROR(Status) || (UnicodeCollation == NULL))
    {
      Status = gBS->LocateProtocol(&gEfiUnicodeCollationProtocolGuid, NULL, (VOID**)&UnicodeCollation);
    }

    if (EFI_ERROR(Status) || (UnicodeCollation == NULL))
    {
      Print(L"ERROR: Could not open unicode collation protocol\n");

      return NULL;
    }

	UnicodeCollation->StrLwr(UnicodeCollation, FsName);

	for (i = 0, j = 0, k = 0; j < ARRAYSIZE(Data4); i = (i+1)%Len, j++) {
		/* Convert any 'plus' that is part of the name to '+' */
		if (FsName[i] == PlusName[k]) {
			if (++k == 4) {
				k = 0;
				j -= 3;
				Data4[j] = (UINT8) '+';
			} else {
				Data4[j] = FsName[i];
			}
		} else {
			k = 0;
			Data4[j] = FsName[i];
		}
	}

    if (FsName != NULL)
    {
        FreePool(FsName);
        FsName = NULL;
    }

        
    CopyMem(Guid.Data4, Data4, 8);

	return &Guid;
}
示例#3
0
static int winhttp_connect(
    winhttp_subtransport *t,
    const char *url)
{
    wchar_t *ua = L"git/1.0 (libgit2 " WIDEN(LIBGIT2_VERSION) L")";
    wchar_t *wide_host;
    int32_t port;
    const char *default_port = "80";
    int error = -1;
    int default_timeout = TIMEOUT_INFINITE;
    int default_connect_timeout = DEFAULT_CONNECT_TIMEOUT;

    /* Prepare port */
    if (git__strtol32(&port, t->connection_data.port, NULL, 10) < 0)
        return -1;

    /* Prepare host */
    if (git__utf8_to_16_alloc(&wide_host, t->connection_data.host) < 0) {
        giterr_set(GITERR_OS, "Unable to convert host to wide characters");
        return -1;
    }

    /* Establish session */
    t->session = WinHttpOpen(
                     ua,
                     WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,
                     WINHTTP_NO_PROXY_NAME,
                     WINHTTP_NO_PROXY_BYPASS,
                     0);

    if (!t->session) {
        giterr_set(GITERR_OS, "Failed to init WinHTTP");
        goto on_error;
    }

    if (!WinHttpSetTimeouts(t->session, default_timeout, default_connect_timeout, default_timeout, default_timeout)) {
        giterr_set(GITERR_OS, "Failed to set timeouts for WinHTTP");
        goto on_error;
    }


    /* Establish connection */
    t->connection = WinHttpConnect(
                        t->session,
                        wide_host,
                        (INTERNET_PORT) port,
                        0);

    if (!t->connection) {
        giterr_set(GITERR_OS, "Failed to connect to host");
        goto on_error;
    }

    error = 0;

on_error:
    git__free(wide_host);

    return error;
}
示例#4
0
文件: UpDown.cpp 项目: R3AL/Quart
	void UpDown::Create(Window* parent)
	{
		this->buddy->id = this->id;
		this->buddy->Create(parent);

		this->handle = CreateWindowEx(
			WS_EX_LEFT | WS_EX_LTRREADING,
			WIDEN("msctls_updown32"),
			nullptr,
			WS_CHILD | WS_VISIBLE | UDS_AUTOBUDDY | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_HOTTRACK,
			0, 
			0,
			0, 
			0,
			parent->GetHandle(),
			0,
			GetModuleHandle(0),
			nullptr);


		if(!this->handle)
		{
			ERRORMB();
			return;
		}

		this->SetRange(this->range);
	}
示例#5
0
文件: wseh.cpp 项目: krichter722/0ad
// called when an exception is detected (see below); provides detailed
// debugging information and exits.
//
// note: keep memory allocs and locking to an absolute minimum, because
// they may deadlock the process!
long __stdcall wseh_ExceptionFilter(struct _EXCEPTION_POINTERS* ep)
{
	// OutputDebugString raises an exception, which OUGHT to be swallowed
	// by WaitForDebugEvent but sometimes isn't. if we see it, ignore it.
	if(ep->ExceptionRecord->ExceptionCode == 0x40010006)	// DBG_PRINTEXCEPTION_C
		return EXCEPTION_CONTINUE_EXECUTION;

	// if run in a debugger, let it handle exceptions (tends to be more
	// convenient since it can bring up the crash location)
	if(IsDebuggerPresent())
		return EXCEPTION_CONTINUE_SEARCH;

	// make sure we don't recurse infinitely if this function raises an
	// SEH exception. (we may only have the guard page's 4 KB worth of
	// stack space if the exception is EXCEPTION_STACK_OVERFLOW)
	static intptr_t nestingLevel = 0;
	cpu_AtomicAdd(&nestingLevel, 1);
	if(nestingLevel >= 3)
		return EXCEPTION_CONTINUE_SEARCH;

	// someone is already holding the dbghelp lock - this is bad.
	// we'll report this problem first and then try to display the
	// exception info regardless (maybe dbghelp won't blow up).
	if(wutil_IsLocked(WDBG_SYM_CS) == 1)
		DEBUG_DISPLAY_ERROR(L"Exception raised while critical section is held - may deadlock..");

	// a dump file is essential for debugging, so write it before
	// anything else goes wrong (especially before showing the error
	// dialog because the user could choose to exit immediately)
	wdbg_sym_WriteMinidump(ep);

	// extract details from ExceptionRecord.
	wchar_t descriptionBuf[150];
	const wchar_t* description = GetExceptionDescription(ep, descriptionBuf, ARRAY_SIZE(descriptionBuf));
	wchar_t file[DEBUG_FILE_CHARS] = {0};
	int line = 0;
	wchar_t func[DEBUG_SYMBOL_CHARS] = {0};
	GetExceptionLocus(ep, file, &line, func);

	wchar_t message[500];
	const wchar_t* messageFormat =
		L"Much to our regret we must report the program has encountered an error.\r\n"
		L"\r\n"
		L"Please let us know at http://trac.wildfiregames.com/ and attach the crashlog.txt and crashlog.dmp files.\r\n"
		L"\r\n"
		L"Details: unhandled exception (%ls)\r\n";
	swprintf_s(message, ARRAY_SIZE(message), messageFormat, description);

	size_t flags = 0;
	if(ep->ExceptionRecord->ExceptionFlags & EXCEPTION_NONCONTINUABLE)
		flags = DE_NO_CONTINUE;
	const wchar_t* const lastFuncToSkip = WIDEN(STRINGIZE(DECORATED_NAME(wseh_ExceptionFilter)));
	ErrorReaction er = debug_DisplayError(message, flags, ep->ContextRecord, lastFuncToSkip, file,line,utf8_from_wstring(func).c_str(), 0);
	ENSURE(er == ER_CONTINUE);	// nothing else possible

	// invoke the Win32 default handler - it calls ExitProcess for
	// most exception types.
	return EXCEPTION_CONTINUE_SEARCH;
}
示例#6
0
MetaDataConfig::MetaDataConfig(const string &xml_string)
{
    try {
        node_ = ElementTree::parse(xml_string);
    }
    catch (const exception &e) {
        throw ParseError(String(_T("XML tree parse error: ")) + WIDEN(e.what()));
    }
}
示例#7
0
void
SQLiteCursorBackend::exec_direct(const String &sql)
{
    int rs = sqlite3_exec(conn_, NARROW(sql).c_str(), 0, 0, 0);
    if (SQLITE_OK != sqlite3_errcode(conn_)) {
        const char *err = sqlite3_errmsg(conn_);
        throw DBError(WIDEN(err));
    }
}
示例#8
0
void
SQLiteConnectionBackend::rollback()
{
    sqlite3_exec(conn_, "ROLLBACK", NULL, 0, 0);
    if (SQLITE_OK != sqlite3_errcode(conn_)) {
        const char *err = sqlite3_errmsg(conn_);
        throw DBError(WIDEN(err));
    }
}
示例#9
0
void
SQLiteConnectionBackend::commit()
{
    sqlite3_exec(conn_, "COMMIT", NULL, 0, 0);
    if (SQLITE_OK != sqlite3_errcode(conn_)) {
        const char *err = sqlite3_errmsg(conn_);
        throw DBError(WIDEN(err));
    }
}
示例#10
0
void
SQLiteConnectionBackend::begin_trans()
{
    sqlite3_exec(conn_, "BEGIN TRANSACTION", NULL, 0, 0);
    if (SQLITE_OK != sqlite3_errcode(conn_)) {
        const char *err = sqlite3_errmsg(conn_);
        throw DBError(WIDEN(err));
    }
}
示例#11
0
void
SOCIConnectionBackend::begin_trans()
{
    try {
        conn_->begin();
    }
    catch (const soci::soci_error &e) {
        throw DBError(WIDEN(e.what()));
    }
}
示例#12
0
RowPtr SQLiteCursorBackend::fetch_row()
{
    if (SQLITE_DONE == last_code_ || SQLITE_OK == last_code_)
        return RowPtr();
    if (SQLITE_ROW != last_code_)
        throw DBError(WIDEN(sqlite3_errmsg(conn_)));
    int col_count = sqlite3_column_count(stmt_);
    RowPtr row(new Row(col_count));
    for (int i = 0; i < col_count; ++i) {
        String name = str_to_upper(WIDEN(sqlite3_column_name(stmt_, i)));
        int type = sqlite3_column_type(stmt_, i);
        (*row)[i].first = name;
        if (SQLITE_NULL != type)
            (*row)[i].second = Value(
                    WIDEN((const char *)sqlite3_column_text(stmt_, i)));
    }
    last_code_ = sqlite3_step(stmt_);
    return row;
}
示例#13
0
void
SQLiteCursorBackend::prepare(const String &sql)
{
    close();
    sqlite3_prepare_v2(conn_, NARROW(sql).c_str(), -1, &stmt_, 0);
    if (SQLITE_OK != sqlite3_errcode(conn_) || !stmt_) {
        const char *err = sqlite3_errmsg(conn_);
        throw DBError(WIDEN(err));
    }
}
示例#14
0
void
SOCIConnectionBackend::rollback()
{
    try {
        conn_->rollback();
    }
    catch (const soci::soci_error &e) {
        throw DBError(WIDEN(e.what()));
    }
}
示例#15
0
void
SOCICursorBackend::exec_direct(const String &sql)
{
    try {
        conn_->once << NARROW(sql);
    }
    catch (const soci::soci_error &e) {
        throw DBError(WIDEN(e.what()));
    }
}
WinSparkleUpdater::WinSparkleUpdater( const QString& url )
{
  win_sparkle_set_appcast_url( url.toUtf8().data() );
  win_sparkle_set_app_details(
    qApp->organizationName().toStdWString().c_str(),
    qApp->applicationName().toStdWString().c_str(),
    WIDEN(VERSION)
  );

  win_sparkle_init();
}
示例#17
0
void
SQLiteConnectionBackend::open(SqlDialect *dialect, const SqlSource &source)
{
    close();
    ScopedLock lock(drv_->conn_mux_);
    own_handle_ = true;
    sqlite3_open(NARROW(source.db()).c_str(), &conn_);
    if (SQLITE_OK != sqlite3_errcode(conn_)) {
        const char *err = sqlite3_errmsg(conn_);
        throw DBError(WIDEN(err));
    }
}
示例#18
0
	SaveFileDialog::SaveFileDialog(Window& parent, const tstring& filter)
	{
		OPENFILENAME ofn           = {0};
		TCHAR FileName[MAX_PATH]   = WIDEN("");
		TCHAR leFilter[MAX_PATH]   = WIDEN("");

		unsigned int i = 0;
		for(const auto& letter : filter)
			leFilter[i++] = letter;

		ofn.lStructSize     = sizeof(ofn);
		ofn.hwndOwner       = parent.GetHandle();
		ofn.lpstrFilter		= leFilter;
		ofn.lpstrFile       = FileName;
		ofn.lpstrInitialDir = WIDEN(".");
		ofn.nMaxFile        = MAX_PATH;
		ofn.Flags           = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;

		if(GetSaveFileName(&ofn))
			this->retStr = tstring(FileName);
	}
示例#19
0
static
const String
format_stats(const String &source_id, int count = -1, int pool_size = -1)
{
    std::ostringstream stats;
    stats << " [source: " << NARROW(source_id);
    if (count >= 0 && pool_size >= 0)
        stats << ", total open: " << (count + pool_size)
            << ", in pool: " << pool_size;
    stats << "]";
    return WIDEN(stats.str());
}
示例#20
0
	OpenFileDialog::OpenFileDialog(Window& parent, const tstring& filter)
	{
		OPENFILENAME ofn           = {0};
		TCHAR FileName[MAX_PATH]   = WIDEN("");
		TCHAR leFilter[MAX_PATH]   = WIDEN("");

		unsigned int i = 0;
		for(const auto& letter : filter)
			leFilter[i++] = letter;

		ofn.lStructSize    = sizeof(OPENFILENAME);
		ofn.hwndOwner      = parent.GetHandle();
		ofn.lpstrFilter    = leFilter;
		ofn.lpstrFile      = FileName;
		ofn.nMaxFile       = MAX_PATH;
		ofn.Flags          = OFN_EXPLORER | OFN_FILEMUSTEXIST;
		ofn.nFileOffset    = 0;
		ofn.nFileExtension = 0;
		ofn.nFilterIndex   = 0;

		if(GetOpenFileName(&ofn))
			this->retStr = tstring(FileName);
	}
示例#21
0
void SOCIConnectionBackend::close()
{
    try {
        if (own_handle_) {
            if (conn_)
                delete conn_;
            own_handle_ = false;
        }
        conn_ = NULL;
    }
    catch (const soci::soci_error &e) {
        throw DBError(WIDEN(e.what()));
    }
}
示例#22
0
void
SQLiteCursorBackend::exec(const Values &params)
{
    if (exec_count_)
        sqlite3_reset(stmt_);
    ++exec_count_;
    vector<string> str_params(params.size());
    for (size_t i = 0; i < params.size(); ++i) {
        if (params[i].get_type() == Value::INTEGER
                || params[i].get_type() == Value::LONGINT)
        {
            sqlite3_bind_int(stmt_, i + 1, params[i].as_integer());
            if (SQLITE_OK != sqlite3_errcode(conn_)) {
                const char *err = sqlite3_errmsg(conn_);
                throw DBError(WIDEN(err));
            }
        } else if (params[i].is_null()) {
            sqlite3_bind_null(stmt_, i + 1);
            if (SQLITE_OK != sqlite3_errcode(conn_)) {
                const char *err = sqlite3_errmsg(conn_);
                throw DBError(WIDEN(err));
            }
        } else {
            str_params[i] = NARROW(params[i].as_string());
            sqlite3_bind_text(stmt_, i + 1,
                    str_params[i].c_str(), str_params[i].size(), SQLITE_STATIC);
            if (SQLITE_OK != sqlite3_errcode(conn_)) {
                const char *err = sqlite3_errmsg(conn_);
                throw DBError(WIDEN(err));
            }
        }
    }
    last_code_ = sqlite3_step(stmt_);
    if (last_code_ != SQLITE_DONE && last_code_ != SQLITE_ROW
            && last_code_ != SQLITE_OK)
        throw DBError(WIDEN(sqlite3_errmsg(conn_)));
}
示例#23
0
void
SOCICursorBackend::prepare(const String &sql)
{
    close();
    sql_ = NARROW(sql);
    is_select_ = starts_with(
            str_to_upper(trim_trailing_space(sql)), _T("SELECT"));
    try {
        stmt_ = new soci::statement(*conn_);
        stmt_->alloc();
        stmt_->prepare(sql_);
    }
    catch (const soci::soci_error &e) {
        throw DBError(WIDEN(e.what()));
    }
}
示例#24
0
void
SOCICursorBackend::close()
{
    try {
        if (stmt_) {
            delete stmt_;
            stmt_ = NULL;
            is_select_ = false;
            bound_first_ = false;
            executed_ = false;
            sql_.empty();
        }
    }
    catch (const soci::soci_error &e) {
        throw DBError(WIDEN(e.what()));
    }
}
示例#25
0
PWSversion::PWSversion()
  : m_nMajor(0), m_nMinor(0), m_nBuild(0), m_bModified(false)
{
  CString csFileVersion = WIDEN(STRFILEVER);
  m_SpecialBuild = SPECIAL_BUILD;

  m_builtOn = CString(__DATE__) + CString(L" ") + CString(__TIME__);

  CString resToken;
  int curPos = 0, index = 0;
  
  // Tokenize the file version to get the values in order
  // Revision is either a number or a number with '+',
  // so we need to get it from the file version string
  // which is of the form "MM, NN, BB, rev"
  resToken = csFileVersion.Tokenize(L",", curPos);
  while (resToken != L"" && curPos != -1) {
    resToken.Trim();
    if (resToken.IsEmpty())
      resToken = L"0";
    
    // Note: if token not numeric, returned value of _wtoi is zero
    switch (index) {
      case 0:
        m_nMajor = _wtoi(resToken);
        break;
      case 1:
        m_nMinor = _wtoi(resToken);
        break;
      case 2:
        m_nBuild = _wtoi(resToken);
        break;
      case 3:
        if (resToken.Right(1) == L"+")
          m_bModified = true;
        m_Revision = resToken;
        break;
      default:
        ASSERT(0);
    }
    index++;
    resToken = csFileVersion.Tokenize(L",", curPos);
  };
}
示例#26
0
static int winhttp_connect(
	winhttp_subtransport *t,
	const char *url)
{
	wchar_t *ua = L"git/1.0 (libgit2 " WIDEN(LIBGIT2_VERSION) L")";
	git_win32_path host;
	int32_t port;
	const char *default_port = "80";

	/* Prepare port */
	if (git__strtol32(&port, t->connection_data.port, NULL, 10) < 0)
		return -1;

	/* Prepare host */
	git_win32_path_from_c(host, t->connection_data.host);

	/* Establish session */
	t->session = WinHttpOpen(
		ua,
		WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,
		WINHTTP_NO_PROXY_NAME,
		WINHTTP_NO_PROXY_BYPASS,
		0);

	if (!t->session) {
		giterr_set(GITERR_OS, QT_TRANSLATE_NOOP("libgit2", "Failed to init WinHTTP"));
		return -1;
	}

	/* Establish connection */
	t->connection = WinHttpConnect(
		t->session,
		host,
		(INTERNET_PORT) port,
		0);

	if (!t->connection) {
		giterr_set(GITERR_OS, QT_TRANSLATE_NOOP("libgit2", "Failed to connect to host"));
		return -1;
	}

	return 0;
}
示例#27
0
void
SOCIConnectionBackend::open(SqlDialect *dialect, const SqlSource &source)
{
    close();
    own_handle_ = true;
    try {
        String driver = source.driver();
        std::string soci_backend = "odbc";
        if (driver == _T("SOCI"))
            soci_backend = soci_convert_dialect(dialect->get_name());
        conn_ = new soci::session(soci_backend, NARROW(source.db()));
#ifdef YB_SOCI_DEBUG
        conn_->set_log_stream(&cerr);
#endif
    }
    catch (const soci::soci_error &e) {
        throw DBError(WIDEN(e.what()));
    }
}
示例#28
0
void
SOCICursorBackend::exec(const Values &params)
{
    try {
        if (!executed_ && in_params_.size())
            bound_first_ = true;
        if (!bound_first_) {
            if (executed_) {
                delete stmt_;
                stmt_ = new soci::statement(*conn_);
                stmt_->alloc();
                stmt_->prepare(sql_);
                in_params_.clear();
                in_flags_.clear();
            }
            TypeCodes types(params.size());
            for (size_t i = 0; i < params.size(); ++i)
                types[i] = params[i].get_type();
            bind_params(types);
        }
        executed_ = true;
        for (size_t i = 0; i < params.size(); ++i) {
            const Value &param = params[i];
            if (param.is_null()) {
                in_flags_[i] = soci::i_null;
                continue;
            }
            in_flags_[i] = soci::i_ok;
            switch (param_types_[i]) {
                case Value::INTEGER: {
                    int &x = *(int *)&(in_params_[i][0]);
                    x = param.as_integer();
                    break;
                }
                case Value::LONGINT: {
                    LongInt &x = *(LongInt *)&(in_params_[i][0]);
                    x = param.as_longint();
                    break;
                }
                case Value::FLOAT: {
                    double &x = *(double *)&(in_params_[i][0]);
                    x = param.as_float();
                    break;
                }
                case Value::DATETIME: {
                    std::tm &x = *(std::tm *)&(in_params_[i][0]);
                    memset(&x, 0, sizeof(x));
                    const DateTime &d = param.as_date_time();
                    x.tm_year = dt_year(d) - 1900;
                    x.tm_mon = dt_month(d) - 1;
                    x.tm_mday = dt_day(d);
                    x.tm_hour = dt_hour(d);
                    x.tm_min = dt_minute(d);
                    x.tm_sec = dt_second(d);
                    break;
                }
                default: {
                    in_params_[i] = NARROW(param.as_string());
                }
            }
        }
        stmt_->execute(!is_select_);
    }
    catch (const soci::soci_error &e) {
        throw DBError(WIDEN(e.what()));
    }
}
示例#29
0
void j_console::setTitle (const std::string& title)
{
    SetConsoleTitle (WIDEN (title).c_str ());
}
示例#30
0
RowPtr SOCICursorBackend::fetch_row()
{
    try {
        if (!stmt_->fetch()) {
#ifdef YB_SOCI_DEBUG
            cerr << "fetch(): false" << endl;
#endif
            return RowPtr();
        }
        RowPtr result(new Row);
        int col_count = row_.size();
#ifdef YB_SOCI_DEBUG
        cerr << "fetch(): col_count=" << col_count << endl;
#endif
        for (int i = 0; i < col_count; ++i) {
            const soci::column_properties &props = row_.get_properties(i);
            String name = str_to_upper(WIDEN(props.get_name()));
            Value v;
            if (row_.get_indicator(i) != soci::i_null) {
                std::tm when;
                unsigned long long x;
                switch (props.get_data_type()) {
                case soci::dt_string:
                    v = Value(WIDEN(row_.get<string>(i)));
                    break;
                case soci::dt_double:
                    v = Value(row_.get<double>(i));
                    break;
                case soci::dt_integer:
                    v = Value(row_.get<int>(i));
                    break;
#if 0
                case soci::dt_unsigned_long:
                    x = row_.get<unsigned long>(i);
                    v = Value((LongInt)x);
                    break;
#endif
                case soci::dt_long_long:
                    x = row_.get<long long>(i);
                    v = Value((LongInt)x);
                    break;
                case soci::dt_unsigned_long_long:
                    x = row_.get<unsigned long long>(i);
                    v = Value((LongInt)x);
                    break;
                case soci::dt_date:
                    when = row_.get<std::tm>(i);
                    v = Value(dt_make(when.tm_year + 1900, when.tm_mon + 1,
                                when.tm_mday, when.tm_hour,
                                when.tm_min, when.tm_sec));
                    break;
                }
            }
#ifdef YB_SOCI_DEBUG
            cerr << "fetch(): col[" << i << "]: name=" << props.get_name()
                << " type=" << props.get_data_type()
                << " value=" << NARROW(v.sql_str()) << endl;
#endif
            result->push_back(make_pair(name, v));
        }
        return result;
    }
    catch (const soci::soci_error &e) {
        throw DBError(WIDEN(e.what()));
    }
}