Creates a new project from the current row of the given result set.<p>

@param res the result set

@return the new project

@throws SQLException is something goes wrong
180550
protected CmsProject internalCreateProject(ResultSet res) throws SQLException {

        String ou = CmsOrganizationalUnit.removeLeadingSeparator(
            res.getString(m_sqlManager.readQuery("C_PROJECTS_PROJECT_OU_0")));
        return new CmsProject(
            new CmsUUID(res.getString(m_sqlManager.readQuery("C_PROJECTS_PROJECT_ID_0"))),
            ou + res.getString(m_sqlManager.readQuery("C_PROJECTS_PROJECT_NAME_0")),
            res.getString(m_sqlManager.readQuery("C_PROJECTS_PROJECT_DESCRIPTION_0")),
            new CmsUUID(res.getString(m_sqlManager.readQuery("C_PROJECTS_USER_ID_0"))),
            new CmsUUID(res.getString(m_sqlManager.readQuery("C_PROJECTS_GROUP_ID_0"))),
            new CmsUUID(res.getString(m_sqlManager.readQuery("C_PROJECTS_MANAGERGROUP_ID_0"))),
            res.getInt(m_sqlManager.readQuery("C_PROJECTS_PROJECT_FLAGS_0")),
            res.getLong(m_sqlManager.readQuery("C_PROJECTS_DATE_CREATED_0")),
            CmsProject.CmsProjectType.valueOf(res.getInt(m_sqlManager.readQuery("C_PROJECTS_PROJECT_TYPE_0"))));
    }
479654
protected final <T> T createDataSource(Class<T> dataSourceClass) throws SQLException {
		if (getRealDataSourceClassName() == null) {
			throw new SQLException("Property realDataSourceClassName is not set");
		}
		try {
			T ds = dataSourceClass.cast(Class.forName(realDataSourceClassName).newInstance());
			for (Method m : ds.getClass().getMethods()) {
				String methodName = m.getName();
				if (methodName.startsWith("set") && m.getParameterTypes().length == 1) {
					final Object propertyValue;
					if (methodName.equals("setUser")) {
						propertyValue = getUser();
					} else if (methodName.equals("setPassword")) {
						propertyValue = getPassword();
					} else if (methodName.equalsIgnoreCase("setUrl")) {
						propertyValue = getRealUrl();
					} else if (methodName.equals("setLogWriter")) {
						propertyValue = getLogWriter();
					} else if (methodName.equals("setLoginTimeout")) {
						propertyValue = getLoginTimeout();
					} else {
						String propertyName = methodName.substring(3, 4).toLowerCase();
						if (methodName.length() > 4) {
							propertyName += methodName.substring(4);
						}
						final Class<?> propertyType = m.getParameterTypes()[0];
						propertyValue = getPropertyAs(propertyName, propertyType);
					}
					if (propertyValue != null) {
						m.invoke(ds, propertyValue);
					}
				}
			}
			return ds;

		} catch (Exception e) {
			throw new SQLException(e);
		}
	}
1085301
private void processResources() throws SQLException
   {
      List<Row> rows = getRows("select * from zresource where zproject=? order by zorderinproject", m_projectID);
      for (Row row : rows)
      {
         Resource resource = m_project.addResource();
         resource.setUniqueID(row.getInteger("Z_PK"));
         resource.setEmailAddress(row.getString("ZEMAIL"));
         resource.setInitials(row.getString("ZINITIALS"));
         resource.setName(row.getString("ZTITLE_"));
         resource.setGUID(row.getUUID("ZUNIQUEID"));
         resource.setType(row.getResourceType("ZTYPE"));
         resource.setMaterialLabel(row.getString("ZMATERIALUNIT"));

         if (resource.getType() == ResourceType.WORK)
         {
            resource.setMaxUnits(Double.valueOf(NumberHelper.getDouble(row.getDouble("ZAVAILABLEUNITS_")) * 100.0));
         }

         Integer calendarID = row.getInteger("ZRESOURCECALENDAR");
         if (calendarID != null)
         {
            ProjectCalendar calendar = m_project.getCalendarByUniqueID(calendarID);
            if (calendar != null)
            {
               calendar.setName(resource.getName());
               resource.setResourceCalendar(calendar);
            }
         }

         m_eventManager.fireResourceReadEvent(resource);
      }
   }
361835
@Bean
    public DataSource dataSource() throws SQLException {
        if (null != masterSlaveProperties.getMasterDataSourceName()) {
            return MasterSlaveDataSourceFactory.createDataSource(dataSourceMap, masterSlaveSwapper.swap(masterSlaveProperties), propMapProperties.getProps());
        }
        if (!encryptProperties.getEncryptors().isEmpty()) {
            return EncryptDataSourceFactory.createDataSource(dataSourceMap.values().iterator().next(), encryptSwapper.swap(encryptProperties));
        }
        return ShardingDataSourceFactory.createDataSource(dataSourceMap, shardingSwapper.swap(shardingProperties), propMapProperties.getProps());
    }
