示例#1
0
toConnection::toConnection(const toConnectionOptions &opts)
    : Abort(false)
    , Provider(opts.provider)
    , User(opts.username)
    , Password(opts.password)
    , Host(opts.host)
    , Database(opts.database)
    , Color(opts.color)
    , Options(opts.options)
    , pConnectionImpl(NULL)
    , pTrait(NULL)
    , ConnectionOptions(opts)
    , pCache(NULL)
    , LoanCnt(0)
{
    pConnectionImpl = toConnectionProviderRegistrySing::Instance().get(Provider).createConnectionImpl(*this);
    pTrait = toConnectionProviderRegistrySing::Instance().get(Provider).createConnectionTrait();

    toConnectionSub* connSub = addConnection();
    Version = connSub->version();
    Connections.insert(connSub);

    setDefaultSchema(opts.schema);

    pCache = new toCache(*this, description(false).trimmed());

    ////Version = connSub->version();
    {
        QMutexLocker clock(&ConnectionLock);
        if (toConfigurationNewSingle::Instance().option(ToConfiguration::Database::ObjectCacheInt) == toCache::ON_CONNECT)
            pCache->readCache();

    }
}
示例#2
0
toConnection::toConnection(const toConnection &other)
    : Abort(other.Abort)
    , Provider(other.Provider)
    , User(other.User)
    , Password(other.Password)
    , Host(other.Host)
    , Database(other.Database)
    , Schema(other.Schema)
    , Version(other.Version)
    , Color(other.Color)
    , Options(other.Options)
    , pConnectionImpl(NULL)
    , pTrait(other.pTrait)
    , ConnectionOptions(other.ConnectionOptions)
    , pCache(NULL)
    , LoanCnt(0)
{
    //tool Connection = toConnectionProvider::connection(Provider, this);
    //ConnectionPool = new toConnectionPool(this);

    //PoolPtr sub(ConnectionPool);
    //Version = Connection->version(*sub);

    setDefaultSchema(other.Schema);

    {
        QWriteLocker lock(&pCache->cacheLock);
        pCache->refCount.fetchAndAddAcquire(1);
    }
}
示例#3
0
ColorSchema::ColorSchema()
:m_fileRead(false)
,fRelPath(QString::null)
,lastRead(0L)
{
  setDefaultSchema();
  m_numb = 0;
}
示例#4
0
toConnection::toConnection(const QString &provider,
                           const QString &user, const QString &password,
                           const QString &host, const QString &database,
                           const QString &schema,
                           const QString &color,
                           const QSet<QString> &options)
    : Abort(false)
    , Provider(provider)
    , User(user)
    , Password(password)
    , Host(host)
    , Database(database)
    , Color(color)
    , Options(options)
    , pConnectionImpl(NULL)
    , pTrait(NULL)
    , ConnectionOptions(provider, host, database, user, password, schema, color , 0, options)
    , pCache(NULL)
    , LoanCnt(0)
	, Version("0000")
{
    pConnectionImpl = toConnectionProviderRegistrySing::Instance().get(provider).createConnectionImpl(*this);
    pTrait = toConnectionProviderRegistrySing::Instance().get(provider).createConnectionTrait();

    toConnectionSub* connSub = addConnection();
    Version = connSub->version();
    Connections.insert(connSub);

    setDefaultSchema(schema);

    if(!ConnectionOptions.options.contains("TEST"))
    {
    	pCache = new toCache(*this, description(false).trimmed());
    	////Version = connSub->version();

        QMutexLocker clock(&ConnectionLock);
        if (toConfigurationNewSingle::Instance().option(ToConfiguration::Database::ObjectCacheInt).toInt() == toCache::ON_CONNECT)
            pCache->readCache();
    }
}
示例#5
0
ColorSchema::ColorSchema(const QString& pathname)
:m_fileRead(false)
,lastRead(new QDateTime())
{
  //start with a valid time, aleXXX
  *lastRead = QDateTime::currentDateTime();
  QString fPath = pathname.startsWith("/") ? pathname : locate("data", "konsole/"+pathname);
  if (fPath.isEmpty() || !QFile::exists(fPath))
  {
    fRelPath = QString::null;
    setDefaultSchema();
  }
  else
  {
    fRelPath = pathname;
    clearSchema();
/*  this is done on demand, see the headers, aleXXX
    (void) rereadSchemaFile(); */
  }

  m_numb = serial++;
}