Skip to content

Unicode support on Linux #247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions Builds/Gcc.lin/makefile.linux
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ LIST_ODBCJDBCOBJ = $(addprefix $(BUILDDIR)/, $(ODBCJDBCSRC:.cpp=.o))
LIST_ODBCJDBCSETUPSRC = $(addprefix $(ODBCJDBCDIR)/, $(ODBCJDBCSETUPSRC_LINUX))
LIST_ODBCJDBCSETUPOBJ = $(addprefix $(BUILDDIR)/, $(ODBCJDBCSETUPSRC_LINUX:.cpp=.o))
#
COMPFLAGS = -w -D_REENTRANT -D_PTHREADS -DEXTERNAL -D$(ODBCMANAGER) $(INCLUDEDIR) -I$(FBINCDIR)
COMPFLAGS = -w -D_REENTRANT -D_PTHREADS -DEXTERNAL -D$(ODBCMANAGER) $(INCLUDEDIR) -I$(FBINCDIR) --std=c++17 $(CXXFLAGS) -MMD

ifeq ($(ARCH),x86_64)
COMPFLAGS += -fPIC -m64
LINKFLAGS= -shared -m64
LINKFLAGS= -shared -m64 -Wl,--no-undefined
else ifeq ($(ARCH),aarch64)
COMPFLAGS += -fPIC
LINKFLAGS= -shared
Expand All @@ -104,7 +104,7 @@ COMPFLAGS += -m32
LINKFLAGS= -shared -m32
endif
#
#LINKFLAGS = -rdynamic -export-dynamic -shared
#LINKFLAGS = -rdynamic -export-dynamic -shared

EXTLIBS = $(EXTLIBDIR) -lcrypt -ldl

Expand Down Expand Up @@ -140,7 +140,7 @@ ODBCJDBCSETUPLIB= $(ODBCJDBCSETUPDLL:.so=.a)
all : createdirs $(ISCDBCDLL) $(ODBCJDBCDLL) $(ODBCJDBCSETUPDLL)
#
# If required, print out the version info
getVersion :
getVersion :
$(warning MAJOR_VERSION is $(MAJOR_VERSION) )
$(warning MINOR_VERSION is $(MINOR_VERSION) )
$(warning REVISION is $(REVISION) )
Expand Down Expand Up @@ -173,39 +173,41 @@ $(ODBCJDBCSETUPDLL) : $(LIST_ODBCJDBCSETUPOBJ)
# ar crs $(ODBCJDBCSETUPLIB) $(LIST_ODBCJDBCSETUPOBJ)
# $(GCC) $(LINKFLAGS) $(LIST_ODBCJDBCSETUPOBJ) $(EXTLIBS) -o $(ODBCJDBCSETUPDLL)
#
$(ODBCJDBCDLL) : $(ISCDBCDLL) $(ODBCJDBCSETUPDLL) $(LIST_ODBCJDBCOBJ)
ar crs $(ODBCJDBCLIB) $(LIST_ISCDBCOBJ)
ar crs $(ODBCJDBCLIB) $(LIST_ODBCJDBCOBJ)
ar crs $(ODBCJDBCLIB) $(LIST_ODBCJDBCSETUPOBJ)
$(ODBCJDBCDLL) : $(LIST_ISCDBCOBJ) $(LIST_ODBCJDBCSETUPOBJ) $(LIST_ODBCJDBCOBJ)
# ar crs $(ODBCJDBCLIB) $(LIST_ISCDBCOBJ)
# ar crs $(ODBCJDBCLIB) $(LIST_ODBCJDBCOBJ)
# ar crs $(ODBCJDBCLIB) $(LIST_ODBCJDBCSETUPOBJ)
$(GCC) $(LINKFLAGS) $(LIST_ISCDBCOBJ) $(LIST_ODBCJDBCOBJ) $(LIST_ODBCJDBCSETUPOBJ) $(EXTLIBS) $(LIBODBCINST) -o $(ODBCJDBCDLL)
#
postbuild : $(ISCDBCDLL) $(ODBCJDBCDLL) $(ODBCJDBCSETUPDLL)
@-strip -s $(ISCDBCDLL) $(ODBCJDBCDLL) $(ODBCJDBCSETUPDLL)
@-tar -cf OdbcJdbc_Snapshot.tar $(ISCDBCDLL) $(ODBCJDBCDLL) $(ODBCJDBCSETUPDLL)
@-gzip -9 -S .gz OdbcJdbc_Snapshot.tar
#
install :
install :
cp $(ODBCJDBCDLL) $(UNIXODBCDIR)/$(ODBCJDBC).$(LIB_VERSION)
ln -s $(UNIXODBCDIR)/$(ODBCJDBC).$(LIB_VERSION) $(UNIXODBCDIR)/$(ODBCJDBC)
ln -s $(UNIXODBCDIR)/$(ODBCJDBC).$(LIB_VERSION) $(UNIXODBCDIR)/$(ODBCJDBC).$(MAJOR_VERSION)
#
uninstall :
@-rm -f $(UNIXODBCDIR)/$(ODBCJDBC)*.*
uninstall :
@-rm -f $(UNIXODBCDIR)/$(ODBCJDBC)*.*
#
package :
-strip -s $(ISCDBCDLL) $(ODBCJDBCDLL) $(ODBCJDBCSETUPDLL)
-rm $(PACKAGE_NAME).gz
chmod 740 ../../Install/Linux/install.sh
tar -C $(TARGETDIR) -cvf OdbcJdbcLibs.tar $(ISCDBC) $(ODBCJDBC) $(ODBCJDBCSETUP)
tar -C ../../Install/HtmlHelp --exclude=CVS -cvf OdbcJdbcDocs.tar html/
tar -C ../../Install/HtmlHelp --exclude=CVS -cvf OdbcJdbcDocs.tar html/
tar -C ../../Install -uf OdbcJdbcDocs.tar ReleaseNotes_v2.0.html
cat $(DRVTMPL) | grep -v "^Driver.*=.*" >$(DRVTMPL).tmp && echo "Driver = $(UNIXODBCDIR)/$(ODBCJDBC)" >>$(DRVTMPL).tmp && mv $(DRVTMPL).tmp $(DRVTMPL)
tar -C ../../Install/Linux -cf $(PACKAGE_NAME) install.sh readme.txt DriverTemplate.ini FirebirdDSNTemplate.ini InterBaseDSNTemplate.ini
tar -uf $(PACKAGE_NAME) OdbcJdbcLibs.tar OdbcJdbcDocs.tar
rm OdbcJdbcLibs.tar OdbcJdbcDocs.tar
gzip -9 -S .gz $(PACKAGE_NAME)
gzip -9 -S .gz $(PACKAGE_NAME)
#