1230361
public ResultSet executeQuery(String sql) throws SQLException {
    if (executeInternal(sql, fetchSize, Statement.NO_GENERATED_KEYS)) {
      return results.getResultSet();
    }
    return SelectResultSet.createEmptyResultSet();
  }
67596
private void processProjectProperties() throws SQLException
   {
      List<Row> rows = getRows("select * from project_summary where projid=?", m_projectID);
      if (rows.isEmpty() == false)
      {
         m_reader.processProjectProperties(rows.get(0));
      }
   }
1297
public static DataSource createDataSource(Properties poolProperties) throws SQLException {
        assertNotNull(poolProperties);

        try {
            return BasicDataSourceFactory.createDataSource(poolProperties);
        } catch (Exception e) {
            throw new SQLException(e.getMessage());
        }
    }
712645
private void processResources() throws SQLException
   {
      List<Row> rows = getRows("select * from " + m_schema + "rsrc where delete_date is null and rsrc_id in (select rsrc_id from " + m_schema + "taskrsrc t where proj_id=? and delete_date is null) order by rsrc_seq_num", m_projectID);
      m_reader.processResources(rows);
   }
775936
public Page<T> page(String sql, Object[] params, PageRow pageRow) {
        this.beforeCheck();
        Connection conn = getConn();
        try {
            String countSql = useSQL ? "SELECT COUNT(*) FROM (" + sql + ") tmp" : buildCountSQL(sql);

            long count = conn.createQuery(countSql)
                    .withParams(params)
                    .executeAndFetchFirst(Long.class);

            Page<T> pageBean = new Page<>(count, pageRow.getPageNum(), pageRow.getPageSize());

            ifThen(count > 0, () -> {
                String pageSQL = this.buildPageSQL(sql, pageRow);
                List<T> list = conn.createQuery(pageSQL)
                        .withParams(params)
                        .setAutoDeriveColumnNames(true)
                        .throwOnMappingFailure(false)
                        .executeAndFetch(modelClass);

                this.setJoin(list);
                pageBean.setRows(list);
            });

            return pageBean;
        } finally {
            this.closeConn(conn);
            this.clean(null);
        }
    }
1269495
protected CmsPublishJobInfoBean createPublishJobInfoBean(ResultSet res) throws SQLException {

        return new CmsPublishJobInfoBean(
            new CmsUUID(res.getString("HISTORY_ID")),
            new CmsUUID(res.getString("PROJECT_ID")),
            res.getString("PROJECT_NAME"),
            new CmsUUID(res.getString("USER_ID")),
            res.getString("PUBLISH_LOCALE"),
            res.getInt("PUBLISH_FLAGS"),
            res.getInt("RESOURCE_COUNT"),
            res.getLong("ENQUEUE_TIME"),
            res.getLong("START_TIME"),
            res.getLong("FINISH_TIME"));
    }
531770
private User userFromResultSet(final ResultSet rs) throws SQLException {
      String niceName = Strings.nullToEmpty(rs.getString(3)).trim();
      String displayName = Strings.nullToEmpty(rs.getString(4)).trim();
      String useDisplayName = displayName.isEmpty() ? niceName : displayName;
      return new User(rs.getLong(1), rs.getString(2), useDisplayName, niceName, rs.getString(5), rs.getTimestamp(6).getTime(), rs.getString(7), ImmutableList.of());
   }
