任何数据库的通用查询

本文关键字:查询 数据库 任何 | 更新日期: 2023-09-27 18:12:44

我创建了一个可用于Oracle和Access DB的查询。查询是一个包含通配符的简单select表达式。

string query = @"SELECT t_package.Package_ID FROM t_package   
                WHERE t_package.PackageFlags   
                LIKE '#WC#VCCFG=#WC#CheckedOutTo=#WC#'";  
//set the wild card according to the DBMS type that current repository based on.
  string wildCardCharacter = "";
  wildCardCharacter = RepositoryType().Contains("Access") == true? "*" : "%";
//Replace wild card characters with the appropriate one.
  query = query.Replace("#WC#", wildCardCharacter);

我希望查询也适用于以下数据库:

•MS SQL Server
•MySQL
•Oracle9i和10 g
•PostgreSQL
•MSDE
•adaptiveserveranywhere
•进度OpenEdge

如何为每个通配符设置合适的通配符?

任何数据库的通用查询

Afaik only Access不使用标准SQL *_作为通配符(我不熟悉progress OpenEdge)