Ejemplo n.º 1
0
        public MainPage()
        {
            InitializeComponent();

            btnScanDefault.Clicked += btnScanDefault_Clicked;

            this.vm = new InsertSetting();
        }
Ejemplo n.º 2
0
 public LoginPopupPage()
 {
     InitializeComponent();
     this.vm = new InsertSetting();
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Builds the insert statement.
        /// </summary>
        /// <returns></returns>
        public override string BuildInsertStatement()
        {
            StringBuilder sb = new StringBuilder();

            //cast it
            Insert i = insert;

            //sb.Append("begin ");
            sb.Append(this.sqlFragment.INSERT_INTO);
            sb.Append(stripBraces(i.Table.QualifiedName));
            sb.Append("(");
            sb.Append(stripBraces(i.SelectColumns));
            sb.Append(")");

            //if the values list is set, use that
            InsertSetting keySetting = null;

            if (i.Inserts.Count > 0)
            {
                sb.Append(" VALUES (");
                bool isFirst = true;
                foreach (InsertSetting s in i.Inserts)
                {
                    if (!isFirst)
                    {
                        sb.Append(",");
                    }

                    if (!s.IsExpression && !s.IsPrimaryKey)
                    {
                        sb.Append(s.ParameterName);
                    }
                    else
                    {
                        sb.Append(s.Value);
                    }
                    isFirst = false;

                    if (s.IsPrimaryKey)
                    {
                        keySetting = s;
                    }
                }
                sb.Append(")");
            }
            else
            {
                if (i.SelectValues != null)
                {
                    string selectSql = i.SelectValues.BuildSqlStatement();
                    sb.AppendLine(selectSql);
                }
                else
                {
                    throw new InvalidOperationException(
                              "Need to specify Values or a Select query to insert - can't go on!");
                }
            }
            //if (keySetting != null)
            //{

            //    return String.Format("DECLARE BEGIN EXECUTE IMMEDIATE '{0}'; {1} END;", sb.ToString(), "select " + keySetting.Value.ToString().Replace("Nextval", "CURRVAL") + " from DUAL");

            //}
            //sb.Append("end;");


            return(sb.ToString());
        }