コード例 #1
0
        public static string AppendReturnId(
            this BaseSqlExecutor executor,
            string originalString)
        {
            var builder = new StringBuilder(originalString);

            return(AppendReturnId(executor, builder));
        }
コード例 #2
0
        public static string AppendReturnId(
            this BaseSqlExecutor executor,
            StringBuilder builder)
        {
            switch (executor.Dbms)
            {
            case DBMS.SQLite:
                builder.Append("SELECT last_insert_rowid();");
                break;

            case DBMS.MySQL:
                builder.Append("SELECT LAST_INSERT_ID();");
                break;

            case DBMS.MSSQL:
                builder.Append("SELECT SCOPE_IDENTITY();");
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(builder.ToString());
        }