git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@1361 f203690c-595d-4dc9-a70b-905162fa7fd2tags/jackcess-4.0.1
<author email="javajedi@users.sf.net">Tim McCune</author> | <author email="javajedi@users.sf.net">Tim McCune</author> | ||||
</properties> | </properties> | ||||
<body> | <body> | ||||
<release version="4.0.1" date="TBD"> | |||||
<action dev="jahlborn" type="fix"> | |||||
Ignore trailing spaces when creating text index entries. | |||||
</action> | |||||
</release> | |||||
<release version="4.0.0" date="2021-01-20"> | <release version="4.0.0" date="2021-01-20"> | ||||
<action dev="jahlborn" type="update"> | <action dev="jahlborn" type="update"> | ||||
Add Automatic-Module-Name in order to make Jackcess safe to use in the | Add Automatic-Module-Name in order to make Jackcess safe to use in the |
Object value, ByteStream bout, boolean isAscending) | Object value, ByteStream bout, boolean isAscending) | ||||
throws IOException | throws IOException | ||||
{ | { | ||||
// first, convert to string | |||||
String str = ColumnImpl.toCharSequence(value).toString(); | |||||
// all text columns (including memos) are only indexed up to the max | |||||
// number of chars in a VARCHAR column | |||||
if(str.length() > MAX_TEXT_INDEX_CHAR_LENGTH) { | |||||
str = str.substring(0, MAX_TEXT_INDEX_CHAR_LENGTH); | |||||
} | |||||
// convert to string | |||||
String str = toIndexCharSequence(value); | |||||
// record previous entry length so we can do any post-processing | // record previous entry length so we can do any post-processing | ||||
// necessary for this entry (handling descending) | // necessary for this entry (handling descending) |
Object value, ByteStream bout, boolean isAscending) | Object value, ByteStream bout, boolean isAscending) | ||||
throws IOException | throws IOException | ||||
{ | { | ||||
// first, convert to string | |||||
String str = ColumnImpl.toCharSequence(value).toString(); | |||||
// all text columns (including memos) are only indexed up to the max | |||||
// number of chars in a VARCHAR column | |||||
if(str.length() > MAX_TEXT_INDEX_CHAR_LENGTH) { | |||||
str = str.substring(0, MAX_TEXT_INDEX_CHAR_LENGTH); | |||||
} | |||||
// convert to string | |||||
String str = toIndexCharSequence(value); | |||||
// record previous entry length so we can do any post-processing | // record previous entry length so we can do any post-processing | ||||
// necessary for this entry (handling descending) | // necessary for this entry (handling descending) | ||||
bout.write(END_EXTRA_TEXT); | bout.write(END_EXTRA_TEXT); | ||||
} | } | ||||
protected static String toIndexCharSequence(Object value) | |||||
throws IOException { | |||||
// first, convert to string | |||||
String str = ColumnImpl.toCharSequence(value).toString(); | |||||
// all text columns (including memos) are only indexed up to the max | |||||
// number of chars in a VARCHAR column | |||||
int len = str.length(); | |||||
if(len > MAX_TEXT_INDEX_CHAR_LENGTH) { | |||||
str = str.substring(0, MAX_TEXT_INDEX_CHAR_LENGTH); | |||||
len = MAX_TEXT_INDEX_CHAR_LENGTH; | |||||
} | |||||
// trailing spaces are ignored for text index entries | |||||
if((len > 0) && (str.charAt(len - 1) == ' ')) { | |||||
do { | |||||
--len; | |||||
} while((len > 0) && (str.charAt(len - 1) == ' ')); | |||||
str = str.substring(0, len); | |||||
} | |||||
return str; | |||||
} | |||||
/** | /** | ||||
* Encodes the given extra code info in the given stream. | * Encodes the given extra code info in the given stream. | ||||
*/ | */ |