Hi:

I am using Connector/J 3.0.2 against MySQL
3.23.52-max.

My default table type is set to InnoDB (since I 
always use innodb).

The following methods are acting strangely:

- DatabaseMetaData.getImportedKeys()
- DatabaseMetaData.getExportedKeys()

Often these methods return partial information and
sometimes no information. Here's a simple test harness
that illustrates the issue.

--- set up test tables [cut-n-paste this] ------------

CREATE TABLE UserStatus (
 id          TINYINT NOT NULL AUTO_INCREMENT,
 type        CHAR(50),
 PRIMARY KEY (id)
);

CREATE TABLE UserType (
 id          TINYINT NOT NULL AUTO_INCREMENT,
 type        CHAR(20) NOT NULL,
 PRIMARY KEY (id)
);

CREATE TABLE Locations (
 id           INTEGER NOT NULL AUTO_INCREMENT,
 name         VARCHAR(30),
 department   VARCHAR(50),
 PRIMARY KEY (id)
);

CREATE TABLE Users (
 id           INTEGER AUTO_INCREMENT,
 locationID   INTEGER DEFAULT NULL,
 userTypeID   TINYINT NOT NULL,
 statusID     TINYINT NOT NULL,
 username     VARCHAR(50) NOT NULL UNIQUE,
 PRIMARY KEY (id), 
 
 FOREIGN KEY (statusID)
   REFERENCES UserStatus(id), INDEX(statusID) , 
 FOREIGN KEY (locationID)
   REFERENCES Locations(id), INDEX(locationID) , 
 FOREIGN KEY (userTypeID)
   REFERENCES UserType(id), INDEX(userTypeID) 
);

CREATE TABLE Groups (
 id        INTEGER NOT NULL AUTO_INCREMENT,
 name      VARCHAR(50) NOT NULL,
 PRIMARY KEY (id)
);

CREATE TABLE UsersAndGroups(
 userID     INTEGER NOT NULL,
 groupID    INTEGER NOT NULL,
 dateAdded  TIMESTAMP,
 PRIMARY KEY (userID, groupID)
);

---------------- end test tables -------------

Create the above tables in a test database. Make
sure you specify innodb as the default table type.
(otherwise hack the above to add tabletype=innodb
for each table).

Now, after connecting to this database, call
getImportedKeys and getExportedKeys thru your
java code. Specify the "Users" table.

Findings:

1. ImportedKeys
Expected-to-see: statusID, locationID, userTypeID
Actual: statusID

2. ExportedKeys
Expected-to-see: UsersAndGroups
Actual: empty

I am trying to write an automated tool that examines
a database and generated a java dbobjects layer. It's
quite possible that I am missing something here but
it's also possible that the driver is buggy because
the expected and actual values diverge significantly.

Best regards,

[EMAIL PROTECTED]


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to