提交 6c8120d6 编写于 作者: B Bruce Momjian

More jdbc comment cleanups. Code looks very nice now.

上级 46d50783
......@@ -6,7 +6,7 @@ import java.io.*;
import java.sql.*;
import org.postgresql.largeobject.*;
/**
/*
* This example is a small application that stores and displays images
* held on a postgresql database.
*
......@@ -81,7 +81,7 @@ public class ImageViewer implements ItemListener
paint(g);
}
/**
/*
* Paints the image, using double buffering to prevent screen flicker
*/
public void paint(Graphics gr)
......@@ -212,7 +212,7 @@ public class ImageViewer implements ItemListener
}
/**
/*
* This method initialises the database by creating a table that contains
* the image names, and Large Object OID's
*/
......@@ -238,7 +238,7 @@ public class ImageViewer implements ItemListener
//}
}
/**
/*
* This closes the connection, and ends the application
*/
public void close()
......@@ -254,7 +254,7 @@ public class ImageViewer implements ItemListener
System.exit(0);
}
/**
/*
* This imports an image into the database, using a Thread to do this in the
* background.
*/
......@@ -272,7 +272,7 @@ public class ImageViewer implements ItemListener
t.start();
}
/**
/*
* This is an example of using a thread to import a file into a Large Object.
* It uses the Large Object extension, to write blocks of the file to the
* database.
......@@ -362,7 +362,7 @@ public class ImageViewer implements ItemListener
}
}
/**
/*
* This refreshes the list of available images
*/
public void refreshList()
......@@ -385,7 +385,7 @@ public class ImageViewer implements ItemListener
}
}
/**
/*
* This removes an image from the database
*
* Note: With postgresql, this is the only way of deleting a large object
......@@ -427,7 +427,7 @@ public class ImageViewer implements ItemListener
}
}
/**
/*
* This displays an image from the database.
*
* For images, this is the easiest method.
......@@ -476,7 +476,7 @@ public class ImageViewer implements ItemListener
displayImage(list.getItem(((Integer)e.getItem()).intValue()));
}
/**
/*
* This is the command line instructions
*/
public static void instructions()
......@@ -489,7 +489,7 @@ public class ImageViewer implements ItemListener
System.err.println("Note: If you are running this for the first time on a particular database,\nyou have to select \"Initialise\" in the \"PostgreSQL\" menu.\nThis will create a table used to store image names.");
}
/**
/*
* This is the application entry point
*/
public static void main(String args[])
......
......@@ -4,7 +4,7 @@ import java.io.*;
import java.sql.*;
import java.util.*;
/**
/*
* Test inserting and extracting Unicode-encoded strings.
*
* Synopsis:
......@@ -22,17 +22,17 @@ import java.util.*;
public class Unicode
{
/**
/*
* The url for the database to connect to.
*/
private String url;
/**
/*
* The user to connect as.
*/
private String user;
/**
/*
* The password to connect with.
*/
private String password;
......@@ -61,7 +61,7 @@ public class Unicode
this.password = password;
}
/**
/*
* Establish and return a connection to the database.
*/
private Connection getConnection() throws SQLException,
......@@ -75,7 +75,7 @@ public class Unicode
return DriverManager.getConnection(url, info);
}
/**
/*
* Get string representing a block of 256 consecutive unicode characters.
* We exclude the null character, "'", and "\".
*/
......@@ -97,7 +97,7 @@ public class Unicode
return sb.toString();
}
/**
/*
* Is the block a block of valid unicode values.
* d800 to db7f is the "unassigned high surrogate" range.
* db80 to dbff is the "private use" range.
......@@ -112,7 +112,7 @@ public class Unicode
return true;
}
/**
/*
* Report incorrect block retrieval.
*/
private void reportRetrievalError(int blockNum, String block,
......@@ -142,7 +142,7 @@ public class Unicode
log(message);
}
/**
/*
* Do the testing.
*/
public void runTest()
......
......@@ -4,9 +4,9 @@ import java.io.*;
import java.sql.*;
import java.text.*;
/**
/*
*
* $Id: basic.java,v 1.8 2001/10/25 05:59:58 momjian Exp $
* $Id: basic.java,v 1.9 2001/11/19 22:43:13 momjian Exp $
*
* This example tests the basic components of the JDBC driver, and shows
* how even the simplest of queries can be implemented.
......@@ -56,7 +56,7 @@ public class basic
//throw postgresql.Driver.notImplemented();
}
/**
/*
* This drops the table (if it existed). No errors are reported.
*/
public void cleanup()
......@@ -71,7 +71,7 @@ public class basic
}
}
/**
/*
* This performs the example
*/
public void doexample() throws SQLException
......@@ -178,7 +178,7 @@ public class basic
// cleanup() method.
}
/**
/*
* Display some instructions on how to run the example
*/
public static void instructions()
......@@ -188,7 +188,7 @@ public class basic
System.exit(1);
}
/**
/*
* This little lot starts the test
*/
public static void main(String args[])
......
......@@ -4,7 +4,7 @@ import java.io.*;
import java.sql.*;
import org.postgresql.largeobject.*;
/**
/*
* This test attempts to create a blob in the database, then to read
* it back.
*
......@@ -64,7 +64,7 @@ public class blobtest
}
/**
/*
* Now this is an extension to JDBC, unique to postgresql. Here we fetch
* an PGlobj object, which provides us with access to postgresql's
* large object api.
......
......@@ -4,12 +4,12 @@ import java.io.*;
import java.sql.*;
import org.omg.CosNaming.*;
/**
/*
* This class is the frontend to our mini CORBA application.
*
* It has no GUI, just a text frontend to keep it simple.
*
* $Id: StockClient.java,v 1.2 2001/10/25 05:59:58 momjian Exp $
* $Id: StockClient.java,v 1.3 2001/11/19 22:43:13 momjian Exp $
*/
public class StockClient
{
......
......@@ -2,7 +2,7 @@ package example.corba;
import java.sql.*;
/**
/*
* This class handles the JDBC side of things. It opens a connection to
* the database, and performes queries on that database.
*
......@@ -13,7 +13,7 @@ import java.sql.*;
* that an object could be changed by another client, and we need to ensure that
* the returned data is live and accurate.
*
* $Id: StockDB.java,v 1.3 2001/10/25 05:59:58 momjian Exp $
* $Id: StockDB.java,v 1.4 2001/11/19 22:43:13 momjian Exp $
*/
public class StockDB
{
......
......@@ -2,10 +2,10 @@ package example.corba;
import org.omg.CosNaming.*;
/**
/*
* This class implements the server side of the example.
*
* $Id: StockDispenserImpl.java,v 1.2 2001/10/25 05:59:58 momjian Exp $
* $Id: StockDispenserImpl.java,v 1.3 2001/11/19 22:43:13 momjian Exp $
*/
public class StockDispenserImpl extends stock._StockDispenserImplBase
{
......@@ -39,7 +39,7 @@ public class StockDispenserImpl extends stock._StockDispenserImplBase
}
}
/**
/*
* This method, defined in stock.idl, reserves a slot in the dispenser
*/
public stock.StockItem reserveItem() throws stock.StockException
......@@ -56,7 +56,7 @@ public class StockDispenserImpl extends stock._StockDispenserImplBase
return null;
}
/**
/*
* This releases a slot from the dispenser
*/
public void releaseItem(stock.StockItem item) throws stock.StockException
......@@ -74,7 +74,7 @@ public class StockDispenserImpl extends stock._StockDispenserImplBase
return ;
}
/**
/*
* This class defines a slot in the dispenser
*/
class StockItemStatus
......
......@@ -2,10 +2,10 @@ package example.corba;
import org.omg.CosNaming.*;
/**
/*
* This class implements the server side of the example.
*
* $Id: StockItemImpl.java,v 1.2 2001/10/25 05:59:58 momjian Exp $
* $Id: StockItemImpl.java,v 1.3 2001/11/19 22:43:13 momjian Exp $
*/
public class StockItemImpl extends stock._StockItemImplBase
{
......@@ -28,7 +28,7 @@ public class StockItemImpl extends stock._StockItemImplBase
}
}
/**
/*
* This is defined in stock.idl
*
* It sets the item to view
......@@ -46,7 +46,7 @@ public class StockItemImpl extends stock._StockItemImplBase
}
/**
/*
* This is defined in stock.idl
*
* It sets the item to view
......@@ -63,7 +63,7 @@ public class StockItemImpl extends stock._StockItemImplBase
}
}
/**
/*
* This is defined in stock.idl
*
* It returns the description of a Stock item
......@@ -80,7 +80,7 @@ public class StockItemImpl extends stock._StockItemImplBase
}
}
/**
/*
* This is defined in stock.idl
*
* It returns the description of a Stock item
......@@ -97,7 +97,7 @@ public class StockItemImpl extends stock._StockItemImplBase
}
}
/**
/*
* This is defined in stock.idl
*
* It returns the description of a Stock item
......@@ -114,7 +114,7 @@ public class StockItemImpl extends stock._StockItemImplBase
}
}
/**
/*
* This is defined in stock.idl
*
* It returns the description of a Stock item
......@@ -131,7 +131,7 @@ public class StockItemImpl extends stock._StockItemImplBase
}
}
/**
/*
* This is defined in stock.idl
*
* It returns the description of a Stock item
......@@ -148,7 +148,7 @@ public class StockItemImpl extends stock._StockItemImplBase
}
}
/**
/*
* This is defined in stock.idl
*
* It returns the description of a Stock item
......@@ -165,7 +165,7 @@ public class StockItemImpl extends stock._StockItemImplBase
}
}
/**
/*
* This is defined in stock.idl
*
* It returns the description of a Stock item
......@@ -182,7 +182,7 @@ public class StockItemImpl extends stock._StockItemImplBase
}
}
/**
/*
* This returns the highest id used, hence the number of items available
*/
public int getLastID() throws stock.StockException
......@@ -197,7 +197,7 @@ public class StockItemImpl extends stock._StockItemImplBase
}
}
/**
/*
* This is used by our Dispenser
*/
public String getInstanceName()
......
......@@ -2,10 +2,10 @@ package example.corba;
import org.omg.CosNaming.*;
/**
/*
* This class implements the server side of the example.
*
* $Id: StockServer.java,v 1.2 2001/10/25 05:59:58 momjian Exp $
* $Id: StockServer.java,v 1.3 2001/11/19 22:43:13 momjian Exp $
*/
public class StockServer
{
......
......@@ -4,7 +4,7 @@ import java.io.*;
import java.sql.*;
import java.text.*;
/**
/*
* This example tests the various date styles that are available to postgresql.
*
* To use this example, you need a database to be in existence. This example
......@@ -64,7 +64,7 @@ public class datestyle
}
/**
/*
* This drops the table (if it existed). No errors are reported.
*/
public void cleanup()
......@@ -79,7 +79,7 @@ public class datestyle
}
}
/**
/*
* This initialises the database for this example
*/
public void init() throws SQLException
......@@ -108,7 +108,7 @@ public class datestyle
}
/**
/*
* This performs the example
*/
public void doexample() throws SQLException
......@@ -150,7 +150,7 @@ public class datestyle
}
}
/**
/*
* Display some instructions on how to run the example
*/
public static void instructions()
......@@ -160,7 +160,7 @@ public class datestyle
System.exit(1);
}
/**
/*
* This little lot starts the test
*/
public static void main(String args[])
......
......@@ -4,7 +4,7 @@ import java.io.*;
import java.sql.*;
import java.text.*;
/**
/*
* This example application is not really an example. It actually performs
* some tests on various methods in the DatabaseMetaData and ResultSetMetaData
* classes.
......@@ -19,7 +19,7 @@ public class metadata
Statement st; // Our statement to run queries with
DatabaseMetaData dbmd; // This defines the structure of the database
/**
/*
* These are the available tests on DatabaseMetaData
*/
public void doDatabaseMetaData() throws SQLException
......@@ -53,7 +53,7 @@ public class metadata
}
/**
/*
* These are the available tests on ResultSetMetaData
*/
public void doResultSetMetaData() throws SQLException
......@@ -81,7 +81,7 @@ public class metadata
rs.close();
}
/**
/*
* This creates some test data
*/
public void init() throws SQLException
......@@ -98,7 +98,7 @@ public class metadata
st.executeUpdate("insert into test_c values ('nowhere particular','$10.99',1)");
}
/**
/*
* This removes the test data
*/
public void cleanup() throws SQLException
......@@ -152,7 +152,7 @@ public class metadata
cleanup();
}
/**
/*
* This asks if the user requires to run a test.
*/
public boolean doTest(String s)
......@@ -177,7 +177,7 @@ public class metadata
return c == 'y' || c == 'Y';
}
/**
/*
* This displays a result set.
* Note: it closes the result once complete.
*/
......@@ -211,7 +211,7 @@ public class metadata
rs.close();
}
/**
/*
* This process / commands (for now just /d)
*/
public void processSlashCommand(String line) throws SQLException
......@@ -259,7 +259,7 @@ public class metadata
private static final String usrSequences[] = {"SEQUENCE"};
private static final String sysTables[] = {"SYSTEM TABLE", "SYSTEM INDEX"};
/**
/*
* Display some instructions on how to run the example
*/
public static void instructions()
......@@ -269,7 +269,7 @@ public class metadata
System.exit(1);
}
/**
/*
* This little lot starts the test
*/
public static void main(String args[])
......
......@@ -4,7 +4,7 @@ import java.io.*;
import java.sql.*;
import java.text.*;
/**
/*
* This example application demonstrates some of the drivers other features
* by implementing a simple psql replacement in Java.
*
......@@ -75,7 +75,7 @@ public class psql
}
/**
/*
* This processes a statement
*/
public void processLine(String line) throws SQLException
......@@ -117,7 +117,7 @@ public class psql
}
}
/**
/*
* This displays a result set.
* Note: it closes the result once complete.
*/
......@@ -147,7 +147,7 @@ public class psql
rs.close();
}
/**
/*
* This process / commands (for now just /d)
*/
public void processSlashCommand(String line) throws SQLException
......@@ -197,7 +197,7 @@ public class psql
private static final String usrSequences[] = {"SEQUENCE"};
private static final String sysTables[] = {"SYSTEM TABLE", "SYSTEM INDEX"};
/**
/*
* Display some instructions on how to run the example
*/
public static void instructions()
......@@ -207,7 +207,7 @@ public class psql
System.exit(1);
}
/**
/*
* This little lot starts the test
*/
public static void main(String args[])
......
......@@ -7,7 +7,7 @@ import java.text.*;
// rare in user code, but we use the LargeObject API in this test
import org.postgresql.largeobject.*;
/**
/*
* This example tests the thread safety of the driver.
*
* It does this by performing several queries, in different threads. Each
......@@ -56,7 +56,7 @@ public class threadsafe
}
/**
/*
* This drops the table (if it existed). No errors are reported.
*/
public void cleanup()
......@@ -80,7 +80,7 @@ public class threadsafe
}
}
/**
/*
* This performs the example
*/
public void doexample() throws SQLException
......@@ -366,7 +366,7 @@ public class threadsafe
}
}
/**
/*
* Display some instructions on how to run the example
*/
public static void instructions()
......@@ -376,7 +376,7 @@ public class threadsafe
System.exit(1);
}
/**
/*
* This little lot starts the test
*/
public static void main(String args[])
......
package utils;
/**
/*
* This little app checks to see what version of JVM is being used.
* It does this by checking first the java.vm.version property, and
* if that fails, it looks for certain classes that should be present.
*/
public class CheckVersion
{
/**
/*
* Check for the existence of a class by attempting to load it
*/
public static boolean checkClass(String c)
......@@ -23,7 +23,7 @@ public class CheckVersion
return true;
}
/**
/*
* This first checks java.vm.version for 1.1, 1.2 or 1.3.
*
* It writes jdbc1 to stdout for the 1.1.x VM.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册