The UNSIGNED type is not in the DTD because it is not part of any SQL Standard. The SQL standard for this type of data is to use one of the following column types: BIT, BINARY, or VARBINARY column type (with possible CHAR and DECIMAL options).
Unfortunately, it looks like Village doesn't properly support BIT (it assumes a 1 byte Boolean.. need to fix this now that we have control of Village...). And BINARY and VARBINARY are mapped to BLOBS which aren't very efficient. That said, the best bet would be to manually define the column type to be an UNSIGNED INTEGER in the DB and then use BIGINT as the type in the schema. This will make the Record object use the long type and avoid having large binary int values become negative. As to ensuring the proper values get placed into this, you can either depend on JDBC or SQL to throw an exception if the value is too large (e.g. a negative number of type long SHOULD be considered as too many bits). Or you can just add some checks to the set<Column>(long) method in the stub. Hope this makes sense.. > -----Original Message----- > From: Martin Tilsted [mailto:[EMAIL PROTECTED] > Sent: Saturday, November 29, 2008 11:52 AM > To: Apache Torque Users List > Subject: Unsigned integers > > How do i handle unsigned integers with torque (Using MySql 5.0)? > > I use maven torque:jdbc to generate my schema.xml file, but i have a > field(Ip) that is an unsigned int in the database, > but that generate a > <column name="Ip" type="INTEGER"/> > in the schema file. > So I have 2 questions: > > 1: How do I get maven torque:jdbc to generate a schema for an unsigned > int? Is this even possible? I could not find the documentation for the > schema.xml format. > > 2: If i keep the signed integer version in my schema, but the field is > unsigned in the database, what happens if call setInt() with a negative > value.? > > Martin > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > DukeCE Privacy Statement: Please be advised that this e-mail and any files transmitted with it are confidential communication or may otherwise be privileged or confidential and are intended solely for the individual or entity to whom they are addressed. If you are not the intended recipient you may not rely on the contents of this email or any attachments, and we ask that you please not read, copy or retransmit this communication, but reply to the sender and destroy the email, its contents, and all copies thereof immediately. Any unauthorized dissemination, distribution or copying of this communication is strictly prohibited.