-include $(BUILDDIR)/*.d

#
# End
#
25 changes: 9 additions & 16 deletions DescRecord.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*
*
* The contents of this file are subject to the Initial
* Developer's Public License Version 1.0 (the "License");
* you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* The contents of this file are subject to the Initial
* Developer's Public License Version 1.0 (the "License");
* you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
* http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
*
* Software distributed under the License is distributed on
* an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
* express or implied. See the License for the specific
* Software distributed under the License is distributed on
* an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
* express or implied. See the License for the specific
* language governing rights and limitations under the License.
*
*
Expand Down Expand Up @@ -78,13 +78,6 @@ DescRecord::DescRecord()
unNamed = SQL_NAMED;
dataPtr = NULL;
fnConv = NULL;
#ifdef _WINDOWS
WcsToMbs = _WcsToMbs;
MbsToWcs = _MbsToWcs;
#else
WcsToMbs = wcstombs;
MbsToWcs = mbstowcs;
#endif
}

DescRecord::~DescRecord()
Expand Down Expand Up @@ -173,7 +166,7 @@ bool DescRecord::operator =(DescRecord *rec)
unSigned = rec->unSigned;
updaTable = rec->updaTable;
indicatorPtr = rec->indicatorPtr;

if ( indicatorPtr && !octetLengthPtr )
octetLengthPtr = indicatorPtr;

Expand Down
26 changes: 12 additions & 14 deletions DescRecord.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*
*
* The contents of this file are subject to the Initial
* Developer's Public License Version 1.0 (the "License");
* you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* The contents of this file are subject to the Initial
* Developer's Public License Version 1.0 (the "License");
* you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
* http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
*
* Software distributed under the License is distributed on
* an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
* express or implied. See the License for the specific
* Software distributed under the License is distributed on
* an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
* express or implied. See the License for the specific
* language governing rights and limitations under the License.
*
*
Expand Down Expand Up @@ -45,10 +45,10 @@ class DescRecord
void freeLocalDataPtr();
void beginBlobDataTransfer();
void putBlobSegmentData (int length, const void *bytes);
void endBlobDataTransfer();
void endBlobDataTransfer();

int getBufferLength()
{
{
return ( octetLength + 1 ) * headSqlVarPtr->getSqlMultiple();
}

Expand All @@ -58,7 +58,7 @@ class DescRecord
bool isIndicatorSqlDa;
bool isZeroColumn;
bool isLocalDataPtr; // use sqlPutData for set data_at_exec
char *localDataPtr;
char *localDataPtr;
SQLSMALLINT callType; // use sqlGetData

int isBlobOrArray;
Expand All @@ -69,7 +69,7 @@ class DescRecord
int currentFetched;
bool startedReturnSQLData;
HeadSqlVar *headSqlVarPtr;
Blob *dataBlobPtr; // for blob or array
Blob *dataBlobPtr; // for blob or array

SQLSMALLINT type;
SQLSMALLINT datetimeIntervalCode;
Expand Down Expand Up @@ -104,8 +104,6 @@ class DescRecord
SQLLEN *indicatorPtr;
SQLSMALLINT unNamed;
SQLPOINTER dataPtr;
WCSTOMBS WcsToMbs;
MBSTOWCS MbsToWcs;

public:

Expand Down
40 changes: 23 additions & 17 deletions IscDbc/Attachment.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*
*
* The contents of this file are subject to the Initial
* Developer's Public License Version 1.0 (the "License");
* you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* The contents of this file are subject to the Initial
* Developer's Public License Version 1.0 (the "License");
* you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
* http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
*
* Software distributed under the License is distributed on
* an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
* express or implied. See the License for the specific
* Software distributed under the License is distributed on
* an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
* express or implied. See the License for the specific
* language governing rights and limitations under the License.
*
*
Expand Down Expand Up @@ -37,17 +37,18 @@
#include "SQLError.h"
#include "Parameters.h"
#include "IscConnection.h"
#include "MultibyteConvert.h"

static char databaseInfoItems [] = {
static char databaseInfoItems [] = {
isc_info_db_id,
isc_info_db_sql_dialect,
isc_info_base_level,
isc_info_ods_version,
isc_info_firebird_version,
isc_info_version,
isc_info_version,
isc_info_page_size,
isc_info_user_names,
isc_info_end
isc_info_end
};

using namespace Firebird;
Expand Down Expand Up @@ -167,7 +168,7 @@ void Attachment::createDatabase(const char *dbName, Properties *properties)
p += sprintf( p, "DEFAULT CHARACTER SET %s ", charset );

*p = '\0';

ThrowStatusWrapper status( GDS->_status );
try
{
Expand Down Expand Up @@ -259,6 +260,11 @@ void Attachment::openDatabase(const char *dbName, Properties *properties)
charsetCode = findCharsetsCode( charset );
}

if (charsetCode == Charset::Code::Utf8)
{
dpb->insertTag(&throw_status, isc_dpb_utf8_filename);
}

const char *property = properties->findValue ("databaseAccess", NULL);

if ( property )
Expand Down Expand Up @@ -313,7 +319,7 @@ void Attachment::openDatabase(const char *dbName, Properties *properties)
else
{
JString text;

switch ( statusVector [7] )
{
case isc_io_access_err:
Expand Down Expand Up @@ -376,7 +382,7 @@ void Attachment::openDatabase(const char *dbName, Properties *properties)
case isc_info_db_sql_dialect:
databaseDialect = GDS->_vax_integer (p, length);
break;

case isc_info_base_level:
serverBaseLevel = GDS->_vax_integer (p, length);
break;
Expand All @@ -396,7 +402,7 @@ void Attachment::openDatabase(const char *dbName, Properties *properties)
char * start = p + 2;
char * beg = start;
char * end = beg + p [1];

while ( beg < end )
{
if ( *beg >= '0' && *beg <= '9' )
Expand Down Expand Up @@ -437,7 +443,7 @@ void Attachment::openDatabase(const char *dbName, Properties *properties)
char * beg = start;
char * end = beg + p [1];
char * tmp = NULL;

while ( beg < end )
{
if ( *beg >= '0' && *beg <= '9' )
Expand Down Expand Up @@ -488,7 +494,7 @@ void Attachment::openDatabase(const char *dbName, Properties *properties)
p += length;
}
}

if ( dialect && *dialect == '1')
databaseDialect = SQL_DIALECT_V5;
else
Expand Down
18 changes: 9 additions & 9 deletions IscDbc/BinaryBlob.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*
*
* The contents of this file are subject to the Initial
* Developer's Public License Version 1.0 (the "License");
* you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* The contents of this file are subject to the Initial
* Developer's Public License Version 1.0 (the "License");
* you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
* http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
*
* Software distributed under the License is distributed on
* an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
* express or implied. See the License for the specific
* Software distributed under the License is distributed on
* an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
* express or implied. See the License for the specific
* language governing rights and limitations under the License.
*
*
Expand All @@ -22,7 +22,7 @@
*
* 2002-05-21 BinaryBlob.cpp
* Change release() to test useCount <=0
*
*
* 2002-05-20 BinaryBlob.cpp
* Contributed by Robert Milharcic
* o Start with useCount of 0
Expand Down
19 changes: 10 additions & 9 deletions IscDbc/BinaryBlob.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*
*
* The contents of this file are subject to the Initial
* Developer's Public License Version 1.0 (the "License");
* you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* The contents of this file are subject to the Initial
* Developer's Public License Version 1.0 (the "License");
* you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
* http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
*
* Software distributed under the License is distributed on
* an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
* express or implied. See the License for the specific
* Software distributed under the License is distributed on
* an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
* express or implied. See the License for the specific
* language governing rights and limitations under the License.
*
*
Expand Down Expand Up @@ -37,7 +37,7 @@ namespace IscDbcLibrary {

class Database;

class BinaryBlob : public Blob, public Stream
class BinaryBlob : public Blob, public Stream
{
public:
void putSegment (Blob *blob);
Expand Down Expand Up @@ -81,6 +81,7 @@ class BinaryBlob : public Blob, public Stream
int sectionId;
int recordNumber;
bool populated;
bool directBlob;
int directLength;
};

Expand Down
Loading