예제 #1
0
        /// <summary>
        /// Reads the table data and returns the INSERT statements
        /// </summary>
        /// <param name="databaseTable">The database table.</param>
        /// <param name="connectionString">The connection string.</param>
        /// <param name="providerName">Name of the provider.</param>
        /// <returns></returns>
        public string ReadTable(DatabaseTable databaseTable, string connectionString, string providerName)
        {
            var r = new Reader(databaseTable, connectionString, providerName);

            r.PageSize = PageSize;
            var dt = r.Read();
            var w  = new InsertWriter(databaseTable, dt);

            w.IncludeIdentity = IncludeIdentity;
            w.IncludeBlobs    = IncludeBlobs;
            return(w.Write(FindSqlType(providerName)));
        }
예제 #2
0
        /// <summary>
        /// Reads the table data and invokes the function for each INSERT statement. The databaseTable must have dataTypes (call DataReader.DataTypes()).
        /// </summary>
        /// <param name="databaseTable">The database table.</param>
        /// <param name="connectionString">The connection string.</param>
        /// <param name="providerName">Name of the provider.</param>
        /// <param name="processRecord">The process record.</param>
        public void ReadTable(DatabaseTable databaseTable, string connectionString, string providerName,
                              Func <string, bool> processRecord)
        {
            var r = new Reader(databaseTable, connectionString, providerName);
            var w = new InsertWriter(databaseTable, FindSqlType(providerName));

            r.Read(record =>
            {
                var s = w.WriteInsert(record);
                return(processRecord(s));
            });
        }