コード例 #1
0
        private BaseSyntaxProvider GetSyntaxProvider()
        {
            BaseSyntaxProvider sqlsyn = null;

            switch (this.DatabasePlatform)
            {
            case QueryBuilderDatabasePlatform.Informix:
                sqlsyn = new InformixSyntaxProvider();
                break;

            default:
                sqlsyn = new GenericSyntaxProvider();
                break;
            }


            return(sqlsyn);
        }
コード例 #2
0
        private BaseSyntaxProvider GetSyntaxProvider()
        {
            BaseSyntaxProvider sqlsyn = null;

            switch (this.DatabasePlatform)
            {
            case QueryBuilderDatabasePlatform.MSSQLServer:
                sqlsyn = new MSSQLSyntaxProvider();
                break;

            case QueryBuilderDatabasePlatform.SQLServerCE:
                //sqlsyn = new MSSQLCESyntaxProvider();   //does not work
                sqlsyn = new GenericSyntaxProvider();     //does not work
                break;

            case QueryBuilderDatabasePlatform.OLEDB:
                if (queryBuilder.MetadataProvider.Connection.ConnectionString.Contains("Provider=Microsoft.ACE.OLEDB.12.0") ||
                    queryBuilder.MetadataProvider.Connection.ConnectionString.Contains("Provider=Microsoft.Jet.OLEDB.4.0"))
                {
                    sqlsyn = new MSAccessSyntaxProvider();
                }
                else if (queryBuilder.MetadataProvider.Connection.ConnectionString.Contains("Provider=OraOLEDB.Oracle") ||
                         queryBuilder.MetadataProvider.Connection.ConnectionString.Contains("Provider=msdaora"))
                {
                    sqlsyn = new OracleSyntaxProvider();
                }
                else
                {
                    switch (this.AnsiSQLVersion)
                    {
                    case AnsiSQLLevel.SQL89:
                        sqlsyn = new SQL89SyntaxProvider();
                        break;

                    case AnsiSQLLevel.SQL92:
                        sqlsyn = new SQL92SyntaxProvider();
                        break;

                    case AnsiSQLLevel.SQL2003:
                        sqlsyn = new SQL2003SyntaxProvider();
                        break;
                    }
                }
                break;

            case QueryBuilderDatabasePlatform.ODBC:
                if (queryBuilder.MetadataProvider.Connection.ConnectionString.ToLower().Contains("driver={microsoft access driver"))
                {
                    sqlsyn = new MSAccessSyntaxProvider();
                }
                else if (queryBuilder.MetadataProvider.Connection.ConnectionString.ToLower().Contains("driver={oracle") ||
                         queryBuilder.MetadataProvider.Connection.ConnectionString.ToLower().Contains("driver={microsoft odbc for oracle"))
                {
                    sqlsyn = new OracleSyntaxProvider();
                }
                else if (queryBuilder.MetadataProvider.Connection.ConnectionString.ToLower().Contains("driver={sql server") ||
                         queryBuilder.MetadataProvider.Connection.ConnectionString.ToLower().Contains("sql server"))
                {
                    sqlsyn = new MSSQLSyntaxProvider();
                }
                else if (queryBuilder.MetadataProvider.Connection.ConnectionString.ToLower().Contains("driver={ibm db2") ||
                         queryBuilder.MetadataProvider.Connection.ConnectionString.ToLower().Contains("ibm db2"))
                {
                    sqlsyn = new DB2SyntaxProvider();
                }
                else if (queryBuilder.MetadataProvider.Connection.ConnectionString.ToLower().Contains("driver={ibm informix") ||
                         queryBuilder.MetadataProvider.Connection.ConnectionString.ToLower().Contains("informix"))
                {
                    sqlsyn = new InformixSyntaxProvider();
                }
                else if (queryBuilder.MetadataProvider.Connection.ConnectionString.ToLower().Contains("driver={mysql"))
                {
                    sqlsyn = new MySQLSyntaxProvider();
                }
                else if (queryBuilder.MetadataProvider.Connection.ConnectionString.ToLower().Contains("driver={adaptive server") ||
                         queryBuilder.MetadataProvider.Connection.ConnectionString.ToLower().Contains("driver={sybase ase"))
                {
                    sqlsyn = new SybaseSyntaxProvider();
                }
                else if (queryBuilder.MetadataProvider.Connection.ConnectionString.ToLower().Contains("driver={sql anywhere"))
                {
                    sqlsyn = new GenericSyntaxProvider();
                }
                else
                {
                    switch (this.AnsiSQLVersion)
                    {
                    case AnsiSQLLevel.SQL89:
                        sqlsyn = new SQL89SyntaxProvider();
                        break;

                    case AnsiSQLLevel.SQL92:
                        sqlsyn = new SQL92SyntaxProvider();
                        break;

                    case AnsiSQLLevel.SQL2003:
                        sqlsyn = new SQL2003SyntaxProvider();
                        break;
                    }
                }
                break;

            case QueryBuilderDatabasePlatform.MSAccess:
                sqlsyn = new MSAccessSyntaxProvider();
                break;

            case QueryBuilderDatabasePlatform.Oracle:
                sqlsyn = new OracleSyntaxProvider();
                break;

            default:
                sqlsyn = new GenericSyntaxProvider();
                break;
            }


            return(sqlsyn);
        }