Package org.hsqldb.persist

Examples of org.hsqldb.persist.TextFileReader


            database.persistentStoreCollection.getStore(this);

        this.store = store;

        TextCache      cache  = null;
        TextFileReader reader = null;

        try {
            cache = (TextCache) database.logger.openTextFilePersistence(this,
                    dataSource, withReadOnlyData, isReversed);

            store.setCache(cache);

            reader = cache.getTextFileReader();

            // read and insert all the rows from the source file
            Row row     = null;
            long nextpos = 0;

            if (cache.isIgnoreFirstLine()) {
                nextpos += reader.readHeaderLine();
                cache.setHeaderInitialise(reader.getHeaderLine());
            }

            while (true) {
                RowInputInterface rowIn = reader.readObject(nextpos);

                if (rowIn == null) {
                    break;
                }

                row = (Row) store.get(rowIn);

                if (row == null) {
                    break;
                }

                Object[] data = row.getData();

                nextpos = (int) row.getPos() + row.getStorageSize();

                systemUpdateIdentityValue(data);
                enforceRowConstraints(session, data);
                store.indexRow(session, row);
            }
        } catch (Throwable t) {
            int linenumber = reader == null ? 0
                                            : reader.getLineNumber();

            clearAllData(session);

            if (cache != null) {
                database.logger.closeTextCache(this);
View Full Code Here

TOP

Related Classes of org.hsqldb.persist.TextFileReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.