Code Monkey home page Code Monkey logo

db-meta's Introduction

db-meta

Db-meta is a free database schema discovery and easily tool. Db-meta now can support mysql, sql server and oracle. It is easy to extend. Db-meta's output meta is object, so it is easy to use in your project. And our library is thread safety.

Example Usage

You can download the demo and run it by yourself.db-meta-demo

Architecture

Meta data architecture

metaclass

  • Schema:According to the [sql-92](http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt),Catalogs are named collections of schemas in an SQL-environment. Just like "database->catalogs->schema->table", but Oracle only support schema, Mysql only support catalogs, Sql server support all of them. So Schema here is "catalog.schema".
  • Constraint:Our Constraint only contain unique and check(Primary and Foreign are not in is)

soft Architecture

frame

API

In order to improve performance, avoid to crawle useless meta ,we use schemalevel.
					              |min   | standard | max |
					--------------|------|----------|-----|
					JdbcDriverInfo| Yes  | Yes      | Yes |
					DatabaseInfo  | Yes  | Yes      | Yes |
					Table         | Yes  | Yes      | Yes |
					Column        | Yes  | Yes      | Yes |
					PrimaryKey    | Yes  | Yes      | Yes |
					Constraint    | Yes  | Yes      | Yes |
					View          | NO   | NO       | Yes |
					Index         | NO   | Yes      | Yes |
					ForeignKey    | NO   | Yes      | Yes |
					Privilege     | NO   | NO       | Yes |
					Trigger       | NO   | NO       | Yes |	

MetaLoader interface is what you need.

Method Description
Set getTableNames() Get table names(current Schema)
Table getTable(String tableName) Get table(SchemaInfolevel.standard)
Table getTable(String tableName,SchemaInfoLevel schemaLevel) Get table
Table getTable(String tableName,SchemaInfo schemaInfo)
Set getSchemaInfos() Get current schema information
Schema getSchema() Get current schema
Schema getSchema(SchemaInfo schemaInfo) Get schema ,according to the SchemaInfo
Set getProcedureNames() Get the user's procedure names
Procedure getProcedure(String procedureName) Get the procedure information,according to the name
Map<String,Procedure> getProcedures() Get the user's procedures
Set getTriggerNames() Get the user's trigger names
Trigger getTrigger(String triggerName) Get the trigger information, according to the trigger name
Map<String, Trigger> getTriggers() Get the user's triggers
Set getFunctionNames() Get the user's function names
Function getFunction(String name) Get the function information, according to the name
Map<String, Function> getFunctions() Get the user's functions
Database getDatabase() Get all the meta data of the database(Standard)
Database getDatabase(SchemaInfoLevel level) Get all the meta data of the database

Licenses

Copyright [2014] [XuMinhua]

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Remark

E-mail:[email protected]

db-meta's People

Contributors

wukenaihe avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.