Search the web
Sign In
New User? Sign Up
metabase-dev · Metabase Development discussions list
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Show off your group to the world. Share a photo of your group with us.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Auto-increment and primary key support   Message List  
Reply | Forward Message #1122 of 1151 |
Hello,

After a long time without significant enhancements to Metabase, I am
finally adding support to database schema features like auto-increment
fields and primary keys. Future versions of Metastorage will generate
code that takes advantage of these features.

Currently the new Metabase version is in alpha stage as the support for
these features is not completely done. Here is the status:

- autoincrement is a new option of the schema of table fields. It
automatically expands to integer, notnull, default 0 and primary key.

- There are two new functions in the API GetNextKey and GetInsertedKey.
GetNextKey determines what to put in an insert statement in the place of
the value an auto-increment field. GetInsertedKey retrieves the last
inserted value in autoincrement field. These functions are run before
and after an insert query respectively.

- primarykey is a new section of table schema definition. The definition
is similar to indexes but you can only have one primary key per table.

- These features are implemented in the drivers for MySQL, PostgreSQL
and Oracle. If you have access to other databases like Microsoft SQL
server, Interbase, Informix, SQLite, Access/ODBC, mini-SQL, please let
me know because currently I am not able to test the new features in all
these databases.

- Altering tables with primary keys or autoincrement fields is not yet
implemented.

- There is a new database manager API function named
CreateDetailedTable. This is an extension of the CreateTable function to
allow for creation of tables with primary keys and other features in the
future. It supports a check mode that lets the schema manager know if
the described table can be created by the database driver.

- The schema manager now performs a safety check when installing or
altering databases with new tables. If it is not possible to install a
table because the current driver does not support some features, nothing
is changed in the database and the schema manager will return an
explanatory error message.

- Schema reverse engineering of database tables with auto-increment
fields or primary keys is not yet implemented.

- The driver test suite has now a new test named autoincrement that
tries to insert a few records in a new table with an autoincrement field
and verifies if it worked correctly. You may look into the
driver_test.php script for how auto-increment support works.

- There will be a new function to set a value of a prepared query to the
next auto-increment value of a table. This is not yet implemented but of
course will only work with insert queries.

These changes are available in CVS. You may find instructions on how to
obtain access to the CVS server or a download daily snapshots from here:

http://www.meta-language.net/download.html

Please test these changes looking and running the driver_test.php script
and provide your feedback.


--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html



Sun Jul 31, 2005 7:45 am

mallemos
Offline Offline
Send Email Send Email

Forward
Message #1122 of 1151 |
Expand Messages Author Sort by Date

Hello, After a long time without significant enhancements to Metabase, I am finally adding support to database schema features like auto-increment fields and...
Manuel Lemos
mallemos
Offline Send Email
Jul 31, 2005
7:45 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help