четверг, 15 июля 2010 г.

New metadata and OOP features in MacroTSQL

New feature 1.

Normal reflection over XML attributes (work on every object type whick keeps it's source code in sys.sql_modules (all except tables)

Assume that such view was created:

<myvar val1="1">2</myvar>

create view myview as select 1 as id

Now you can use comdiv.schemaview to find and test it:


So result will be :
type fullname col1 col2
VIEW dbo.myview 2 1

works for now above SP,F,T,V, not for tables.
Supports visualization of
name, module->name, module->class, module->method attributes,
events and some others
sygnal about 'isinterface','isprivate' due to applyed schema

For MacroSQL created object additionaly SourceSQL column provided
which contains pure sql (no declaration) of code before prepocessing

is FxCOP-like stored procedure that analyzes schema through comdiv.schemaview and search for errors, mistakes and not well formed metadata.

For example - after such view was created, i see:
exec comdiv.validateschema
=VIEW-----|-dbo.myview--|---40-----|--40-------|-module is not defined
=VIEW-----|-dbo.myview--|----5-----|--60-------|-best practice is to define class and method of object =


<myvar val1="1"></myvar>
<module name='mytestmodule' class='stub' method='sampleview' />

create view myview as select 1 as id

will match requirements

New feature 2.

Object-like style of calling inside MTSQL-style procedures.

Given such procedure (named due to some schema needs or historically):

<module class="utils" method="printdate" />
create proc dbo._SP_print_date as begin
declare @now datetime set @now = getdate()
print @now

in M-TSQL procdures you can call it not by real name, but by 'class'
NOTES: class names are applyed only if they are already exists!!!

create proc _ as begin
exec utils.printdate

Code is very readable and is good for migration
You need just keep class->method names, but safely rename real object (with following recompilation of MTSQL code)

Комментариев нет: