sql >> Database >  >> RDS >> Mysql

C#-klassen maken op basis van de MySQL-tabel

misschien heb je zoiets nodig:

select 'my_table' into @table; #table name
select 'my_database' into @schema; #database name
select concat('public class ',@table,'{') union
select concat('public ',tps.dest,' ',column_name,'{get;set;}') from  information_schema.columns c
join( #datatypes mapping
select 'char' as orign ,'string' as dest union all
select 'varchar' ,'string' union all
select 'longtext' ,'string' union all
select 'datetime' ,'DateTime?' union all
select 'text' ,'string' union all
select 'bit' ,'int?' union all
select 'bigint' ,'int?' union all
select 'int' ,'int?' union all
select 'double' ,'double?' union all
select 'decimal' ,'double?' union all
select 'date' ,'DateTime?' union all
select 'tinyint' ,'bool?'
) tps on c.data_type like tps.orign
where [email protected] and [email protected] union
select '}';


  1. XML-bestanden importeren naar PostgreSQL

  2. PreparedStatement-vraag in Java tegen Oracle

  3. 5 beveiligingsvoordelen van cloudgebaseerde oplossingen voor databasebewaking

  4. Hoeveel rijen worden vergrendeld door SELECT ... ORDER BY xxx LIMIT 1 VOOR UPDATE?