Hi, I think the CREATE CODE MyTriggerCode LANGUAGE JAVA FOR TRIGGER AS is very verbose. What about: CREATE TRIGGER ... AS? That's similar syntax as CREATE ALIAS ... AS.
H2 only supports Java currently, so there is no reason to require "JAVA". Once other languages are supported it can still be added as an option. However I'm not sure if it makes sense to provide shortcut to directly register a trigger as source code *snippet* (that is, only the fire method). I think it's no problem to require the source code of the *complete* class in this case. If you write short static function, then the current CREATE ALIAS ... AS source is handy (I used it many times). But if you write a trigger, you anyway do that in the IDE, meaning you anyway have the source code of the complete class somewhere. Because you want to use auto-complete of the IDE, and so forth. Triggers are almost never as simple as a Java function. I think if we want to support CREATE CODE then this should be only used to add classes to the "internal classpath" of H2. Independent of for what those classes are used (trigger, aggregate, function alias,...), and therefore without any magic to adopt to the right type / add missing glue code. Even without automatically adding import statements. Those classes can then be used for many things. For example a class that contains multiple public static methods plus a trigger (or even multiple triggers using inner classes). Or it could even contain multiple classes, or a jar file (which would be stored in the database). Instead of CREATE CODE what about CREATE MODULE or CREATE LIBRARY? There could be a module / library for MySQL helper functions, for PostgreSQL helper functions, and so on. Like a Apache HTTP module. There should be an way to "auto-start", maybe using a method in the loaded library. Existing features could then be retro-fitted as modules / libraries. For example fulltext search. Regards, Thomas -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
