schema
Sponsored Links
Sponsored Links
Secleted [ 0 ] software to compare
Results 1 - 15 of about 310
SQL::Schema 0.31
SQL::Schema is a Perl module to convert a data dictionary into SQL statements. more>>
SQL::Schema is a Perl module to convert a data dictionary into SQL statements.
SYNOPSIS
use DBI;
my $dbh = DBI->connect(...);
use SQL::Schema;
my $schema = SQL::Schema->new($dbh);
my $sql = $schema->string;
print $sql;
print "$schema";
WARNING
This is alpha software. It currently works with Oracle databases only. The name of the module might be changed in future releases as well as its interface.
If somebody is modifying the datase schema during the life time of an SQL::Schema object, the object will probably fail and / or produce wrong information.
SQL::Schema is a class for objects representing a database schema. The methods of an instanciated object do allow to access the information within a databases data dictionary and to represent them as SQL create statements and the like using the proper SQL dialect.
Constructor
$schema = SQL::Schema->new($dbh);
The new method instanciates a schema object. The only argument required is a database handle, which has to offer the same API as described within DBI(3).
Methods
$sql = $schema->string;
Returns an SQL string containing several statements at once. This string contains all the SQL statements to create the database schema.
This method is overloaded with the string operator. So the following two lines are equivalent:
$sql = $schema->string;
$sql = "$schema";
<<lessSYNOPSIS
use DBI;
my $dbh = DBI->connect(...);
use SQL::Schema;
my $schema = SQL::Schema->new($dbh);
my $sql = $schema->string;
print $sql;
print "$schema";
WARNING
This is alpha software. It currently works with Oracle databases only. The name of the module might be changed in future releases as well as its interface.
If somebody is modifying the datase schema during the life time of an SQL::Schema object, the object will probably fail and / or produce wrong information.
SQL::Schema is a class for objects representing a database schema. The methods of an instanciated object do allow to access the information within a databases data dictionary and to represent them as SQL create statements and the like using the proper SQL dialect.
Constructor
$schema = SQL::Schema->new($dbh);
The new method instanciates a schema object. The only argument required is a database handle, which has to offer the same API as described within DBI(3).
Methods
$sql = $schema->string;
Returns an SQL string containing several statements at once. This string contains all the SQL statements to create the database schema.
This method is overloaded with the string operator. So the following two lines are equivalent:
$sql = $schema->string;
$sql = "$schema";
Download (0.033MB)
Added: 2007-04-05 License: Perl Artistic License Price:
933 downloads
Schema-compare 0.2
Schema-compare is a script that will compares two database schema and show the differences side-by-side. more>>
Schema-compare is a script that will compares two database schema and show the differences side-by-side.
Schema-compare can also generate SQL statements that will alter the old database to match the schema of the new database.
The comparisons are correct, but the SQL statements at the bottom are not quite right, they are close to what is necessary, but probably not exactly right.
To install simply ungzip/untar the file wherever you want to put it in your web folder and then edit the include/config.inc.php file with the information needed to connect to the two databases you want to compare. Both databases need to be on the same database server and use the same username and password to connect to them.
Enhancements:
- This is the first release of schema-compare. It compares the database schema just fine, but the sql alter statements it creates could use some work.
<<lessSchema-compare can also generate SQL statements that will alter the old database to match the schema of the new database.
The comparisons are correct, but the SQL statements at the bottom are not quite right, they are close to what is necessary, but probably not exactly right.
To install simply ungzip/untar the file wherever you want to put it in your web folder and then edit the include/config.inc.php file with the information needed to connect to the two databases you want to compare. Both databases need to be on the same database server and use the same username and password to connect to them.
Enhancements:
- This is the first release of schema-compare. It compares the database schema just fine, but the sql alter statements it creates could use some work.
Download (0.41MB)
Added: 2006-03-07 License: BSD License Price:
1329 downloads
Schema Crawler 3.7
Schema Crawler is a platform (OS and database) independent command-line tool to output your database schema. more>>
Schema Crawler project is a platform (database and OS) independent command-line tool to output your database schema and data in a readable form.
The output is designed to be diff-ed with previous versions of your database schema. Schema Crawler is also an API that improves on standard JDBC metadata.
Build
Ant Build
The ant build is a quick build that builds the Schema Crawler jar without compiling and running unit tests. Download ant, and run it from the Schema Crawler directory. The jar file will be created in the _distrib directory. The main targets are all.build and all.clean.
Maven Build
The maven build is a more comprehensive build that runs unit tests, and also creates the project web-site. Download maven, and run it from the Schema Crawler directory. The jar file will be created in the _distrib directory. The main goals are all.build and all.clean.
Eclipse
Schema Crawler consists of two Eclipse projects, dbconnector and schemacrawler. Since schemacrawler depends on dbconnector, you will need to import both projects into Eclipse.
Enhancements:
- Database properties are now retrieved, along with column data types, both system data types, and UDTs.
- A new command, maximum_schema, gives all possible details of the schema, including database system properties.
- Bugs with the merge rows option and with appending output for multiple runs of SchemaCrawler are fixed.
- An SQL exception with the Oracle Database 10g Express Edition driver on outputting views is fixed.
<<lessThe output is designed to be diff-ed with previous versions of your database schema. Schema Crawler is also an API that improves on standard JDBC metadata.
Build
Ant Build
The ant build is a quick build that builds the Schema Crawler jar without compiling and running unit tests. Download ant, and run it from the Schema Crawler directory. The jar file will be created in the _distrib directory. The main targets are all.build and all.clean.
Maven Build
The maven build is a more comprehensive build that runs unit tests, and also creates the project web-site. Download maven, and run it from the Schema Crawler directory. The jar file will be created in the _distrib directory. The main goals are all.build and all.clean.
Eclipse
Schema Crawler consists of two Eclipse projects, dbconnector and schemacrawler. Since schemacrawler depends on dbconnector, you will need to import both projects into Eclipse.
Enhancements:
- Database properties are now retrieved, along with column data types, both system data types, and UDTs.
- A new command, maximum_schema, gives all possible details of the schema, including database system properties.
- Bugs with the merge rows option and with appending output for multiple runs of SchemaCrawler are fixed.
- An SQL exception with the Oracle Database 10g Express Edition driver on outputting views is fixed.
Download (0.73MB)
Added: 2006-06-12 License: GPL (GNU General Public License) Price:
1231 downloads
SchemaCrawler 5.1
SchemaCrawler project is a command-line tool to output your database schema and data in a readable form. more>>
SchemaCrawler project is a command-line tool to output your database schema and data in a readable form.
The output is designed to be diff-ed with previous versions of your database schema. SchemaCrawler is also an API that improves on the standard JDBC metadata.
Enhancements:
- SchemaCrawler now comes with bundled downloads for Microsoft SQL Server and MySQL.
<<lessThe output is designed to be diff-ed with previous versions of your database schema. SchemaCrawler is also an API that improves on the standard JDBC metadata.
Enhancements:
- SchemaCrawler now comes with bundled downloads for Microsoft SQL Server and MySQL.
Download (1.1MB)
Added: 2007-08-04 License: LGPL (GNU Lesser General Public License) Price:
812 downloads
XML::Compile::Schema 0.05
XML::Compile::Schema is a Perl module to compile a schema. more>>
XML::Compile::Schema is a Perl module to compile a schema.
INHERITANCE
XML::Compile::Schema
is a XML::Compile
SYNOPSIS
# preparation
my $parser = XML::LibXML->new;
my $tree = $parser->parse...(...);
my $schema = XML::Compile::Schema->new($tree);
my $schema = XML::Compile::Schema->new($xml_string);
my $read = $schema->compile(READER => mytype);
my $hash = $read->($xml);
my $doc = XML::LibXML::Document->new(1.0, UTF-8);
my $write = $schema->compile(WRITER => mytype);
my $xml = $write->($doc, $hash);
print $xml->toString;
This module collects knowledge about a schema. The most important method is compile() which can create XML file readers and writers based on the schema information and some selected type.
WARNING: The compiler is implemented in XML::Compile::Schema::Translate, which is NOT FINISHED. See that manual page about the specific behavior and its (current) limitations! Please help to find missing pieces and mistakes.
WARNING: the provided schema is not validated! In some cases, compile-time and run-time errors will be reported, but typically only in cases that the parser has no idea what to do with such a mistake. On the other hand, the processed data is validated: the output should follow the specs closely.
Two implementations use the translator, and more can be added later. Both get created with the compile() method.
XML Reader
The XML reader produces a hash from a XML::LibXML::Node tree, or an XML string. The values are checked and will be ignored if the value is not according to the specs.
XML Writer
The writer produces schema compliant XML, based on a hash. To get the data encoding correct, you are required to pass a document in which the XML nodes may get a place later.
<<lessINHERITANCE
XML::Compile::Schema
is a XML::Compile
SYNOPSIS
# preparation
my $parser = XML::LibXML->new;
my $tree = $parser->parse...(...);
my $schema = XML::Compile::Schema->new($tree);
my $schema = XML::Compile::Schema->new($xml_string);
my $read = $schema->compile(READER => mytype);
my $hash = $read->($xml);
my $doc = XML::LibXML::Document->new(1.0, UTF-8);
my $write = $schema->compile(WRITER => mytype);
my $xml = $write->($doc, $hash);
print $xml->toString;
This module collects knowledge about a schema. The most important method is compile() which can create XML file readers and writers based on the schema information and some selected type.
WARNING: The compiler is implemented in XML::Compile::Schema::Translate, which is NOT FINISHED. See that manual page about the specific behavior and its (current) limitations! Please help to find missing pieces and mistakes.
WARNING: the provided schema is not validated! In some cases, compile-time and run-time errors will be reported, but typically only in cases that the parser has no idea what to do with such a mistake. On the other hand, the processed data is validated: the output should follow the specs closely.
Two implementations use the translator, and more can be added later. Both get created with the compile() method.
XML Reader
The XML reader produces a hash from a XML::LibXML::Node tree, or an XML string. The values are checked and will be ignored if the value is not according to the specs.
XML Writer
The writer produces schema compliant XML, based on a hash. To get the data encoding correct, you are required to pass a document in which the XML nodes may get a place later.
Download (0.049MB)
Added: 2006-09-13 License: Perl Artistic License Price:
1136 downloads
XML::Validator::Schema 1.08
XML::Validator::Schema is a Perl module to validate XML against a subset of W3C XML Schema. more>>
XML::Validator::Schema is a Perl module to validate XML against a subset of W3C XML Schema.
SYNOPSIS
use XML::SAX::ParserFactory;
use XML::Validator::Schema;
#
# create a new validator object, using foo.xsd
#
$validator = XML::Validator::Schema->new(file => foo.xsd);
#
# create a SAX parser and assign the validator as a Handler
#
$parser = XML::SAX::ParserFactory->parser(Handler => $validator);
#
# validate foo.xml against foo.xsd
#
eval { $parser->parse_uri(foo.xml) };
die "File failed validation: $@" if $@;
This module allows you to validate XML documents against a W3C XML Schema. This module does not implement the full W3C XML Schema recommendation (http://www.w3.org/XML/Schema), but a useful subset. See the SCHEMA SUPPORT section below.
IMPORTANT NOTE: To get line and column numbers in the error messages generated by this module you must install XML::Filter::ExceptionLocator and use XML::SAX::ExpatXS as your SAX parser. This module is much more useful if you can tell where your errors are, so using these modules is highly recommeded!
<<lessSYNOPSIS
use XML::SAX::ParserFactory;
use XML::Validator::Schema;
#
# create a new validator object, using foo.xsd
#
$validator = XML::Validator::Schema->new(file => foo.xsd);
#
# create a SAX parser and assign the validator as a Handler
#
$parser = XML::SAX::ParserFactory->parser(Handler => $validator);
#
# validate foo.xml against foo.xsd
#
eval { $parser->parse_uri(foo.xml) };
die "File failed validation: $@" if $@;
This module allows you to validate XML documents against a W3C XML Schema. This module does not implement the full W3C XML Schema recommendation (http://www.w3.org/XML/Schema), but a useful subset. See the SCHEMA SUPPORT section below.
IMPORTANT NOTE: To get line and column numbers in the error messages generated by this module you must install XML::Filter::ExceptionLocator and use XML::SAX::ExpatXS as your SAX parser. This module is much more useful if you can tell where your errors are, so using these modules is highly recommeded!
Download (0.052MB)
Added: 2006-09-15 License: Perl Artistic License Price:
1142 downloads
XML::Schema::Type::Simple 0.07
XML::Schema::Type::Simple is a base class for simple XML Schema datatypes. more>>
XML::Schema::Type::Simple is a base class for simple XML Schema datatypes.
SYNOPSIS
package XML::Schema::Type::whatever;
use base qw( XML::Schema::Type::Simple );
use vars qw( @FACETS );
@FACETS = (
minLength => 10,
maxLength => 30,
otherFacet => {
value => $n,
fixed => 1,
annotation => "a comment",
},
);
package main;
my $type = XML::Schema::Type::whatever->new()
|| die XML::Schema::Type::whatever->error();
my $item = $type->instance(some instance value)
|| die $type->error();
# NOTE: some issues still to resolve on the precise
# nature and structure of instances (currently hash ref).
print $item->{ value };
The XML::Schema::Type::Simple module is a base class for objects that represent XML Schema simple types.
<<lessSYNOPSIS
package XML::Schema::Type::whatever;
use base qw( XML::Schema::Type::Simple );
use vars qw( @FACETS );
@FACETS = (
minLength => 10,
maxLength => 30,
otherFacet => {
value => $n,
fixed => 1,
annotation => "a comment",
},
);
package main;
my $type = XML::Schema::Type::whatever->new()
|| die XML::Schema::Type::whatever->error();
my $item = $type->instance(some instance value)
|| die $type->error();
# NOTE: some issues still to resolve on the precise
# nature and structure of instances (currently hash ref).
print $item->{ value };
The XML::Schema::Type::Simple module is a base class for objects that represent XML Schema simple types.
Download (0.14MB)
Added: 2006-09-06 License: Perl Artistic License Price:
1143 downloads
DTD to XML Schema translator 1.60
DTD to XML Schema translator allows you to translate a Document Type Definition (DTD) into an XML Schema. more>>
DTD to XML Schema translator allows you to translate a Document Type Definition (DTD) into an XML Schema.
DTD to XML Schema translator lets you translate a Document Type Definition into an XML Schema (REC-xmlschema-1-20010502).
The translator can map meaningful DTD entities onto XML Schema constructs (simpleType, attributeGroup, group); the XML document model is not anonymized.
In addition, the translator can map DTD comments onto XML Schema documentation nodes in various ways.
Free available as Java class, Standalone application and as Web tool.
<<lessDTD to XML Schema translator lets you translate a Document Type Definition into an XML Schema (REC-xmlschema-1-20010502).
The translator can map meaningful DTD entities onto XML Schema constructs (simpleType, attributeGroup, group); the XML document model is not anonymized.
In addition, the translator can map DTD comments onto XML Schema documentation nodes in various ways.
Free available as Java class, Standalone application and as Web tool.
Download (0.53MB)
Added: 2007-02-26 License: GPL (GNU General Public License) Price:
976 downloads
XML::Compile::Schema::Translate 0.06
XML::Compile::Schema::Translate is a Perl module to create an XML data parser. more>>
XML::Compile::Schema::Translate is a Perl module to create an XML data parser.
INHERITANCE
XML::Compile::Schema::Translate
is an Exporter
SYNOPSIS
# for internal use only!
This module converts a schema type definition into a code reference which can be used to interpret a schema. The sole public function in this package is compile_tree(), and is called by XML::Compile::Schema::compile(), which does a lot of set-ups. Please do not try to use this package directly!
The code in this package interprets schemas; it understands, for instance, how complexType definitions work. Then, when the schema syntax is decoded, it will knot the pieces together into one CODE reference which can be used in the main user program.
<<lessINHERITANCE
XML::Compile::Schema::Translate
is an Exporter
SYNOPSIS
# for internal use only!
This module converts a schema type definition into a code reference which can be used to interpret a schema. The sole public function in this package is compile_tree(), and is called by XML::Compile::Schema::compile(), which does a lot of set-ups. Please do not try to use this package directly!
The code in this package interprets schemas; it understands, for instance, how complexType definitions work. Then, when the schema syntax is decoded, it will knot the pieces together into one CODE reference which can be used in the main user program.
Download (0.051MB)
Added: 2006-09-19 License: Perl Artistic License Price:
652 downloads
XML::Compile::Schema::XmlReader 0.18
XML::Compile::Schema::XmlReader Perl module contains bricks to translate XML to HASH. more>>
XML::Compile::Schema::XmlReader Perl module contains bricks to translate XML to HASH.
SYNOPSIS
my $schema = XML::Compile::Schema- >new(...);
my $code = $schema- >compile(READER = > ...);
The translator understands schemas, but does not encode that into actions. This module implements those actions to translate from XML into a (nested) Perl HASH structure.
DETAILS
Processing Wildcards
If you want to collect information from the XML structure, which is permitted by any and anyAttribute specifications in the schema, you have to implement that yourself. The problem is XML::Compile has less knowledge than you about the possible data.
anyAttribute
By default, the anyAttribute specification is ignored. When TAKE_ALL is given, all attributes which are fulfilling the name-space requirement added to the returned data-structure. As key, the absolute element name will be used, with as value the related unparsed XML element.
In the current implementation, if an explicit attribute is also covered by the name-spaces permitted by the anyAttribute definition, then it will also appear in that list (and hence the handler will be called as well).
Use XML::Compile::Schema::compile(anyAttribute) to write your own handler, to influence the behavior. The handler will be called for each attribute, and you must return list of pairs of derived information. When the returned is empty, the attribute data is lost. The value may be a complex structure.
Example: anyAttribute in XmlReader
Say your schema looks like this:
< schema targetNamespace="http://mine"
xmlns:me="http://mine" ... >
< element name="el" >
< complexType >
< attribute name="a" type="xs:int" / >
< anyAttribute namespace="##targetNamespace"
processContents="lax" >
< / complexType >
< / element >
< simpleType name="non-empty" >
< restriction base="xs:NCName" / >
< / simpleType >
< / schema >
Then, in an application, you write:
my $r = $schema- >compile(READER = > {http://mine}el
, anyAttribute = > ALL
);
my $h = $r- >( < < __XML );
< el xmlns:me="http://mine" >
< a >42< /a >
< b type="me:non-empty" >
everything
< / b >
< / el >
__XML
use Data::Dumper Dumper;
print Dumper $h;
__XML__
The output is something like
$VAR1 =
{ a = > 42
, {http://mine}a = > ... # XML::LibXML::Node with < a >42< /a >
, {http://mine}b = > ... # XML::LibXML::Node with < b >everything< /b >
};
You can improve the reader with a callback. When you know that the extra attribute is always of type non-empty, then you can do
my $read = $schema- >compile
( READER = > {http://mine}el
, anyAttribute = > &filter
);
my $anyAttRead = $schema- >compile
( READER = > {http://mine}non-empty
);
sub filter($$$$)
{ my ($fqn, $xml, $path, $translator) = @_;
return () if $fqn ne {http://mine}b;
(b = > $anyAttRead- >($xml));
}
my $h = $r- >( see above );
print Dumper $h;
Which will result in
$VAR1 =
{ a = > 42
, b = > everything
};
The filter will be called twice, but return nothing in the first case. You can implement any kind of complex processing in the filter.
<<lessSYNOPSIS
my $schema = XML::Compile::Schema- >new(...);
my $code = $schema- >compile(READER = > ...);
The translator understands schemas, but does not encode that into actions. This module implements those actions to translate from XML into a (nested) Perl HASH structure.
DETAILS
Processing Wildcards
If you want to collect information from the XML structure, which is permitted by any and anyAttribute specifications in the schema, you have to implement that yourself. The problem is XML::Compile has less knowledge than you about the possible data.
anyAttribute
By default, the anyAttribute specification is ignored. When TAKE_ALL is given, all attributes which are fulfilling the name-space requirement added to the returned data-structure. As key, the absolute element name will be used, with as value the related unparsed XML element.
In the current implementation, if an explicit attribute is also covered by the name-spaces permitted by the anyAttribute definition, then it will also appear in that list (and hence the handler will be called as well).
Use XML::Compile::Schema::compile(anyAttribute) to write your own handler, to influence the behavior. The handler will be called for each attribute, and you must return list of pairs of derived information. When the returned is empty, the attribute data is lost. The value may be a complex structure.
Example: anyAttribute in XmlReader
Say your schema looks like this:
< schema targetNamespace="http://mine"
xmlns:me="http://mine" ... >
< element name="el" >
< complexType >
< attribute name="a" type="xs:int" / >
< anyAttribute namespace="##targetNamespace"
processContents="lax" >
< / complexType >
< / element >
< simpleType name="non-empty" >
< restriction base="xs:NCName" / >
< / simpleType >
< / schema >
Then, in an application, you write:
my $r = $schema- >compile(READER = > {http://mine}el
, anyAttribute = > ALL
);
my $h = $r- >( < < __XML );
< el xmlns:me="http://mine" >
< a >42< /a >
< b type="me:non-empty" >
everything
< / b >
< / el >
__XML
use Data::Dumper Dumper;
print Dumper $h;
__XML__
The output is something like
$VAR1 =
{ a = > 42
, {http://mine}a = > ... # XML::LibXML::Node with < a >42< /a >
, {http://mine}b = > ... # XML::LibXML::Node with < b >everything< /b >
};
You can improve the reader with a callback. When you know that the extra attribute is always of type non-empty, then you can do
my $read = $schema- >compile
( READER = > {http://mine}el
, anyAttribute = > &filter
);
my $anyAttRead = $schema- >compile
( READER = > {http://mine}non-empty
);
sub filter($$$$)
{ my ($fqn, $xml, $path, $translator) = @_;
return () if $fqn ne {http://mine}b;
(b = > $anyAttRead- >($xml));
}
my $h = $r- >( see above );
print Dumper $h;
Which will result in
$VAR1 =
{ a = > 42
, b = > everything
};
The filter will be called twice, but return nothing in the first case. You can implement any kind of complex processing in the filter.
Download (0.12MB)
Added: 2007-07-16 License: Perl Artistic License Price:
832 downloads
XML Schema Standard Type Library 1.0.0
XML Schema Standard Type Library (XSSTL) is a collection of universally-useful data types defined in the W3C XML Schema language more>>
XML Schema Standard Type Library, in short XSSTL, is a collection of universally-useful data types defined in the W3C XML Schema language. The provided types describe concepts such as email address, IP address, phone number, country code, US states, etc.
To make all the types from XSSTL available in your schema simply add the following import directive:
< import namespace="http://www.codesynthesis.com/xmlns/xsstl"
schemaLocation="xsstl.xsd"/ >
And the following namespace-to-prefix mapping to your schema root:
xmlns:stl="http://www.codesynthesis.com/xmlns/xsstl"
Alternatively, you can import individual types:
< import namespace="http://www.codesynthesis.com/xmlns/xsstl"
schemaLocation="xsstl/email-address.xsd"/ >
< import namespace="http://www.codesynthesis.com/xmlns/xsstl"
schemaLocation="xsstl/phone-number.xsd"/ >
Enhancements:
- This initial version includes the following data types: EmailAddress, IPv4Address, Port, IPv4Endpoint, IPv4EndpointStruct, ISO3166CountyCode, Percentage, PhoneNumber, PhoneCountryCode, PhoneAreaCode, PhoneSubscriberNumber, PhoneExtensionNumber, PhoneNumberStruct, RFC822DateTime, USStateTerritoryCode, USStateCode, USTerritoryCode, USContinentalStateCode, and USContiguousStateCode.
<<lessTo make all the types from XSSTL available in your schema simply add the following import directive:
< import namespace="http://www.codesynthesis.com/xmlns/xsstl"
schemaLocation="xsstl.xsd"/ >
And the following namespace-to-prefix mapping to your schema root:
xmlns:stl="http://www.codesynthesis.com/xmlns/xsstl"
Alternatively, you can import individual types:
< import namespace="http://www.codesynthesis.com/xmlns/xsstl"
schemaLocation="xsstl/email-address.xsd"/ >
< import namespace="http://www.codesynthesis.com/xmlns/xsstl"
schemaLocation="xsstl/phone-number.xsd"/ >
Enhancements:
- This initial version includes the following data types: EmailAddress, IPv4Address, Port, IPv4Endpoint, IPv4EndpointStruct, ISO3166CountyCode, Percentage, PhoneNumber, PhoneCountryCode, PhoneAreaCode, PhoneSubscriberNumber, PhoneExtensionNumber, PhoneNumberStruct, RFC822DateTime, USStateTerritoryCode, USStateCode, USTerritoryCode, USContinentalStateCode, and USContiguousStateCode.
Download (0.011MB)
Added: 2006-09-28 License: BSD License Price:
1121 downloads
Jifty::DBI::SchemaGenerator 0.29
Jifty::DBI::SchemaGenerator is a Perl module to generate table schemas from Jifty::DBI records. more>>
Jifty::DBI::SchemaGenerator is a Perl module to generate table schemas from Jifty::DBI records.
This module turns a Jifty::Record object into an SQL schema for your chosen database. At the moment, your choices are MySQL, SQLite, or PostgreSQL. Oracle might also work right, though its untested.
SYNOPSIS
The Short Answer
See below for where we get the $handle and $model variables.
use Jifty::DBI::SchemaGenerator;
...
my $s_gen = Jifty::DBI::SchemaGenerator->new( $handle );
$s_gen->add_model($model);
my @statements = $s_gen->create_table_sql_statements;
print join("n", @statements, );
...
The Long Version
See Jifty::DBI for details about the first two parts.
MyModel
package MyModel;
# lib/MyModel.pm
use warnings;
use strict;
use base qw(Jifty::DBI::Record);
# your custom code goes here.
1;
MyModel::Schema
package MyModel::Schema;
# lib/MyModel/Schema.pm
use warnings;
use strict;
use Jifty::DBI::Schema;
column foo => type is text;
column bar => type is text;
1;
myscript.pl
#!/usr/bin/env perl
# myscript.pl
use strict;
use warnings;
use Jifty::DBI::SchemaGenerator;
use Jifty::DBI::Handle;
use MyModel;
use MyModel::Schema;
my $handle = Jifty::DBI::Handle->new();
$handle->connect(
driver => SQLite,
database => testdb,
);
my $model = MyModel->new($handle);
my $s_gen = Jifty::DBI::SchemaGenerator->new( $handle );
$s_gen->add_model($model);
# heres the basic point of this module:
my @statements = $s_gen->create_table_sql_statements;
print join("n", @statements, );
# this part is directly from Jifty::Script::Schema::create_all_tables()
$handle->begin_transaction;
for my $statement (@statements) {
my $ret = $handle->simple_query($statement);
$ret or die "error creating a table: " . $ret->error_message;
}
$handle->commit;
<<lessThis module turns a Jifty::Record object into an SQL schema for your chosen database. At the moment, your choices are MySQL, SQLite, or PostgreSQL. Oracle might also work right, though its untested.
SYNOPSIS
The Short Answer
See below for where we get the $handle and $model variables.
use Jifty::DBI::SchemaGenerator;
...
my $s_gen = Jifty::DBI::SchemaGenerator->new( $handle );
$s_gen->add_model($model);
my @statements = $s_gen->create_table_sql_statements;
print join("n", @statements, );
...
The Long Version
See Jifty::DBI for details about the first two parts.
MyModel
package MyModel;
# lib/MyModel.pm
use warnings;
use strict;
use base qw(Jifty::DBI::Record);
# your custom code goes here.
1;
MyModel::Schema
package MyModel::Schema;
# lib/MyModel/Schema.pm
use warnings;
use strict;
use Jifty::DBI::Schema;
column foo => type is text;
column bar => type is text;
1;
myscript.pl
#!/usr/bin/env perl
# myscript.pl
use strict;
use warnings;
use Jifty::DBI::SchemaGenerator;
use Jifty::DBI::Handle;
use MyModel;
use MyModel::Schema;
my $handle = Jifty::DBI::Handle->new();
$handle->connect(
driver => SQLite,
database => testdb,
);
my $model = MyModel->new($handle);
my $s_gen = Jifty::DBI::SchemaGenerator->new( $handle );
$s_gen->add_model($model);
# heres the basic point of this module:
my @statements = $s_gen->create_table_sql_statements;
print join("n", @statements, );
# this part is directly from Jifty::Script::Schema::create_all_tables()
$handle->begin_transaction;
for my $statement (@statements) {
my $ret = $handle->simple_query($statement);
$ret or die "error creating a table: " . $ret->error_message;
}
$handle->commit;
Download (0.097MB)
Added: 2007-01-17 License: Perl Artistic License Price:
1010 downloads
Object::Relation::Meta::Class::Schema 0.1.0
Object::Relation::Meta::Class::Schema is a Perl module for Object::Relation database store builder. more>>
Object::Relation::Meta::Class::Schema is a Perl module for Object::Relation database store builder.
This module is provides metadata for all Object::Relation classes while building a storage schema. Loading Object::Relation::Schema causes it to be used instead of Object::Relation::Meta::Class. This is so that extra metadata methods are available that are useful in constructing the schema, but are not otherwise useful when an application is actually in use.
At this point, those attributes tend to be database-specific. Once other types of data stores are added (XML, LDAP, etc.), other attributes may be added to allow their schemas to be built, as well.
<<lessThis module is provides metadata for all Object::Relation classes while building a storage schema. Loading Object::Relation::Schema causes it to be used instead of Object::Relation::Meta::Class. This is so that extra metadata methods are available that are useful in constructing the schema, but are not otherwise useful when an application is actually in use.
At this point, those attributes tend to be database-specific. Once other types of data stores are added (XML, LDAP, etc.), other attributes may be added to allow their schemas to be built, as well.
Download (0.024MB)
Added: 2006-09-21 License: Perl Artistic License Price:
1128 downloads
DBIx::Class::Schema::Loader::RelBuilder 0.03007
DBIx::Class::Schema::Loader::RelBuilder is a Perl module that builds relationships for DBIx::Class::Schema::Loader. more>>
DBIx::Class::Schema::Loader::RelBuilder is a Perl module that builds relationships for DBIx::Class::Schema::Loader.
This class builds relationships for DBIx::Class::Schema::Loader. This is module is not (yet) for external use.
METHODS
new
Arguments: schema_class (scalar), fk_info (hashref), inflect_plural, inflect_singular
$schema_class should be a schema class name, where the source classes have already been set up and registered. Column info, primary key, and unique constraints will be drawn from this schema for all of the existing source monikers.
The fk_info hashrefs contents should take the form:
{
TableMoniker => [
{
local_columns => [ col2, col3 ],
remote_columns => [ col5, col7 ],
remote_moniker => AnotherTableMoniker,
},
# ...
],
AnotherTableMoniker => [
# ...
],
# ...
}
Options inflect_plural and inflect_singular are optional, and are better documented in DBIx::Class::Schema::Loader::Base.
generate_code
This method will return the generated relationships as a hashref per table moniker, containing an arrayref of code strings which can be "eval"-ed in the context of the source class, like:
{
Some::Source::Class => [
"belongs_to( col1 => AnotherTableMoniker )",
"has_many( anothers => AnotherTableMoniker, col15 )",
],
Another::Source::Class => [
# ...
],
# ...
}
You might want to use this in building an on-disk source class file, by adding each string to the appropriate source class file, prefixed by __PACKAGE__->.
<<lessThis class builds relationships for DBIx::Class::Schema::Loader. This is module is not (yet) for external use.
METHODS
new
Arguments: schema_class (scalar), fk_info (hashref), inflect_plural, inflect_singular
$schema_class should be a schema class name, where the source classes have already been set up and registered. Column info, primary key, and unique constraints will be drawn from this schema for all of the existing source monikers.
The fk_info hashrefs contents should take the form:
{
TableMoniker => [
{
local_columns => [ col2, col3 ],
remote_columns => [ col5, col7 ],
remote_moniker => AnotherTableMoniker,
},
# ...
],
AnotherTableMoniker => [
# ...
],
# ...
}
Options inflect_plural and inflect_singular are optional, and are better documented in DBIx::Class::Schema::Loader::Base.
generate_code
This method will return the generated relationships as a hashref per table moniker, containing an arrayref of code strings which can be "eval"-ed in the context of the source class, like:
{
Some::Source::Class => [
"belongs_to( col1 => AnotherTableMoniker )",
"has_many( anothers => AnotherTableMoniker, col15 )",
],
Another::Source::Class => [
# ...
],
# ...
}
You might want to use this in building an on-disk source class file, by adding each string to the appropriate source class file, prefixed by __PACKAGE__->.
Download (0.032MB)
Added: 2006-10-20 License: Perl Artistic License Price:
1099 downloads
Object::Relation::Meta::Attribute::Schema 0.1.0
Object::Relation::Meta::Attribute::Schema is a Perl module for Object::Relation database store builder. more>>
Object::Relation::Meta::Attribute::Schema is a Perl module for Object::Relation database store builder.
Synopsis
# Assuming MyThingy was generated by Object::Relation::Meta and that were building
# a data store schema.
my $class = MyThingy->my_class;
print "nAttributes:n";
for my $attr ($class->attributes) {
print " o ", $attr->name, $/;
print " Column: ", $attr->column, $/;
if (my $idx = $attr->index) {
print " Index: $idxn";
}
if (my $ref = $attr->references) {
print " References ", $ref->package, $/;
print " On Delete: ", $attr->on_delete, $/;
}
}
This module is provides metadata for all Object::Relation class attributes while building a storage schema. Loading Object::Relation::Schema causes it to be used instead of Object::Relation::Meta::Attribute. This is so that extra metadata methods are available that are useful in constructing the schema, but are not otherwise useful when an application is actually in use.
<<lessSynopsis
# Assuming MyThingy was generated by Object::Relation::Meta and that were building
# a data store schema.
my $class = MyThingy->my_class;
print "nAttributes:n";
for my $attr ($class->attributes) {
print " o ", $attr->name, $/;
print " Column: ", $attr->column, $/;
if (my $idx = $attr->index) {
print " Index: $idxn";
}
if (my $ref = $attr->references) {
print " References ", $ref->package, $/;
print " On Delete: ", $attr->on_delete, $/;
}
}
This module is provides metadata for all Object::Relation class attributes while building a storage schema. Loading Object::Relation::Schema causes it to be used instead of Object::Relation::Meta::Attribute. This is so that extra metadata methods are available that are useful in constructing the schema, but are not otherwise useful when an application is actually in use.
Download (0.23MB)
Added: 2006-09-26 License: Perl Artistic License Price:
1123 downloads
Secleted [ 0 ] software to compare
Copyright Notice:
Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future software development. The above schema search only lists software in full, demo and trial versions for free download. Download links are directly from our mirror sites or publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed