1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Thu Jan 18 12:24:00 GMT 2001 peter@retep.org.uk

- These methods in org.postgresql.jdbc2.ResultSet are now implemented:
            getBigDecimal(int) ie: without a scale (why did this get missed?)
            getBlob(int)
            getCharacterStream(int)
            getConcurrency()
            getDate(int,Calendar)
            getFetchDirection()
            getFetchSize()
            getTime(int,Calendar)
            getTimestamp(int,Calendar)
            getType()
          NB: Where int represents the column name, the associated version
              taking a String were already implemented by calling the int
              version.
        - These methods no longer throw the not implemented but the new noupdate
          error. This is in preparation for the Updateable ResultSet support
          which will overide these methods by extending the existing class to
          implement that functionality, but needed to show something other than
          notimplemented:
            cancelRowUpdates()
            deleteRow()
        - Added new error message into errors.properties "postgresql.noupdate"
          This is used by jdbc2.ResultSet when an update method is called and
          the ResultSet is not updateable. A new method notUpdateable() has been
          added to that class to throw this exception, keeping the binary size
          down.
        - Added new error message into errors.properties "postgresql.psqlnotimp"
          This is used instead of unimplemented when it's a feature in the
          backend that is preventing this method from being implemented.
        - Removed getKeysetSize() as its not part of the ResultSet API

Thu Jan 18 09:46:00 GMT 2001 peter@retep.org.uk
        - Applied modified patch from Richard Bullington-McGuire
          <rbulling@microstate.com>. I had to modify it as some of the code
          patched now exists in different classes, and some of it actually
          patched obsolete code.

Wed Jan 17 10:19:00 GMT 2001 peter@retep.org.uk
        - Updated Implementation to include both ANT & JBuilder
        - Updated README to reflect the changes since 7.0
	- Created jdbc.jpr file which allows JBuilder to be used to edit the
          source. JBuilder _CAN_NOT_ be used to compile. You must use ANT for
          that. It's only to allow JBuilders syntax checking to improve the
          drivers source. Refer to Implementation for more details
This commit is contained in:
Peter Mount
2001-01-18 14:50:15 +00:00
parent 89ac643964
commit 45b5d792af
25 changed files with 1459 additions and 550 deletions

0
contrib/retep/CHANGELOG Normal file
View File

View File

0
contrib/retep/README Normal file
View File

60
contrib/retep/build.xml Normal file
View File

@ -0,0 +1,60 @@
<!--
build file to build the donated retep tools packages
$Id: build.xml,v 1.1 2001/01/18 14:50:14 peter Exp $
-->
<project name="retep" default="jar" basedir=".">
<!-- set global properties for this build -->
<property name="src" value="." />
<property name="dest" value="build" />
<property name="package" value="uk/org/retep" />
<property name="jars" value="jars" />
<!-- Some checks used to build dependent on the environment -->
<target name="checks">
<available property="jdk1.2+" classname="java.lang.ThreadLocal" />
<available property="jdk1.3+" classname="java.lang.StrictMath" />
<available property="jdk1.2e+" classname="javax.sql.DataSource" />
<available property="xml" classname="org.xml.sax.Parser" />
</target>
<!-- Prepares the build by creating a directory to place the class files -->
<target name="prepare">
<mkdir dir="${dest}" />
<mkdir dir="${jars}" />
</target>
<!-- This target removes any class files from the build directory -->
<target name="clean">
<delete dir="${dest}" />
<delete dir="${jars}" />
</target>
<!-- Builds the XML Tools -->
<target name="xml" depends="checks,prepare" if="xml">
<javac srcdir="${src}" destdir="${dest}">
<include name="${package}/xml/**" />
</javac>
</target>
<!-- Builds the various jar files -->
<target name="jar" depends="xml">
<jar jarfile="${jars}/retepTools.jar" basedir="${dest}">
<include name="${package}/xml/parser/**" if="xml" />
</jar>
</target>
<target name="install" depends="jar" if="install.directory">
<copy todir="${install.directory}" overwrite="true" filtering="off">
<fileset dir="${jars}">
<include name="**/*.jar" />
</fileset>
</copy>
</target>
</project>

