Ejemplo n.º 1
0
        public void _14_ScriptTest()
        {
            DBParam pname    = DBParam.ParamWithDelegate(delegate { return("My Customer Name"); });
            DBParam paddress = DBParam.ParamWithDelegate(delegate { return("My Customer Address"); });

            DBQuery q = DBQuery.Begin(
                DBQuery.InsertInto("CUSOMERS").Fields("customer_name", "customer_address")
                .Values(pname, paddress),
                DBQuery.Select(DBFunction.LastID()))
                        .End();

            q = SerializeAndDeserialzeQueryToMatch(q, "Simple Script");
        }
Ejemplo n.º 2
0
        public void Test_04_InsertScript()
        {
            byte[] imgdata = this.GetLocalImage("bomb.gif");

            DBParam cName = DBParam.ParamWithValue("name", DbType.String, (object)"newType_1");
            DBParam cDesc = DBParam.ParamWithValue("desc", DbType.String, (object)"newDescrption_1");
            DBParam cPic  = DBParam.ParamWithValue("pic", DbType.Binary, (object)imgdata);

            DBInsertQuery ins = DBQuery.InsertInto("Categories")
                                .Fields("CategoryName", "Description", "Picture")
                                .Values(cName, cDesc, cPic);
            DBSelectQuery sel = DBQuery.Select(DBFunction.LastID());

            DBScript script = DBQuery.Begin(ins)
                              .Then(sel)
                              .End();

            this.OutputSql(script, "Insert and Return last ID script");
            this.OutputXML(script, "Insert and Return last ID script");
        }