use of com.revolsys.gis.postgresql.type.PostgreSQLGeometryFieldAdder in project com.revolsys.open by revolsys.
the class PostgreSQLRecordStore method initializeDo.
@Override
public void initializeDo() {
super.initializeDo();
final JdbcFieldAdder numberFieldAdder = new JdbcFieldAdder(DataTypes.DECIMAL);
addFieldAdder("numeric", numberFieldAdder);
final JdbcFieldAdder stringFieldAdder = new JdbcFieldAdder(DataTypes.STRING);
addFieldAdder("varchar", stringFieldAdder);
addFieldAdder("text", stringFieldAdder);
addFieldAdder("name", stringFieldAdder);
addFieldAdder("bpchar", stringFieldAdder);
final JdbcFieldAdder longFieldAdder = new JdbcFieldAdder(DataTypes.LONG);
addFieldAdder("int8", longFieldAdder);
addFieldAdder("bigint", longFieldAdder);
addFieldAdder("bigserial", longFieldAdder);
addFieldAdder("serial8", longFieldAdder);
final JdbcFieldAdder intFieldAdder = new JdbcFieldAdder(DataTypes.INT);
addFieldAdder("int4", intFieldAdder);
addFieldAdder("integer", intFieldAdder);
addFieldAdder("serial", intFieldAdder);
addFieldAdder("serial4", intFieldAdder);
final JdbcFieldAdder shortFieldAdder = new JdbcFieldAdder(DataTypes.SHORT);
addFieldAdder("int2", shortFieldAdder);
addFieldAdder("smallint", shortFieldAdder);
final JdbcFieldAdder floatFieldAdder = new JdbcFieldAdder(DataTypes.FLOAT);
addFieldAdder("float4", floatFieldAdder);
final JdbcFieldAdder doubleFieldAdder = new JdbcFieldAdder(DataTypes.DOUBLE);
addFieldAdder("float8", doubleFieldAdder);
addFieldAdder("double precision", doubleFieldAdder);
addFieldAdder("date", new JdbcFieldAdder(DataTypes.DATE_TIME));
addFieldAdder("timestamp", new JdbcFieldAdder(DataTypes.TIMESTAMP));
addFieldAdder("bool", new JdbcFieldAdder(DataTypes.BOOLEAN));
addFieldAdder("oid", PostgreSQLJdbcBlobFieldDefinition::new);
final JdbcFieldAdder geometryFieldAdder = new PostgreSQLGeometryFieldAdder(this);
addFieldAdder("geometry", geometryFieldAdder);
setPrimaryKeySql(//
"SELECT t.relname \"TABLE_NAME\", c.attname \"COLUMN_NAME\"" + //
" FROM pg_namespace s" + //
" join pg_class t on t.relnamespace = s.oid" + //
" join pg_index i on i.indrelid = t.oid " + //
" join pg_attribute c on c.attrelid = t.oid" + " WHERE s.nspname = ? AND c.attnum = any(i.indkey) AND i.indisprimary");
setPrimaryKeyTableCondition(" AND r.relname = ?");
setSchemaPermissionsSql("select distinct t.table_schema as \"SCHEMA_NAME\" " + "from information_schema.role_table_grants t " + "where (t.grantee in (current_user, 'PUBLIC') or " + "t.grantee in (select role_name from information_schema.applicable_roles r where r.grantee = current_user)) and " + "privilege_type IN ('SELECT', 'INSERT','UPDATE','DELETE') ");
setSchemaTablePermissionsSql("select distinct t.table_schema as \"SCHEMA_NAME\", t.table_name, t.privilege_type as \"PRIVILEGE\", d.description as \"REMARKS\", " + " CASE WHEN relkind = 'r' THEN 'TABLE' WHEN relkind = 'v' THEN 'VIEW' ELSE relkind || '' END \"TABLE_TYPE\" " + //
"from" + //
" information_schema.role_table_grants t" + //
" join pg_namespace n on t.table_schema = n.nspname" + //
" join pg_class c on (n.oid = c.relnamespace AND t.table_name = c.relname)" + //
" left join pg_description d on d.objoid = c.oid " + //
"where" + //
" t.table_schema = ? and " + " (t.grantee in (current_user, 'PUBLIC') or t.grantee in (select role_name from information_schema.applicable_roles r where r.grantee = current_user)) AND " + " privilege_type IN ('SELECT', 'INSERT','UPDATE','DELETE') " + " order by t.table_schema, t.table_name, t.privilege_type");
}
Aggregations