1357042
protected I_CmsHistoryResource internalCreateResource(ResultSet res) throws SQLException {

        int resourceVersion = res.getInt(m_sqlManager.readQuery("C_RESOURCES_VERSION"));
        int structureVersion = res.getInt(m_sqlManager.readQuery("C_RESOURCES_STRUCTURE_VERSION"));
        int tagId = res.getInt(m_sqlManager.readQuery("C_RESOURCES_PUBLISH_TAG"));
        CmsUUID structureId = new CmsUUID(res.getString(m_sqlManager.readQuery("C_RESOURCES_STRUCTURE_ID")));
        CmsUUID resourceId = new CmsUUID(res.getString(m_sqlManager.readQuery("C_RESOURCES_RESOURCE_ID")));
        String resourcePath = res.getString(m_sqlManager.readQuery("C_RESOURCES_RESOURCE_PATH"));
        int resourceType = res.getInt(m_sqlManager.readQuery("C_RESOURCES_RESOURCE_TYPE"));
        int resourceFlags = res.getInt(m_sqlManager.readQuery("C_RESOURCES_RESOURCE_FLAGS"));
        CmsUUID projectLastModified = new CmsUUID(
            res.getString(m_sqlManager.readQuery("C_RESOURCES_PROJECT_LASTMODIFIED")));
        int state = Math.max(
            res.getInt(m_sqlManager.readQuery("C_RESOURCES_STATE")),
            res.getInt(m_sqlManager.readQuery("C_RESOURCES_STRUCTURE_STATE")));
        long dateCreated = res.getLong(m_sqlManager.readQuery("C_RESOURCES_DATE_CREATED"));
        long dateLastModified = res.getLong(m_sqlManager.readQuery("C_RESOURCES_DATE_LASTMODIFIED"));
        long dateReleased = res.getLong(m_sqlManager.readQuery("C_RESOURCES_DATE_RELEASED"));
        long dateExpired = res.getLong(m_sqlManager.readQuery("C_RESOURCES_DATE_EXPIRED"));
        int resourceSize = res.getInt(m_sqlManager.readQuery("C_RESOURCES_SIZE"));
        CmsUUID userLastModified = new CmsUUID(res.getString(m_sqlManager.readQuery("C_RESOURCES_USER_LASTMODIFIED")));
        CmsUUID userCreated = new CmsUUID(res.getString(m_sqlManager.readQuery("C_RESOURCES_USER_CREATED")));
        CmsUUID parentId = new CmsUUID(res.getString(m_sqlManager.readQuery("C_RESOURCES_HISTORY_PARENTID")));
        long dateContent = res.getLong(m_sqlManager.readQuery("C_RESOURCES_DATE_CONTENT"));

        boolean isFolder = resourcePath.endsWith("/");
        if (isFolder) {
            return new CmsHistoryFolder(
                tagId,
                structureId,
                resourceId,
                resourcePath,
                resourceType,
                resourceFlags,
                projectLastModified,
                CmsResourceState.valueOf(state),
                dateCreated,
                userCreated,
                dateLastModified,
                userLastModified,
                dateReleased,
                dateExpired,
                resourceVersion + structureVersion,
                parentId,
                resourceVersion,
                structureVersion);
        } else {
            return new CmsHistoryFile(
                tagId,
                structureId,
                resourceId,
                resourcePath,
                resourceType,
                resourceFlags,
                projectLastModified,
                CmsResourceState.valueOf(state),
                dateCreated,
                userCreated,
                dateLastModified,
                userLastModified,
                dateReleased,
                dateExpired,
                resourceSize,
                dateContent,
                resourceVersion + structureVersion,
                parentId,
                null,
                resourceVersion,
                structureVersion);
        }
    }
1313299
public static DataSource createDataSource(String url) throws SQLException {
        assertNotNull(url);

        BasicDataSource ds = new BasicDataSource();
        ds.setUrl(url);

        return ds;
    }
258391
public static <T> int createTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException {
		Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass);
		return doCreateTable(dao, false);
	}
198251
protected Statement createStatement(Connection conn, OutputHandler outputHandler, String sql)
            throws SQLException {

        Statement result = null;
        Integer resultSetType = null;
        Integer resultSetConcurrency = null;

        if (outputHandler instanceof LazyScrollOutputHandler) {

            if (overrider.hasOverride(MjdbcConstants.OVERRIDE_LAZY_SCROLL_CHANGE_SENSITIVE) == true) {
                // read value
                overrider.getOverride(MjdbcConstants.OVERRIDE_LAZY_SCROLL_CHANGE_SENSITIVE);

                resultSetType = ResultSet.TYPE_SCROLL_SENSITIVE;
            } else {
                resultSetType = ResultSet.TYPE_SCROLL_INSENSITIVE;
            }
        }

        if (outputHandler instanceof LazyUpdateOutputHandler) {
            resultSetConcurrency = ResultSet.CONCUR_UPDATABLE;
        }

        if (resultSetType == null && resultSetConcurrency == null) {
            result = conn.createStatement();
        } else {

            resultSetType = (resultSetType == null ? ResultSet.TYPE_FORWARD_ONLY : resultSetType);
            resultSetConcurrency = (resultSetConcurrency == null ? ResultSet.CONCUR_READ_ONLY : resultSetConcurrency);

            result = conn.createStatement(resultSetType, resultSetConcurrency);
        }

        return result;
    }
129863
public Result<DATA> create(TRANS trans, DATA data)  {
		if(createPS==null) {
			Result.err(Result.ERR_NotImplemented,"Create is disabled for %s",getClass().getSimpleName());
		}
		if(async) /*ResultSetFuture */ {
			Result<ResultSetFuture> rs = createPS.execAsync(trans, C_TEXT, data);
			if(rs.notOK()) {
				return Result.err(rs);
			}
		} else {
			Result<ResultSet> rs = createPS.exec(trans, C_TEXT, data);
			if(rs.notOK()) {
				return Result.err(rs);
			}
		}
		wasModified(trans, CRUD.create, data);
		return Result.ok(data);
	}
961190
@SuppressWarnings("unchecked")
    @Override
    protected K createKey(ResultSet rs) throws SQLException {
        return (columnName == null) ?
                (K) rs.getObject(columnIndex) :
                (K) rs.getObject(columnName);
    }