private string warpColumn(DbColumn col) { if (col == null) return null; switch (col.DataType) { //case "DATE": // return string.Format("TO_CHAR({0},'YYYY-MM-DD HH24:MI:SS')", col.ColumnName); //return string.Format("TO_CHAR({0},'yyyy-mm-dd hh24:mi:ss')", col.ColumnName); case "LONG": return string.Format("TO_CHAR({0})", col.ColumnName); } return col.ColumnName; }
public static void CreateTableIfNotExists(this IDao dao, string tableName, DbColumn[] columns, params string[] pks) { //如果表已经存在则跳过 bool existTable = ExistsTable(dao, tableName); if (existTable) { return; } var sqlGen = new SqlGenerator(); var sql = sqlGen.CreateSqlScript(tableName, columns, pks); dao.Execute(sql); }