SQL Anywhere5.5: Metadata

http://dcx.sybase.com/1101/en/dbprogramming_en11/ianywhere-data-sqlanywhere-saconnection-getschem6330755502-0.html

http://razorsql.com/articles/sybase_admin_queries.html

http://infocenter.sybase.com/help/topic/com.sybase.help.sqlanywhere.11.0.0/pdf/dbadmin_en11.pdf

http://www.mono-project.com/docs/database-access/providers/sybase/

https://github.com/mono/old-code

Columns collection
  • table_schema (Owner)
  • table_name (Table)
  • column_name (Column)
  • ordinal_position
  • column_default
  • is_nullable
  • data_type
  • precision
  • scale
  • column_size
DataSourceInformation collection
  • CompositeIdentifierSeparatorPattern
  • DataSourceProductName
  • DataSourceProductVersion
  • DataSourceProductVersionNormalized
  • GroupByBehavior
  • IdentifierPattern
  • IdentifierCase
  • OrderByColumnsInSelect
  • ParameterMarkerFormat
  • ParameterMarkerPattern
  • ParameterNameMaxLength
  • ParameterNamePattern
  • QuotedIdentifierPattern
  • QuotedIdentifierCase
  • StatementSeparatorPattern
  • StringLiteralPattern
  • SupportedJoinOperators
DataTypes collection
  • TypeName
  • ProviderDbType
  • ColumnSize
  • CreateFormat
  • CreateParameters
  • DataType
  • IsAutoIncrementable
  • IsBestMatch
  • IsCaseSensitive
  • IsFixedLength
  • IsFixedPrecisionScale
  • IsLong
  • IsNullable
  • IsSearchable
  • IsSearchableWithLike
  • IsUnsigned
  • MaximumScale
  • MinimumScale
  • IsConcurrencyType
  • IsLiteralSupported
  • LiteralPrefix
  • LiteralSuffix
ForeignKeys collection
  • table_schema (Owner)
  • table_name (Table)
  • column_name (Column)
IndexColumns collection
  • table_schema (Owner)
  • table_name (Table)
  • index_name (Name)
  • column_name (Column)
  • order
Indexes collection
  • table_schema (Owner)
  • table_name (Table)
  • index_name (Name)
  • primary_key
  • is_unique
MetaDataCollections collection
  • CollectionName
  • NumberOfRestrictions
  • NumberOfIdentifierParts
ProcedureParameters collection
  • procedure_schema (Owner)
  • procedure_name (Name)
  • parmeter_name (Parameter)
  • data_type
  • parameter_type
  • is_input
  • is_output
Procedures collection
  • procedure_schema (Owner)
  • procedure_name (Name)
ReservedWords collection
  • reserved_word
Restrictions collection
  • CollectionName
  • RestrictionName
  • RestrictionDefault
  • RestrictionNumber
Tables collection
  • table_schema (Owner)
  • table_name (Table)
  • table_type (TableType)
UserDefinedTypes collection
  • data_type
  • default
  • precision
  • scale
Users collection
  • user_name (UserName)
  • resource_auth
  • database_auth
  • schedule_auth
  • user_group
ViewColumns collection
  • view_schema (Owner)
  • view_name (Name)
  • column_name (Column)
Views collection
  • view_schema (Owner)
  • view_name (Name)
/*
C – computed column
D – default
F – SQLJ function
L – log
N – partition condition
P – Transact-SQL or SQLJ procedure
PR – prepare objects (created by Dynamic SQL)
R – rule
RI – referential constraint
S – system table
TR – trigger
U – user table
V – view
XP – extended stored procedure
*/

SELECT * FROM sys.systable

SELECT * FROM sysobjects WHERE type = ‘U‘
select * from customer   --- 查-詢錶
go

SELECT * FROM syscolumns
GO
SELECT * FROM sysobjects
GO

