summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2006-08-07 11:33:24 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2006-08-07 11:33:24 +0000
commite14758ca3e49897188f79ebc8992ab0dd002378e (patch)
tree5d319d958edcc3543068a417c44f636dd95ebbbf
parent7c1c301b79b1cea281752a4b8556f3f8e1c78741 (diff)
downloadjackcess-e14758ca3e49897188f79ebc8992ab0dd002378e.tar.gz
jackcess-e14758ca3e49897188f79ebc8992ab0dd002378e.zip
use uppercase names when adding text columns to indexes, which fixes long standing problem with table names starting with lowercase characters (and other situations where tables could not be opened in access)
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@94 f203690c-595d-4dc9-a70b-905162fa7fd2
-rw-r--r--src/java/com/healthmarketscience/jackcess/Database.java5
-rw-r--r--src/java/com/healthmarketscience/jackcess/Index.java6
2 files changed, 5 insertions, 6 deletions
diff --git a/src/java/com/healthmarketscience/jackcess/Database.java b/src/java/com/healthmarketscience/jackcess/Database.java
index b36471f..fd90579 100644
--- a/src/java/com/healthmarketscience/jackcess/Database.java
+++ b/src/java/com/healthmarketscience/jackcess/Database.java
@@ -334,16 +334,11 @@ public class Database
public void createTable(String name, List<Column> columns)
throws IOException
{
-
if(getTable(name) != null) {
throw new IllegalArgumentException(
"Cannot create table with name of existing table");
}
- //There is some really bizarre bug in here where tables that start with
- //the letters a-m (only lower case) won't open in Access. :)
- name = Character.toUpperCase(name.charAt(0)) + name.substring(1);
-
//We are creating a new page at the end of the db for the tdef.
int pageNumber = _pageChannel.getPageCount();
diff --git a/src/java/com/healthmarketscience/jackcess/Index.java b/src/java/com/healthmarketscience/jackcess/Index.java
index d1a8321..69ca1e5 100644
--- a/src/java/com/healthmarketscience/jackcess/Index.java
+++ b/src/java/com/healthmarketscience/jackcess/Index.java
@@ -410,6 +410,10 @@ public class Index implements Comparable<Index> {
public EntryColumn(Column col, Comparable value) {
_column = col;
_value = value;
+ if(_column.getType() == DataType.TEXT) {
+ // index strings are stored as uppercase
+ _value = ((_value != null) ? _value.toString().toUpperCase() : null);
+ }
}
/**
@@ -459,7 +463,7 @@ public class Index implements Comparable<Index> {
if (_column.getType() == DataType.TEXT) {
String s = (String) _value;
for (int i = 0; i < s.length(); i++) {
- Byte b = (Byte) CODES.get(new Character(Character.toUpperCase(s.charAt(i))));
+ Byte b = (Byte) CODES.get(new Character(s.charAt(i)));
if (b == null) {
throw new IOException("Unmapped index value: " + s.charAt(i));