public virtual void FillTable(ITableStructure table, IDataQueue queue, TableCopyOptions opts) { var colnames = from c in queue.GetRowFormat.Columns select c.ColumnName; bool autoinc = queue.GetRowFormat.FindAutoIncrementColumn() != null; if (autoinc) { m_dmp.AllowIdentityInsert(table.FullName, true); } try { while (!queue.IsEof) { IBedRecord row = queue.GetRecord(); m_dmp.PutCmd("^insert ^into %f (%,i) ^values (%,v)", table, colnames, row); } } finally { queue.CloseReading(); } if (autoinc) { m_dmp.AllowIdentityInsert(table.FullName, false); } }
public void SetVersionSql(ISqlDumper dmp) { if (!String.IsNullOrEmpty(Db.m_props.SetVersionSql)) { dmp.PutCmd(Db.m_props.SetVersionSql.Replace("#VERSION#", Name)); } }
public static void GenerateInsertFixedData(ISqlDumper dmp, ITableStructure ts) { if (ts.FixedData == null) { return; } foreach (var row in ts.FixedData.Rows) { dmp.PutCmd("^insert ^into %f (%,i) ^values (%,v)", ts.FullName, from c in ts.Columns select c.ColumnName, row ); } }
public override void GenerateSqlRow(IBedRecord row, ISqlDumper dmp, string[] selcolumns) { string[] colnames = GetColumns(ValueColumns, row.Structure, selcolumns); var vals = new ValueTypeHolder[colnames.Length]; for (int i = 0; i < colnames.Length; i++) { vals[i] = new ValueTypeHolder(row.GetValue(colnames[i]), row.Structure.Columns[colnames[i]].DataType); } dmp.PutCmd("^insert ^into %f (%,i) ^values (%,v)", FullTableName, colnames, vals ); }
protected void GenerateFillTable(ITableStructure tbl, ISqlDumper dmp) { var autocol = tbl.FindAutoIncrementColumn(); if (autocol != null) { dmp.AllowIdentityInsert(tbl.FullName, true); } var colnames = from c in tbl.Columns select c.ColumnName; dmp.PutCmd("^insert ^into %f (%,i) ^select %,i ^from %s.%f", tbl.FullName, colnames, colnames, SourceDb, tbl.FullName); if (autocol != null) { dmp.AllowIdentityInsert(tbl.FullName, false); } }
public void GenerateRegister(ISqlDumper dmp) { dmp.PutCmd("^CREATE ^AGGREGATE %i (@Value nvarchar(4000)) ^RETURNS nvarchar(4000) ^EXTERNAL ^NAME %i.%i", Attribute.Name ?? ClrType.Name, m_wrapper.m_name, ClrType.FullName); }
public void GenerateCreate(ISqlDumper dmp) { dmp.PutCmd("^create ^assembly %i ^from 0x%s ^with ^permission_set = ^safe", m_name, StringTool.EncodeHex(m_data)); }