SELECT sys.sysuserperm.user_name
          + ‘.‘
          + sys.systable.table_name
          + ‘.‘
          + sys.syscolumn.column_name
   FROM sys.systable,
        sys.syscolumn,
        sys.sysuserperm
  WHERE sys.systable.table_id = sys.syscolumn.table_id
    AND sys.systable.creator = sys.sysuserperm.user_id
    AND sys.sysuserperm.user_name NOT IN ( ‘SYS‘, ‘dbo‘ )
    AND sys.systable.table_name NOT LIKE ‘pbcat%‘
  ORDER BY sys.sysuserperm.user_name,
        sys.systable.table_name,
        sys.syscolumn.column_id
GO

SELECT b.name + ‘.‘ + a.name
  FROM sysobjects a, sysusers b
 WHERE a.type IN (‘U‘, ‘S‘)
   AND a.uid = b.uid
 ORDER BY b.name, a.name

  

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.Odbc;
using System.Data.SqlClient;

namespace SQLanyWhereDemo
{

    /// <summary>
    /// http://dcx.sybase.com/1101/en/dbprogramming_en11/ianywhere-data-sqlanywhere-saconnection-getschem6330755502-0.html
    /// </summary>
    public partial class Form3 : Form
    {

        string connectionString = @"DSN=geovindu;UID=dba;PWD=sql;";
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        DataTable setDatat()
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("id", typeof(int));
            dt.Columns.Add("name", typeof(string));
            dt.Rows.Add(1, "Procedures");
            dt.Rows.Add(2, "DataTypes");
            dt.Rows.Add(3, "Foreign Keys");
            dt.Rows.Add(4, "Databases");
            dt.Rows.Add(5, "DBA");
            dt.Rows.Add(6, "Arguments");
            dt.Rows.Add(7, "Collection Name");
            dt.Rows.Add(8, "DatasourceInformation");
            dt.Rows.Add(9, "MetaDataCollections");
            dt.Rows.Add(10, "ForeignKeyColumns");
            dt.Rows.Add(11, "Functions");
            dt.Rows.Add(12, "IndexColumns");
            dt.Rows.Add(13, "Indexes");
            dt.Rows.Add(14, "PrimaryKeys");
            dt.Rows.Add(15, "ReservedWords");
            dt.Rows.Add(16, "Restrictions");
            dt.Rows.Add(17, "Triggers");
            dt.Rows.Add(18, "UDFs");
            dt.Rows.Add(19, "UniqueKeys");
            dt.Rows.Add(20, "UserPrivileges");
            dt.Rows.Add(21, "Users");
            dt.Rows.Add(22, "ViewColumns");

            //DataTable dt = connection.GetSchema("Tables", strRestricted);
            dt.Rows.Add(23, "Tables");
            dt.Rows.Add(24, "Columns");//表的列的详细,有主键TABLE_CATALOG,TABLE_SCHEMA,TABLE_NAME,COLUMN_NAME,ORDINAL_POSITION,COLUMN_DEFAULT,IS_NULLABLE,DATA_TYPE,CHARACTER_MAXIMUM_LENGTH,NUMERIC_PRECISION,NUMERIC_SCALE,DATETIME_PRECISION,CHARACTER_SET_NAME,COLLATION_NAME,COLUMN_TYPE,COLUMN_KEY,EXTRA,PRIVILEGES,COLUMN_COMMENT
            dt.Rows.Add(25, "Views");
            dt.Rows.Add(26, "Indexes");//表的列
            dt.Rows.Add(27, "IndexColumns");//主键

            return dt;
        }

        /// <summary>
        ///
        /// </summary>
        public Form3()
        {
            InitializeComponent();
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Form3_Load(object sender, EventArgs e)
        {
            this.txtConnection.Text = connectionString;
            this.comboBox1.DataSource = setDatat();
            this.comboBox1.DisplayMember = "name";
            this.comboBox1.ValueMember = "id";
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                using (OdbcConnection connection = new OdbcConnection(connectionString))
                {
                    connection.Open();
                    DataTable dt = connection.GetSchema(this.comboBox1.Text.Trim());
                    this.dataGridView1.DataSource = dt;

                }
            }
            catch (Exception ex)
            {
                ex.Message.ToString();
            }
        }
    }
}

  