44
contrib/retep/retep.jpx Normal file
View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--JBuilder XML Project-->
<project>
<property category="idl" name="ProcessIDL" value="false" />
<property category="runtime.0" name="RunnableType" value="com.borland.jbuilder.runtime.ApplicationRunner" />
<property category="runtime.0" name="jsprunner.docbase" value="." />
<property category="runtime.0" name="jsprunner.jspfile" value="E%|/docs/java/xml/example6" />
<property category="sys" name="AuthorLabel" value="@author" />
<property category="sys" name="BackupPath" value="bak" />
<property category="sys" name="BeansInstantiate" value="false" />
<property category="sys" name="BraceStyle" value="1" />
<property category="sys" name="CheckStable" value="1" />
<property category="sys" name="Company" value="" />
<property category="sys" name="CompanyLabel" value="Company:" />
<property category="sys" name="Copyright" value="Copyright (c) 2001" />
<property category="sys" name="CopyrightLabel" value="Copyright:" />
<property category="sys" name="DefaultPackage" value="org.postgresql.core" />
<property category="sys" name="Description" value="" />
<property category="sys" name="DescriptionLabel" value="Description:" />
<property category="sys" name="DocPath" value="doc" />
<property category="sys" name="EventMatch" value="false" />
<property category="sys" name="EventStyle" value="1" />
<property category="sys" name="ExcludeClassEnabled" value="0" />
<property category="sys" name="InstanceVisibility" value="0" />
<property category="sys" name="JDK" value="java 1.3.0-C" />
<property category="sys" name="LastTag" value="0" />
<property category="sys" name="Libraries" value="JAXP" />
<property category="sys" name="MakeStable" value="0" />
<property category="sys" name="OutPath" value="build" />
<property category="sys" name="SourcePath" value="." />
<property category="sys" name="Title" value="" />
<property category="sys" name="TitleLabel" value="Title:" />
<property category="sys" name="Version" value="1.0" />
<property category="sys" name="VersionLabel" value="@version" />
<property category="sys" name="WorkingDirectory" value="." />
<node type="Package" name="uk.org.retep.xml.jdbc" />
<node type="Package" name="uk.org.retep.xml.parser" />
<file path="build.xml" />
<file path="CHANGELOG" />
<file path="Implementation" />
<file path="README" />
</project>

View File

