• MySQL 字段全部转换成小写


    原因:

    因为框架某些字段大写有时候不被正确识别,所以字段都修改成小写;

    特别说明:因为这里只有表,没有视图,存储过程等等其它所以我可以直接这么写;

    步骤:

    1.导出结构语句

    2.

    执行C# 脚本,替换里面2个文件的位置;

           FileStream fs = File.Create("D:\1111.txt");
                StreamWriter sw = new StreamWriter(fs);
    
                FileStream fileStream = File.OpenRead("D:\skxscm.sql");
                StreamReader sr = new StreamReader(fileStream);
    
                while (sr.Peek() >= 0)
                {
                    string l_strTest = sr.ReadLine();
    
                    if (l_strTest.StartsWith("  `"))
                    {
                        l_strTest = l_strTest.Substring(0,l_strTest.IndexOf("`", 3)).ToLower()
                                    + l_strTest.Substring(l_strTest.IndexOf("`", 3));
                        Console.WriteLine(l_strTest);
                    }
                    sw.WriteLine(l_strTest);
                }
    
                fs.Close();
                sw.Close();
                fileStream.Close();
                sr.Close();
    
                Console.ReadKey();
    View Code

    其它失败方法:

    a.直接修改information_schema库的数据,因为是视图所以无法修改;好像跟SQLServer不一样

    b.利用information_schema 中的表生成SQL语句,因为字段的其它信息无法被照顾所以放弃

    参考资料:

    http://blog.csdn.net/qq_31215927/article/details/52902886

  • 相关阅读:
    设置navigationbar透明度时的坑
    NSOprationQueue 与 GCD 的区别与选用
    CALayer及其子类
    ARC基本原理
    drawRect:和layoutSubview的区别
    NSDictionary 和NSArray 排序(sort)
    iOS常用动画
    项目托管到Github上
    解析歌词
    计算字符串的长度值
  • 原文地址:https://www.cnblogs.com/maanshancss/p/6020900.html
Copyright © 2020-2023  润新知