mirror of
https://github.com/gnustep/libs-sqlclient.git
synced 2025-02-14 15:40:59 +00:00
Turn off automatic trimming by default
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@36500 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
395ebee3f4
commit
b83f8363c5
8 changed files with 68 additions and 8 deletions
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
|||
2013-04-10 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* ECPG.pgm:
|
||||
* MySQL.m:
|
||||
* Oracle.pm:
|
||||
* Postgres.m:
|
||||
* SQLClient.h:
|
||||
* SQLClient.m:
|
||||
* GNUmakefile:
|
||||
Change behavior to no longer trim leading and trailing space from
|
||||
values retrieved from database by default.
|
||||
Add method to restore automatic trimming for a connection if needed.
|
||||
|
||||
2013-03-04 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Version 1.6.1: released
|
||||
|
|
10
ECPG.pgm
10
ECPG.pgm
|
@ -557,7 +557,10 @@ static unsigned int trim(char *str)
|
|||
case SQL3_CHARACTER_VARYING:
|
||||
EXEC SQL GET DESCRIPTOR myDesc VALUE :index
|
||||
:aString = DATA;
|
||||
trim(aString);
|
||||
if (_shouldTrim)
|
||||
{
|
||||
trim(aString);
|
||||
}
|
||||
v = [NSString stringWithUTF8String: aString];
|
||||
free(aString);
|
||||
break;
|
||||
|
@ -586,7 +589,10 @@ static unsigned int trim(char *str)
|
|||
default:
|
||||
EXEC SQL GET DESCRIPTOR myDesc VALUE :index
|
||||
:aString = DATA;
|
||||
trim(aString);
|
||||
if (_shouldTrim)
|
||||
{
|
||||
trim(aString);
|
||||
}
|
||||
v = [NSString stringWithUTF8String: aString];
|
||||
free(aString);
|
||||
if ([self debugging] > 0)
|
||||
|
|
|
@ -21,7 +21,7 @@ include $(GNUSTEP_MAKEFILES)/common.make
|
|||
-include config.make
|
||||
|
||||
PACKAGE_NAME = SQLClient
|
||||
PACKAGE_VERSION = 1.6.1
|
||||
PACKAGE_VERSION = 1.7.0
|
||||
CVS_MODULE_NAME = gnustep/dev-libs/SQLClient
|
||||
CVS_TAG_NAME = SQLClient
|
||||
SVN_BASE_URL=svn+ssh://svn.gna.org/svn/gnustep/libs
|
||||
|
@ -34,7 +34,7 @@ TEST_TOOL_NAME=
|
|||
LIBRARY_NAME=SQLClient
|
||||
DOCUMENT_NAME=SQLClient
|
||||
|
||||
SQLClient_INTERFACE_VERSION=1.6
|
||||
SQLClient_INTERFACE_VERSION=1.7
|
||||
|
||||
SQLClient_OBJC_FILES = SQLClient.m
|
||||
SQLClient_LIBRARIES_DEPEND_UPON = -lPerformance
|
||||
|
|
5
MySQL.m
5
MySQL.m
|
@ -434,7 +434,10 @@ static unsigned int trim(char *str)
|
|||
break;
|
||||
|
||||
default:
|
||||
trim((char*)p);
|
||||
if (YES == _shouldTrim)
|
||||
{
|
||||
trim((char*)p);
|
||||
}
|
||||
v = [NSString stringWithUTF8String: (char*)p];
|
||||
break;
|
||||
}
|
||||
|
|
10
Oracle.pm
10
Oracle.pm
|
@ -554,7 +554,10 @@ static unsigned int trim(char *str)
|
|||
|
||||
/* \0-pad the string. */
|
||||
aString[octetLength] = '\0';
|
||||
trim (aString);
|
||||
if (YES == _shouldTrim)
|
||||
{
|
||||
trim (aString);
|
||||
}
|
||||
v = [NSString stringWithUTF8String: aString];
|
||||
free(aString);
|
||||
break;
|
||||
|
@ -585,7 +588,10 @@ static unsigned int trim(char *str)
|
|||
EXEC SQL GET DESCRIPTOR 'myDesc' VALUE :index
|
||||
:aString = DATA;
|
||||
aString[octetLength] = '\0';
|
||||
trim (aString);
|
||||
if (YES == _shouldTrim)
|
||||
{
|
||||
trim (aString);
|
||||
}
|
||||
v = [NSString stringWithUTF8String: aString];
|
||||
free (aString);
|
||||
NSLog(@"(Oracle) Unknown data type (%d) for '%s': '%@'",
|
||||
|
|
17
Postgres.m
17
Postgres.m
|
@ -619,10 +619,25 @@ static unsigned int trim(char *str)
|
|||
v = [self dataFromBLOB: p];
|
||||
break;
|
||||
|
||||
default:
|
||||
case 18: // "char"
|
||||
v = [NSString stringWithUTF8String: p];
|
||||
break;
|
||||
|
||||
case 20: // INT8
|
||||
case 21: // INT2
|
||||
case 23: // INT4
|
||||
trim(p);
|
||||
v = [NSString stringWithUTF8String: p];
|
||||
break;
|
||||
|
||||
case 25: // TEXT
|
||||
default:
|
||||
if (YES == _shouldTrim)
|
||||
{
|
||||
trim(p);
|
||||
}
|
||||
v = [NSString stringWithUTF8String: p];
|
||||
break;
|
||||
}
|
||||
}
|
||||
else // Binary
|
||||
|
|
12
SQLClient.h
12
SQLClient.h
|
@ -369,6 +369,12 @@ SQLCLIENT_PRIVATE
|
|||
* set by the -begin, -commit or -rollback methods.
|
||||
*/
|
||||
BOOL _inTransaction; /** Are we inside a transaction? */
|
||||
/**
|
||||
* A flag indicating whether wleading and trailing white space in values
|
||||
* read from the database shoud automatically be removed.<br />
|
||||
* This should only be modified by the -setShouldTrim: method.
|
||||
*/
|
||||
BOOL _shouldTrim; /** Should whitespace be trimmed? */
|
||||
NSString *_name; /** Unique identifier for instance */
|
||||
NSString *_client; /** Identifier within backend */
|
||||
NSString *_database; /** The configured database name/host */
|
||||
|
@ -822,6 +828,12 @@ SQLCLIENT_PRIVATE
|
|||
*/
|
||||
- (void) setPassword: (NSString*)s;
|
||||
|
||||
/** Sets an internal flag to indicate whether leading and trailing white
|
||||
* space characters should be removed from values retrieved from the
|
||||
* database by the receiver.
|
||||
*/
|
||||
- (void) setShouldTrim: (BOOL)aFlag;
|
||||
|
||||
/**
|
||||
* Set the database user for this object.<br />
|
||||
* This is called automatically to configure the connection ...
|
||||
|
|
|
@ -1843,6 +1843,11 @@ static unsigned int maxConnections = 8;
|
|||
}
|
||||
}
|
||||
|
||||
- (void) setShouldTrim: (BOOL)aFlag
|
||||
{
|
||||
_shouldTrim = (YES == aFlag) ? YES : NO;
|
||||
}
|
||||
|
||||
- (void) setUser: (NSString*)s
|
||||
{
|
||||
if ([s isEqual: _client] == NO)
|
||||
|
|
Loading…
Reference in a new issue