public override System.Data.Common.DbParameter get_par(schema_field col) { if (col.original_type == "datetime") { return(new SqlParameter("@" + col.name.ToUpper(), SqlDbType.DateTime)); } else if (col.original_type == "datetime2") { return(new SqlParameter("@" + col.name.ToUpper(), SqlDbType.DateTime2)); } else if (col.original_type == "int") { return(new SqlParameter("@" + col.name.ToUpper(), SqlDbType.Int)); } else if (col.original_type == "smallint") { return(new SqlParameter("@" + col.name.ToUpper(), SqlDbType.SmallInt)); } else if (col.original_type == "bigint") { return(new SqlParameter("@" + col.name.ToUpper(), SqlDbType.BigInt)); } else if (col.original_type == "long") { return(new SqlParameter("@" + col.name.ToUpper(), SqlDbType.BigInt)); } else if (col.original_type == "char" || col.original_type == "varchar" || col.original_type == "nchar" || col.original_type == "nvarchar") { return(col.max_length.Value > 0 ? new SqlParameter("@" + col.name.ToUpper(), SqlDbType.VarChar, col.max_length.Value) : new SqlParameter("@" + col.name.ToUpper(), SqlDbType.VarChar)); } else if (col.original_type == "text" || col.original_type == "ntext") { return(new SqlParameter("@" + col.name.ToUpper(), SqlDbType.Text)); } else if (col.original_type == "xml") { return(new SqlParameter("@" + col.name.ToUpper(), SqlDbType.Xml)); } else if (col.original_type == "bit") { return(new SqlParameter("@" + col.name.ToUpper(), SqlDbType.Bit)); } else if (col.original_type == "decimal" || col.original_type == "numeric") { return(new SqlParameter("@" + col.name.ToUpper(), SqlDbType.Decimal)); } else if (col.original_type == "float" || col.original_type == "real" || col.original_type == "money" || col.original_type == "smallmoney") { return(new SqlParameter("@" + col.name.ToUpper(), SqlDbType.Float)); } else { throw new Exception("tipo di dati '" + col.original_type + "' non supportato per l'importazione dei dati"); } }
public static XmlNode create_field_node(XmlDocument doc, schema_field fld) { return(xml_node.set_attrs(doc.CreateElement("col"), new Dictionary <string, string>() { { "name", fld.name }, { "name-upper", fld.name.ToUpper() } , { "type", fld.original_type }, { "autonumber", fld.auto_number ? "true" : "" } , { "nullable", fld.nullable ? "true" : "" }, { "default", fld.def_val } , { "maxlength", fld.max_length.HasValue ? fld.max_length.Value.ToString() : "" } , { "numprec", fld.num_prec.HasValue ? fld.num_prec.Value.ToString() : "" } , { "numscale", fld.num_scale.HasValue ? fld.num_scale.Value.ToString() : "" } })); }
public XmlNode set_field(string table, schema_field new_field) { XmlNode col_node = field_node(table, new_field.name); if (col_node == null) { return(xml_node.add_node(table_node(table).SelectSingleNode("cols"), create_field_node(new_field))); } XmlNode res = xml_node.add_node(table_node(table).SelectSingleNode("cols"), create_field_node(new_field), col_node); col_node.ParentNode.RemoveChild(col_node); return(res); }
public override System.Data.Common.DbParameter get_par(schema_field col) { OleDbParameter result = null; if (col.original_type == "datetime") { result = new OleDbParameter("@" + col.name.ToUpper(), OleDbType.DBDate); } else if (col.original_type == "int" || col.original_type == "smallint") { result = new OleDbParameter("@" + col.name.ToUpper(), OleDbType.Integer); } else if (col.original_type == "bigint" || col.original_type == "long") { result = new OleDbParameter("@" + col.name.ToUpper(), OleDbType.BigInt); } else if (col.original_type == "char" || col.original_type == "varchar" || col.original_type == "text" || col.original_type == "nchar" || col.original_type == "nvarchar" || col.original_type == "ntext") { result = new OleDbParameter("@" + col.name.ToUpper(), OleDbType.VarChar, col.max_length.Value); } else if (col.original_type == "bit") { result = new OleDbParameter("@" + col.name.ToUpper(), OleDbType.Boolean); } else if (col.original_type == "float" || col.original_type == "real" || col.original_type == "decimal" || col.original_type == "money" || col.original_type == "smallmoney" || col.original_type == "numeric") { result = new OleDbParameter("@" + col.name.ToUpper(), OleDbType.Double); } else { throw new Exception("tipo di dati '" + col.original_type + "' non supportato per l'importazione dei dati"); } return(result); }
public virtual void alter_field(schema_field tblfield, string tableName) { throw new Exception("il provider " + _dbType.ToString() + " non supporta la funzionalità alterFieldTable"); }
public virtual void drop_field(schema_field field, string tableName) { throw new Exception("il provider " + _dbType.ToString() + " non supporta la funzionalità dropFieldToTable"); }
public virtual System.Data.Common.DbParameter get_par(schema_field col) { throw new Exception("il provider " + _dbType.ToString() + " non supporta la funzionalità getParameter"); }
public override void upd_field(schema_field tblField, string tableName) { exec("ALTER TABLE " + tableName + " ALTER COLUMN " + tblField.fld_sql_server()); }
public override void alter_field(schema_field tblfield, string tableName) { exec("ALTER TABLE [" + tableName + "] ALTER COLUMN " + tblfield.fld_access()); }
public override void drop_field(schema_field field, string tableName) { exec("ALTER TABLE [" + tableName + "] DROP COLUMN [" + field.name + "]"); }
public override void add_field(schema_field tblField, string tableName) { exec("ALTER TABLE [" + tableName + "] ADD " + tblField.fld_access()); }
public XmlNode create_field_node(schema_field fld) { return(create_field_node(_doc.doc, fld)); }