Browse Source

sqldb: odbc: use ANSI codepage for connection as default

git-svn-id: trunk@43700 -
ondrej 5 years ago
parent
commit
c09c8ed845
1 changed files with 8 additions and 0 deletions
  1. 8 0
      packages/fcl-db/src/sqldb/odbc/odbcconn.pas

+ 8 - 0
packages/fcl-db/src/sqldb/odbc/odbcconn.pas

@@ -72,6 +72,7 @@ type
     procedure FreeParamBuffers(ODBCCursor:TODBCCursor);
   protected
     // Overrides from TSQLConnection
+    function GetConnectionCharSet: string; override;
     function GetHandle:pointer; override;
     // - Connect/disconnect
     procedure DoInternalConnect; override;
@@ -616,6 +617,13 @@ begin
   SetLength(ODBCCursor.FParamBuf,0);
 end;
 
+function TODBCConnection.GetConnectionCharSet: string;
+begin
+  Result := inherited GetConnectionCharSet;
+  if Result='' then
+    Result := TEncoding.ANSI.EncodingName; // by default, ODBC talks in ANSI, which can be different from CP_ACP (DefaultSystemCodePage)
+end;
+
 function TODBCConnection.GetHandle: pointer;
 begin
   // I'm not sure whether this is correct; perhaps we should return nil