Exemplo n.º 1
0
bool Dialect::restrictLanguage(const Dialect &l2)
{
    if (*this == l2)
        return true;
    QList<Dialect> ll1 = companionLanguages();
    QList<Dialect> ll2 = l2.companionLanguages();
    bool i1 = ll1.contains(l2);
    bool i2 = ll2.contains(*this);
    if (i1 && i2) {
        if (ll1.size() < ll2.size())
            return true;
        if (ll2.size() < ll1.size()) {
            *this = l2;
            return true;
        }
        if (m_dialect < l2.m_dialect)
            return true;
        *this = l2;
        return true;
    }
    if (i1 && !i2) {
        *this = l2;
        return true;
    }
    if (i2 && !i1)
        return true;
    qDebug() << toString() << "restrictTo" << l2.toString() << "failed";
    qDebug() << ll1 << ll2;
    qDebug() << i1 << i2;
    QList<Dialect> qmlLangs = Dialect(Qml).companionLanguages();
    if (qmlLangs.contains(*this) && qmlLangs.contains(l2))
        *this = Dialect::Qml;
    *this = Dialect::AnyLanguage;
    return false;
}
Exemplo n.º 2
0
Dialect Dialect::mergeLanguages(const Dialect &l1, const Dialect &l2)
{
    if (l1 == Dialect::NoLanguage)
        return l2;
    if (l2 == Dialect::NoLanguage)
        return l1;
    QList<Dialect> ll1 = l1.companionLanguages();
    QList<Dialect> ll2 = l2.companionLanguages();
    bool i1 = ll1.contains(l2);
    bool i2 = ll2.contains(l1);
    if (i1 && i2) {
        if (ll1.size() > ll2.size())
            return l1;
        if (ll2.size() > ll1.size())
            return l2;
        if (l1 < l2)
            return l1;
        return l2;
    }
    if (i1 && !i2)
        return l1;
    if (i2 && !i1)
        return l2;
    QList<Dialect> qmlLangs = Dialect(Qml).companionLanguages();
    if (qmlLangs.contains(l1) && qmlLangs.contains(l2))
        return Dialect::Qml;
    return Dialect::AnyLanguage;
}
Exemplo n.º 3
0
ODBCSession::ODBCSession()
{
	hdbc = SQL_NULL_HANDLE;
	hstmt = SQL_NULL_HANDLE;
	SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv);
	if(henv)
		SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (void *) SQL_OV_ODBC3, 0);
	tlevel = 0;
	Dialect(MSSQL);
	tmode = NORMAL;
}
Exemplo n.º 4
0
Sqlite3Session::Sqlite3Session()
{
	db = NULL;
	Dialect(SQLITE3);
	busy_timeout = 0;
}