I have tried everything I can think of, but I just cant dump data out of
bytea fields in postgres with ddlutils ant tasks. has anyone else had
this problem? does anyone know a workaround/solution?
running ant 1.6.5
java 1.5
<target name="database-dump-postgres" description="Dumps the database structure"
depends="getddldbinfo">
<taskdef name="databaseToDdl"
classname="org.apache.ddlutils.task.DatabaseToDdlTask">
<classpath refid="runtime-classpath"/>
</taskdef>
<delete dir="${database.backup.path}/src/schema"></delete>
<mkdir dir="${database.backup.path}/src/schema"/>
<databaseToDdl modelName="MyModel" databaseType="postgresql"
useDelimitedSqlIdentifiers="true">
<database
url="jdbc:postgresql://${system.database.hostname}/${database.name}"
driverClassName="org.postgresql.Driver"
username="${database.user}"
password="${database.password}"/>
<writeSchemaToFile
outputFile="${database.backup.path}/src/schema/${database.backup.path}-schema.xml"/>
<writeDataToFile
outputFile="${database.backup.path}/src/schema/${database.backup.path}-data.xml"/>
</databaseToDdl>
</target>
for a table with def:
CREATE TABLE binarydata (
binaryid bigint NOT NULL,
categoryid bigint,
name character varying(200),
mimetypeid bigint,
published boolean,
properties bytea,
binarydata bytea,
currentowner bigint DEFAULT 5,
modifieddate timestamp with time zone,
creationdate timestamp with time zone,
creator bigint DEFAULT 5
);
I get this as schema:
<table name="binarydata">
<column name="binaryid" primaryKey="true" required="true" type="BIGINT" size="8"
autoIncrement="false"/>
<column name="categoryid" primaryKey="false" required="false" type="BIGINT" size="8"
autoIncrement="false"/>
<column name="name" primaryKey="false" required="false" type="VARCHAR" size="50"
autoIncrement="false"/>
<column name="mimetypeid" primaryKey="false" required="false" type="BIGINT" size="8"
autoIncrement="false"/>
<column name="published" primaryKey="false" required="false" type="BIT" size="1"
autoIncrement="false"/>
<column name="properties" primaryKey="false" required="false" type="BINARY"
autoIncrement="false"/>
<column name="binarydata" primaryKey="false" required="false" type="BINARY"
autoIncrement="false"/>
<column name="currentowner" primaryKey="false" required="false" type="BIGINT" size="8"
default="5" autoIncrement="false"/>
<column name="modifieddate" primaryKey="false" required="false" type="TIMESTAMP"
size="8" autoIncrement="false"/>
<column name="creationdate" primaryKey="false" required="false" type="TIMESTAMP"
size="8" autoIncrement="false"/>
<column name="creator" primaryKey="false" required="false" type="BIGINT" size="8"
default="5" autoIncrement="false"/>
<unique name="aaaaabinarydata_pk">
<unique-column name="binaryid"/>
</unique>
<index name="categoryid">
<index-column name="categoryid"/>
</index>
<index name="datacatagorytreebinarydata">
<index-column name="categoryid"/>
</index>
</table>
I get this as data:
<binarydata binaryid="13" categoryid="1008" name="banner_info.jpg" mimetypeid="0" published="0"
binarydata="[EMAIL PROTECTED]" currentowner="5" modifieddate="2005-
09-09 14:50:12.343" creationdate="2005-09-09 14:50:12.343" creator="5"/>
but the actual data in the binarydata field is NOT "[EMAIL PROTECTED]"
I tried messing with the mappings and rebuilding from source but made no
difference.
any help appreciated.
thanks