dbffile.java
来自「有关JDBC的使用一些编程实例,有关与数据库连接的代码」· Java 代码 · 共 107 行
JAVA
107 行
/* * * dbfFile - an extension of tinySQL for dbf file access * * Copyright 1996 John Wiley & Sons, Inc. All Rights Reserved. Reproduction * or translation of this work beyond that permitted in Section 117 of the 1976 * United States Copyright Act without the express written permission of the * copyright owner is unlawful. Requests for further information should be * addressed to Permissions Department, John Wiley & Sons, Inc. The * purchaser may make back-up copies for his/her own use only and not for * distribution or resale. The Publisher assumes no responsibility for errors, * omissions, or damages, caused by the use of this software or from the use * of the information contained herein. * */import java.util.*;import java.lang.*;import java.io.*;public class dbfFile extends tinySQL { public String dataDir = System.getProperty("user.home") + "/.tinySQL"; /** * * Constructs a new dbfFile object * */ public dbfFile() { super(); } /** * * Constructs a new dbfFile object * * @param d directory with which to override the default data directory * */ public dbfFile( String d ) { super(); dataDir = d; } /** * * The DBF File class provides read-only access to DBF * files, so this baby should throw an exception. * */ void CreateTable ( String table_name, Vector v ) throws IOException, tinySQLException { throw new tinySQLException("The dbfFile engine is read-only"); } /** * * Return a tinySQLTable object, given a table name. * * @param table_name * @see tinySQL#getTable * */ tinySQLTable getTable (String table_name) throws tinySQLException { return (tinySQLTable) new dbfFileTable (dataDir, table_name); } /** * * The DBF File class provides read-only access to DBF * files, so this baby should throw an exception. * * @param fname table name * @see tinySQL#DropTable * */ void DropTable (String fname) throws tinySQLException { throw new tinySQLException("The dbfFile engine is read-only"); } /* * regression test */ public static void main(String argv[]) { dbfFile foo = new dbfFile("."); tsResultSet trs = null; try { trs = foo.sqlexec("SELECT * FROM PEOPLE"); } catch (Exception e) { e.printStackTrace(); } trs.PrintResultSet(); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?