Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [stellation-res] Database abstraction

On Tue, Aug 13, 2002 at 09:19:08PM +0000, Mark C. Chu-Carroll wrote:
> On Tuesday 13 August 2002 02:06 pm, Mark C. Chu-Carroll wrote:
> >
> > Here's the original SQL:
> >
> > 	CREATE TABLE Properties (INTEGER aid,
> > 					        INTEGER vid,
> > 					        INTEGER inheritable,
> > 						VARCHAR(200) name,
> > 						VARCHAR(1600) value,
> > 			CONSTRAINT fk3 FOREIGN KEY (aid, vid) REFERENCES Versions(aid, vid)
> > 			PRIMARY KEY(aid, vid, name))
> >
> 
> OK... Here's the new version:
> AbstractDatabase db;
> String command = "CREATE TABLE Properties" + 
> 		db.getIntegerType() + " aid, " +
> 		db.getIntegerType() + " vid, " +
> 		db.getIntegerType() + " inheritable, " +
> 		db.getShortStringType() + " name, " +
> 		db.getLongStringType() + " value," +
> 	        "CONSTRAINT fk3 FOREIGN KEY (aid, vid) " +
> 		" REFERENCES Versions(aid, vid), " +
> 		 "PRIMARY KEY(aid, vid, name)" +
> 		 db.getCreateTrailer();
> 
> It's enough to get past the differences in datatypes between the
> databases, and to let us automatically insert the DDL annotations
> that are used in MySQL to specify InnoDB tables.

How about:
   String dbIntegerDataType = db.getIntegerType();
   .
   .
   .

florin

-- 

"If it's not broken, let's fix it till it is."

41A9 2BDE 8E11 F1C5 87A6  03EE 34B3 E075 3B90 DFE4

Attachment: pgppychA5Rd79.pgp
Description: PGP signature


Back to the top