コード例 #1
0
        /// <summary>
        /// Inserts the passed AuditData object into database
        /// </summary>
        /// <param name="auditObj"></param>
        /// <returns></returns>
        public static int insertContextObject(AuditData auditObj)
        {
            int    rowsAffected = 0;
            String insertCmd    = "insert into " + AuditData.AUDIT_DATA_TABLE
                                  + " ("
                                  + AuditData.AUDIT_DATA_COL_CHANGE_DATE_TIME + ","
                                  + AuditData.AUDIT_DATA_COL_CHANGED_BY_CMP + ","
                                  + AuditData.AUDIT_DATA_COL_CHNAGED_BY_USER + ","
                                  + AuditData.AUDIT_DATA_COL_CONTEXT_ID1 + ","
                                  + AuditData.AUDIT_DATA_COL_CONTEXT_ID2 + ","
                                  + AuditData.AUDIT_DATA_COL_CONTEXT_ID3 + ","
                                  + AuditData.AUDIT_DATA_COL_CONTEXT_FIELD_NAME1 + ","
                                  + AuditData.AUDIT_DATA_COL_CONTEXT_FIELD_NAME2 + ","
                                  + AuditData.AUDIT_DATA_COL_CONTEXT_FIELD_NAME3 + ","
                                  + AuditData.AUDIT_DATA_COL_FIELD_NAME + ","
                                  + AuditData.AUDIT_DATA_COL_FIELD_VALUE + ","
                                  + AuditData.AUDIT_DATA_COL_TABLE_NAME + ")"
                                  + "values (";

            Connections cn = new Connections();

            insertCmd = insertCmd + " '" + auditObj.getChange_date_time() + "'," + "'" +
                        auditObj.getChanged_by_cmp() + "'," + "'" +
                        auditObj.getChnaged_by_user() + "'," + "'" +
                        auditObj.getContext_id1() + "'," + "'" +
                        auditObj.getContext_id2() + "'," + "'" +
                        auditObj.getContext_id3() + "'," + "'" +
                        auditObj.getContext_field_name1() + "'," + "'" +
                        auditObj.getContext_field_name2() + "'," + "'" +
                        auditObj.getContext_field_name3() + "'," + "'" +
                        auditObj.getField_name() + "'," + "'" +
                        auditObj.getField_value() + "'," + "'" +
                        auditObj.getTable_name() + "'";

            insertCmd += ")";

            rowsAffected += cn.execInsertUpdateWithoutAuditEntry(insertCmd);

            cn.disconnect();
            return(rowsAffected);
        }