@ -0,0 +1,202 @@
package uk.org.retep.xml.parser;
import java.io.CharArrayWriter;
import java.io.IOException;
import java.util.List;
import java.util.Iterator;
import java.util.Map;
import java.util.HashSet;
import java.util.ArrayList;
import java.util.HashMap;
import org.xml.sax.AttributeList;
import org.xml.sax.HandlerBase;
import org.xml.sax.InputSource;
import org.xml.sax.Parser;
import org.xml.sax.SAXException;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
/**
* This class implements the base of the XML handler. You create an instance,
* register classes (who implement TagListener) that are interested in the tags
* and pass it to SAX.
*
* <p>Or you create an instance, register the TagListeners and use the getParser()
* method to create a Parser. Then start parsing by calling it's parse() method.
*/
public class TagHandler extends HandlerBase {
/**
* The current active level
*/
private int level;
/**
* cache used to handle nesting of tags
*/
private List contents;
/**
* cache used to handle nesting of tags
*/
private List tags;
/**
* cache used to handle nesting of tags
*/
private List args;
// Current active content writer
private CharArrayWriter content;
// List of TagListener's who want to be fed data
private HashSet tagListeners;
/**
* default constructor
*/
public TagHandler() {
level=0;
contents = new ArrayList();
tags = new ArrayList();
args = new ArrayList();
tagListeners = new HashSet();
}
/**
* Called by SAX when a tag is begun. This simply creates a new level in the
* cache and stores the parameters and tag name in there.
*/
public void startElement(String p0, AttributeList p1) throws SAXException {
// Now move up and fetch a CharArrayWriter from the cache
// creating if this is the first time at this level
if(contents.size()<=level) {
contents.add(new CharArrayWriter());
tags.add(p0);
args.add(new HashMap());
}
content=(CharArrayWriter) contents.get(level);
content.reset();
// Also cache the tag's text and argument list
tags.set(level,p0);
HashMap h = (HashMap) args.get(level);
h.clear();
for(int i=p1.getLength()-1;i>-1;i--) {
h.put(p1.getName(i),p1.getValue(i));
}
// Now notify any TagListeners
Iterator it = tagListeners.iterator();
while(it.hasNext())
( (TagListener) it.next() ).tagStart(level,p0,h);
// Now move up a level
level++;
}
/**
* This is called by SAX at the end of a tag. This calls handleTag() and then
* raises the level, so that the previous parent tag may continue.
*/
public void endElement(String p0) throws SAXException {
// move up a level retrieving that level's current content
// Now this exception should never occur as the underlying parser should
// actually trap it.
if(level<1)
throw new SAXException("Already at top level?");
level--;
// Now notify any TagListeners
Iterator it = tagListeners.iterator();
while(it.hasNext())
( (TagListener) it.next() ).tagContent(content);
// allows large content to be released early
content.reset();
// Now reset content to the previous level
content=(CharArrayWriter) contents.get(level);
}
/**
* Called by SAX so that content between the start and end tags are captured.
*/
public void characters(char[] p0, int p1, int p2) throws SAXException {
content.write(p0,p1,p2);
}
/**
* Adds a TagListener so that it is notified of tags as they are processed.
* @param handler TagListener to add
*/
public void addTagListener(TagListener h) {
tagListeners.add(h);
}
/**
* Removes the TagListener so it no longer receives notifications of tags
*/
public void removeTagListener(TagListener h) {
tagListeners.remove(h);
}
/**
* This method returns a org.xml.sax.Parser object that will parse the
* contents of a URI.
*
* <p>Normally you would call this method, then call the parse(uri) method of
* the returned object.
* @return org.xml.sax.Parser object
*/
public Parser getParser()
throws SAXException
{
try {
SAXParserFactory spf = SAXParserFactory.newInstance();
String validation = System.getProperty ("javax.xml.parsers.validation", "false");
if (validation.equalsIgnoreCase("true"))
spf.setValidating (true);
SAXParser sp = spf.newSAXParser();
Parser parser = sp.getParser ();
parser.setDocumentHandler(this);
return(parser);
} catch(ParserConfigurationException pce) {
throw new SAXException(pce.toString());
}
}
/**
* This method will parse the specified URI.
*
* <p>Internally this is the same as getParser().parse(uri);
* @param uri The URI to parse
*/
public void parse(String uri)
throws IOException, SAXException
{
getParser().parse(uri);
}
/**
* This method will parse the specified InputSource.
*
* <p>Internally this is the same as getParser().parse(is);
* @param is The InputSource to parse
*/
public void parse(InputSource is)
throws IOException, SAXException
{
getParser().parse(is);
}
}

View File

@ -0,0 +1,30 @@
package uk.org.retep.xml.parser;
import java.util.HashMap;
import java.io.CharArrayWriter;
/**
* This interface defines the methods a class needs to implement if it wants the
* xml parser to notify it of any xml tags.
*/
public interface TagListener {
/**
* This is called when a tag has just been started.
* <p><b>NB:</b> args is volatile, so if you use it beyond the lifetime of
* this call, then you must make a copy of the HashMap (and not use simply
* store this HashMap).
* @param level The number of tags above this
* @param tag The tag name
* @param args A HashMap of any arguments
*/
public void tagStart(int level,String tag,HashMap args);
/**
* This method is called by ContHandler to process a tag once it has been
* fully processed.
* <p><b>NB:</b> content is volatile, so you must copy its contents if you use
* it beyond the lifetime of this call.
* @param content CharArrayWriter containing the content of the tag.
*/
public void tagContent(CharArrayWriter content);
}