Package railo.runtime.db

Examples of railo.runtime.db.DatasourceConnection


        this.password=password;
        //this.table=table;
        pool = config.getDatasourceConnectionPool();
        console=LogConsole.getInstance(config,logLevel);
       
        DatasourceConnection dc=null;
      try {
      dc = pool.getDatasourceConnection(pc,datasource, username, password);
      try {
        new QueryImpl(pc,dc,SELECT,-1,-1,-1,"query");
      }
View Full Code Here


    }


    @Override
    public void log(int level, String application, String message) {
      DatasourceConnection dc=null;
      try {
      dc = pool.getDatasourceConnection(ThreadLocalPageContext.get(),datasource, username, password);
      SQLImpl sql = new SQLImpl(INSERT);
      sql.addItems(new SQLItemImpl(application,CFTypes.VARCHAR));
      sql.addItems(new SQLItemImpl(message,CFTypes.VARCHAR));
View Full Code Here

    DataSource ds=o instanceof DataSource?
        (DataSource)o:
        CommonUtil.getDataSource(pc,CommonUtil.toString(o));
   
       
    DatasourceConnection dc = CommonUtil.getDatasourceConnection(pc,ds);
     
    try{
      SessionFactoryData data = getSessionFactoryData(pc, INIT_NOTHING);
      return new HibernateORMSession(data,dc);
    }
View Full Code Here

            throw ExceptionUtil.createException(data,null,"orm setting autogenmap=false is not supported yet",null);
       
          // load entities
          if(!ArrayUtil.isEmpty(data.tmpList)) {
            data.getNamingStrategy();// caled here to make sure, it is called in the right context the first one
            DatasourceConnection dc = CommonUtil.getDatasourceConnection(pc, ds);
            try {
              Iterator<Component> it = data.tmpList.iterator();
              while(it.hasNext()){
                createMapping(pc,it.next(),dc,ormConf,data);
              }
            }
            finally {
              CommonUtil.releaseDatasourceConnection(pc, dc);
            }
            if(data.tmpList.size()!=data.cfcs.size()){
              Component cfc;
              String name,lcName;
              Map<String,String> names=new HashMap<String,String>();
              Iterator<Component> it = data.tmpList.iterator();
              while(it.hasNext()){
                cfc=it.next();
                name=HibernateCaster.getEntityName(cfc);
                lcName=name.toLowerCase();
                if(names.containsKey(lcName))
                  throw ExceptionUtil.createException(data,null,"Entity Name ["+name+"] is ambigous, ["+names.get(lcName)+"] and ["+cfc.getPageSource().getDisplayPath()+"] use the same entity name.","");
                names.put(lcName,cfc.getPageSource().getDisplayPath());
             
            }
          }
        }
      }
    }
    finally {
      data.tmpList=null;
    }
       
    // already initialized for this application context
    if(data.getConfiguration()!=null) return data;

    //MUST
    //cacheconfig
    //cacheprovider
    //...
   
    String mappings=HibernateSessionFactory.createMappings(ormConf,data);
   
    DatasourceConnection dc = CommonUtil.getDatasourceConnection(pc,ds);
    try{
      data.setConfiguration(mappings,dc);
    }
    catch (Exception e) {
      throw CommonUtil.toPageException(e);
View Full Code Here

 
 
  protected static Struct _loadData(PageContext pc, String datasourceName,String strType,int type, Log log, boolean mxStyle) throws PageException  {
    ConfigImpl config = (ConfigImpl)pc.getConfig();
    DatasourceConnectionPool pool = config.getDatasourceConnectionPool();
    DatasourceConnection dc=pool.getDatasourceConnection(pc,((PageContextImpl)pc).getDataSource(datasourceName),null,null);
    SQLExecutor executor=SQLExecutionFactory.getInstance(dc);
   
   
    Query query;
   
    try {
      if(!dc.getDatasource().isStorage())
        throw new ApplicationException("storage usage for this datasource is disabled, you can enable this in the railo administrator.");
      query = executor.select(pc.getConfig(),pc.getCFID(),pc.getApplicationContext().getName(), dc, type,log, true);
    }
    catch (SQLException se) {
      throw Caster.toPageException(se);
View Full Code Here

  }
 
  public void store(Config config) {
    //if(!super.hasContent()) return;
   
    DatasourceConnection dc = null;
    ConfigImpl ci = (ConfigImpl)config;
    DatasourceConnectionPool pool = ci.getDatasourceConnectionPool();
    Log log=((ConfigImpl)config).getScopeLogger();
    try {
      PageContext pc = ThreadLocalPageContext.get();// FUTURE change method interface
View Full Code Here

    }
  }
 
  public void unstore(Config config) {
    ConfigImpl ci=(ConfigImpl) config;
    DatasourceConnection dc = null;
   
   
    DatasourceConnectionPool pool = ci.getDatasourceConnectionPool();
    Log log=((ConfigImpl)config).getScopeLogger();
    try {
View Full Code Here

    }
  }

  private void clean(ConfigWeb config, DataSource dataSource) throws PageException, SQLException  {
    ConfigWebImpl cwi=(ConfigWebImpl) config;
    DatasourceConnection dc=null;
   
    DatasourceConnectionPool pool = cwi.getDatasourceConnectionPool();
    try {
      dc=pool.getDatasourceConnection(null,dataSource,null,null);
      Log log=((ConfigImpl)config).getScopeLogger();
View Full Code Here

   
   
   
      Struct res=new StructImpl();
    DataSourceManager manager = pageContext.getDataSourceManager();
    DatasourceConnection dc = ds instanceof DataSource?
        manager.getConnection(pageContext,(DataSource)ds,username,password):
        manager.getConnection(pageContext,Caster.toString(ds),username,password);
   
    // create returnValue
    returnValue(dc);
   
    // create SQL
    StringBuilder sql=createSQL();
   

    // add returnValue to params
    if(returnValue!=null){
      params.add(0,returnValue);
    }
   
    SQLImpl _sql=new SQLImpl(sql.toString());
    CallableStatement callStat=null;
    try {
        callStat = dc.getConnection().prepareCall(sql.toString());
            //ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            //ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
       
        if(blockfactor>0)callStat.setFetchSize(blockfactor);
        if(timeout>0)callStat.setQueryTimeout(timeout);
View Full Code Here

    Object ds=getDatasource(pageContext,datasource);
   
   
   
    DataSourceManager manager = pageContext.getDataSourceManager();
      DatasourceConnection dc=ds instanceof DataSource?
          manager.getConnection(pageContext,(DataSource)ds,username,password):
          manager.getConnection(pageContext,Caster.toString(ds),username,password);
      try {
       
        Struct meta =null;
View Full Code Here

TOP

Related Classes of railo.runtime.db.DatasourceConnection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.