Examples of BinObject


Examples of org.nutz.dao.test.meta.BinObject

   
    @Test
    public void test_blob() throws IOException {
        dao.create(BinObject.class, true);
       
        BinObject obj = new BinObject();
        obj.setXblob(new ByteArrayInputStream("中文".getBytes()));
        obj.setXclob(new StringReader("不是英文"));
        dao.insert(obj);
       
        BinObject db_obj = dao.fetch(BinObject.class);
        assertTrue(Streams.equals(new ByteArrayInputStream("中文".getBytes()), db_obj.getXblob()));
        assertEquals("不是英文", Lang.readAll(db_obj.getXclob()));
    }
View Full Code Here

Examples of org.nutz.dao.test.meta.BinObject

   
    //for issue 278
    @Test
    public void test_clob() throws IOException, SQLException {
        dao.create(BinObject.class, true);
        BinObject bin = new BinObject();
        File f = File.createTempFile("clob", "data");
        Files.write(f, "中文");
        bin.setMyClob(new SimpleClob(f));
        dao.insert(bin);
       
        bin = dao.fetch(BinObject.class);
        String str = Lang.readAll(bin.getMyClob().getCharacterStream());
        assertEquals("中文", str);
    }
View Full Code Here

Examples of org.nutz.dao.test.meta.BinObject

    public void test_blob() throws IOException {
        // For mysql only
        if (dao.meta().isMySql()) {
            dao.create(BinObject.class, true);

            BinObject obj = new BinObject();
            obj.setXblob(new ByteArrayInputStream("中文".getBytes()));
            obj.setXclob(new StringReader("不是英文"));
            dao.insert(obj);

            BinObject db_obj = dao.fetch(BinObject.class);
            assertTrue(Streams.equals(new ByteArrayInputStream("中文".getBytes()), db_obj.getXblob()));
            assertEquals("不是英文", Lang.readAll(db_obj.getXclob()));
        }
    }
View Full Code Here

Examples of org.nutz.dao.test.meta.BinObject

   
    //for issue 278
    @Test
    public void test_clob() throws IOException, SQLException {
        dao.create(BinObject.class, true);
        BinObject bin = new BinObject();
        File f = File.createTempFile("clob", "data");
        Files.write(f, "中文");
        bin.setMyClob(new SimpleClob(f));
        dao.insert(bin);
       
        bin = dao.fetch(BinObject.class);
        String str = Lang.readAll(bin.getMyClob().getCharacterStream());
        assertEquals("中文", str);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.