db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "eric barbe" <eba...@deliasystems.com>
Subject RE: Informix and Torque
Date Tue, 02 Mar 2004 13:02:09 GMT
This what i found in the documentation, but it only i can give you ;-(

SERIAL(n)
The SERIAL data type stores a sequential integer that is automatically
assigned by the database server when a new row is inserted. You can define
only one SERIAL column in a table.
SERIAL values in a column are not automatically unique. You must apply a
unique index or primary key constraint to this column to prevent duplicate
SERIAL numbers. If you use the interactive schema editor in DB-Access to
define the table, a unique index is applied automatically to a SERIAL
column.
Also, SERIAL numbers might not be contiguous due to such factors as
multiuser systems and rollbacks.
The DEFINE variable LIKE column syntax of SPL for indirect typing declares a
variable of the INTEGER data type if column is a SERIAL data type.
The default SERIAL starting number is 1, but you can assign a non-default
initial value, n, when you create or alter the table. Any number greater
than
0 can be your starting number. The maximum SERIAL is 2,147,483,647. If you
assign a number greater than 2,147,483,647, you receive a syntax error. (Use
the SERIAL8 data type, rather than SERIAL, if you need a larger range.)
After a nonzero number is assigned, it cannot be changed. You can insert a
value into a SERIAL column (using the INSERT statement) or reset a SERIAL
column (using the ALTER TABLE statement), if the new value does not
duplicate any existing value in the column. To insert into a SERIAL column,
your database server increments by 1 the previous value (or the reset value,
if that is larger) and assigns the result as the entered value. If ALTER
TABLE
has reset the next value of a SERIAL column to a value smaller than values
already in that column, however, the next value follows this formula:
(maximum existing value in SERIAL column) + 1
For example, if you reset the SERIAL value of customer.customer_num to 50,
when the largest existing value is 128, the next assigned number will be
129.
For more details on SERIAL data entry, see the IBM Informix Guide to SQL:
Syntax.

SERIAL8(n)
The SERIAL8 data type stores a sequential integer assigned automatically by
the database server when a new row is inserted. It behaves like the SERIAL
data type, but with a larger range. (For more information on how to insert
values into SERIAL8 columns, see the IBM Informix Guide to SQL: Syntax.)
A SERIAL8 data column is commonly used to store large, unique numeric
codes (for example, order, invoice, or customer numbers). SERIAL8 data
values have the same precision and storage requirements as INT8 values
(page 2-21). The following restrictions apply to SERIAL8 columns:
 You can define only one SERIAL8 column in a table.
However, a table can have one SERIAL8 and one SERIAL column.
 SERIAL8 column values are not automatically unique.
You must apply a unique index or primary key constraint to this column
to prevent duplicate SERIAL8 numbers.
 The SERIAL8 data type does not allow a NULL value.
If you are using the interactive schema editor in DB-Access to define the
table,
a unique index is applied automatically to a SERIAL8 column.
The DEFINE variable LIKE column syntax of SPL for indirect typing declares
variable of the INT8 data type if column is a SERIAL8 data type.

Eric

-----Message d'origine-----
De : Giulio Vezzelli [mailto:giulio.vezzelli@infolog.it]
Envoyé : mardi 2 mars 2004 12:06
À : 'Apache Torque Users List'
Objet : R: Informix and Torque


Thanks Eric!

I'm trying it today.

By the way, do you know anything about Informix's SERIAL type ?

It's a sort of autoincrementing int key. I do not see it being supported by
Torque right now...
Since I need it, if it's missing, I'll have to add support for it!


Giulio Vezzelli
Infolog S.r.l.
Via Alfieri, 28
Modena - 41100
Telefono : +39-059-822446
Sito web : http://www.infolog.it
E-mail : giulio.vezzelli@infolog.it



> -----Messaggio originale-----
> Da: eric barbe [mailto:ebarbe@deliasystems.com]
> Inviato: martedì 2 marzo 2004 11.54
> A: Apache Torque Users List
> Oggetto: RE: Informix and Torque
>
> Sorry...
>
> columns.vm
>
> #foreach ($col in $table.Columns)
>     #set ( $type = $dbprops.get($col.Type) )
>     #set ( $size = $col.printSize() )
>     #set ( $default = $col.DefaultSetting )
>     #set ( $nullString = $strings.select($col.isNotNull(),
> $dbprops.get("NOTNULL"),"") )
>     #set ( $entry = "$col.Name $type $size $default $nullString," )
>     $strings.sub($strings.collapseSpaces($entry)," ,",",") #end
>
> create.vm
>
> #foreach ($tbl in $database.tables)
> #if (!$tbl.isSkipSql())
> $generator.parse("$basepath/table.vm", $outFile, "table",
> $tbl) #end #end
>
> db.props
>
> BIT = BOOLEAN
> TINYINT = TINYINT
> SMALLINT = SMALLINT
> INTEGER = INTEGER
> BIGINT = BIGINT
> FLOAT = FLOAT
> REAL = REAL
> DOUBLE = FLOAT
> NUMERIC = NUMERIC
> DECIMAL = DECIMAL
> CHAR = CHAR
> VARCHAR = NCHAR
> LONGVARCHAR = LVARCHAR(4000)
> DATE = DATETIME YEAR TO SECOND
> TIME = DATETIME YEAR TO SECOND
> TIMESTAMP = DATETIME YEAR TO SECOND
> BINARY = BINARY(7132)
> VARBINARY = IMAGE
> LONGVARBINARY = IMAGE
> NULL = NULL
> OTHER =
> JAVA_OBJECT =
> DISTINCT =
> STRUCT =
> ARRAY =
> BLOB = IMAGE
> CLOB = TEXT
> REF =
>
> AUTOINCREMENT = IDENTITY (1,1)
> NOTNULL = NOT NULL
>
> removeNotNullWithAutoIncrement = false
> suppressDefaults = false
> maxColumnNameLength = 30
>
> drop.vm
>
> #set( $max = 0 )
> #foreach( $tbl in $database.tables )
> #set( $max = $max + 1 )
> #end
> #set( $max = $max - 1)
> #foreach( $i in [ $max .. 0 ] )
> #set( $j = 0 )
> #foreach( $tbl in $database.tables )
> #if( $j == $i )
> #if( !$tbl.isSkipSql() )
> $generator.parse("$targetDatabase/droptable.vm", $outFile,
> "table", $tbl) #end #end #set( $j = $j + 1 ) #end #end
>
> droptable.vm
>
> DROP TABLE $table.Name CASCADE;
>
> foreignkey.vm
>
> #foreach ($fk in $table.ForeignKeys)
> ALTER TABLE $table.Name
>     ADD CONSTRAINT FOREIGN KEY ($fk.LocalColumnNames)
>     REFERENCES $fk.ForeignTableName ($fk.ForeignColumnNames)
>     CONSTRAINT $fk.Name
> #if ($fk.hasOnUpdate())
>     ON UPDATE $fk.OnUpdate
> #end
> #if ($fk.hasOnDelete())
>     ON DELETE $fk.OnDelete
> #end
> ;
>
> #end
>
> index.vm
>
> #foreach ($index in $table.Indices)
> CREATE #if($index.Unique)UNIQUE#end INDEX $index.Name ON
> $table.Name ($index.ColumnList); #end
>
> primarykey.vm
>
> #if ($table.hasPrimaryKey())
>     PRIMARY KEY($table.printPrimaryKey()), #end
>
> table.vm
>
>
> /*
> --------------------------------------------------------------
> -------- */
> /* $table.Name                                                      */
> /*
> --------------------------------------------------------------
> -------- */
>
> CREATE TABLE $table.Name
> (
> #set ( $cols = $generator.parse("$basepath/columns.vm", "",
> "table", $tbl) ) #set ( $pk =
> $generator.parse("$basepath/primarykey.vm", "", "table",
> $tbl) )
> #set ( $unique = $generator.parse("$basepath/unique.vm", "", "table",
> $tbl) )
> #if($strings.allEmpty([$pk,$unique]))$strings.chop($cols,1)#el
> se$cols#end
> #if($strings.allEmpty([$unique]) &&
> $pk.length()>0)$strings.chop($pk,2)#else$pk#end
> #if($unique.length()>0)$strings.chop($unique,2)#end
> );
> $generator.parse("$basepath/foreignkey.vm", "", "table", $tbl)
>
> tablefk.vm
>
>
> /*
> --------------------------------------------------------------
> -------- */
> /* $table.Name                                                      */
> /*
> --------------------------------------------------------------
> -------- */
>
> #set ( $fk = $generator.parse("$basepath/foreignkey.vm", "", "table",
> $tbl) )
> #if($fk.length() >0)$fk#end
>
>
> unique.vm
>
> #foreach ($unique in $table.Unices)
>     UNIQUE ($unique.ColumnList),
> #end
> -----Message d'origine-----
> De : eric barbe [mailto:ebarbe@deliasystems.com] Envoyé :
> mardi 2 mars 2004 11:48 À : Apache Torque Users List Objet :
> RE: Informix and Torque
>
>
> May be this can help you. It works on Informix 9.4 !
>
> -----Message d'origine-----
> De : Luca Zappa [mailto:luca@lucazappa.com] Envoyé : mardi 2
> mars 2004 11:06 À : torque-user@db.apache.org Objet : Re:
> Informix and Torque
>
>
>
> No experience with Informix, but the adapter is included:
>
>
> org.apache.torque.adapter.DBInformix
>
>
>
>
> -----Original Message-----
> From: "Giulio Vezzelli" <giulio.vezzelli@infolog.it>
> Sent: Tuesday, 2. Mar 2004 10:52 +0100
> To: <torque-user@db.apache.org>
> Subject: Informix and Torque
>
> Someone has experience of running Torque on Informix ?
>
> I see in Torque's homepage that it should be supported, but I
> don't see the DB adapter in the code...
>
>
>
> Giulio Vezzelli
> Infolog S.r.l.
> Via Alfieri, 28
> Modena - 41100
> Telefono : +39-059-822446
> Sito web : http://www.infolog.it <"
> target="_blank">http://www.infolog.it/>;
> E-mail : giulio.vezzelli@infolog.it
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message