原文地址:https://www.cnblogs.com/geovindu/p/8434775.html

时间: 2024-11-02 10:27:14

SQL Anywhere5.5: Metadata的相关文章

MySQL and Sql Server:Getting metadata using sql script (SQL-92 standard)

MySQL: use sakila; -- show fields from table_name; -- show keys from table_name; SELECT `REFERENCED_TABLE_NAME` FROM `information_schema`.`KEY_COLUMN_USAGE` WHERE `TABLE_NAME` = '[table_containing_foreign_key]' AND `COLUMN_NAME` = '[foreign_key]'; SH

Csharp: read Sybase SQL anywhere5.5 using c#

private void button1_Click(object sender, EventArgs e) { try { //OdbcConnection conn = new OdbcConnection(); //conn.ConnectionString = // "ODBC;" + // "Driver={Sybase SQL Anywhere 5.0};" + // "DefaultDir=c:\myfolder\;" + // &

Apache Spark 2.2.0 中文文档 - Spark SQL, DataFrames and Datasets Guide | ApacheCN

Spark SQL, DataFrames and Datasets Guide Overview SQL Datasets and DataFrames 开始入门 起始点: SparkSession 创建 DataFrames 无类型的Dataset操作 (aka DataFrame 操作) Running SQL Queries Programmatically 全局临时视图 创建Datasets RDD的互操作性 使用反射推断Schema 以编程的方式指定Schema Aggregatio

Understanding how SQL Server executes a query

https://www.codeproject.com/Articles/630346/Understanding-how-SQL-Server-executes-a-query https://www.codeproject.com/Articles/732812/How-to-analyse-SQL-Server-performance This article will help you write better database code and will help you get st

sql是如何执行一个查询的!

引用自:http://rusanu.com/2013/08/01/understanding-how-sql-server-executes-a-query/ Understanding how SQL Server executes a query August 1st, 2013 If you are a developer writing applications that use SQL Server and you are wondering what exactly happens

编写自己的JDBC框架

元数据介绍 元数据指的是"数据库"."表"."列"的定义信息. DataBaseMetaData元数据 Connection.getDatabaseMetaData()获得代表DatabaseMetaData元数据的DatabaseMetaData对象. DataBaseMetaData对象的常用方法: getURL():返回一个String类对象,代表数据库的URL. getUserName():返回连接当前数据库管理系统的用户名. getDa

一个奇怪的异常

java.sql.SQLException: Parameter metadata not available for the given statement. 这是在测试数据库元数据时产生的,数据库为MySql.解决的方法不难,就是在连接数据库时的URL后面加上可以返回的元数据类型例如:出异常时的我的URL是这样子写的:url=“jdbc:mysql://127.0.0.1:3306/demo?user=root&password=root&useUnicode=true”正确写法应该是

OpenStack组件系列?glance简介

Glance项目提供虚拟机镜像的发现,注册,取得服务. Glance提供restful API可以查询虚拟机镜像的metadata,并且可以获得镜像. 通过Glance,虚拟机镜像可以被存储到多种存储上,比如简单的文件存储或者对象存储(比如OpenStack中swiftx项目). Glance,像所有的OpenStack项目一样,遵循以下思想: 1.基于组件的架构      便于快速增加新特性 2.高可用性                  支持大负荷 3.容错性                

读ActiveAndroid源码(二)

上一次粗略地读了一下TableInfo这个类,了解了一下ActiveAndroid中注解的使用方法,算是一个预热,这一篇,从正常的顺序开始. 所以,这次从ActiveAndroid的初始化开始阅读. public class Application extends android.app.Application { @Override public void onCreate() { super.onCreate(); ActiveAndroid.initialize(this); } @Ove