 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Michael Fullerton Guest
|
Posted: Thu May 03, 2007 11:05 pm Post subject: Backslash problem with storing text file in MS SQL Server Te |
|
|
I want to store an ini file in a Text field of MS SQL Server. However
if a line in the ini file end in a \ MS SQL Server seems to regard
that as an escape character and ignores the following carriage return.
So the ini file becomes corrupted when you retrieve it and save to a
text file. e.g.
[Options]
ReportsPath=e:\reports\
Rounding=1
becomes
[Options]
ReportsPath=e:\reports\Rounding=1
Anyone know how to prevent MS SQL Server from regarding the \ as an
escape char?
___
Free Project Time Tracker for Delphi Developers
http://www.cybermatrix.com/pcdelphi.html |
|
| Back to top |
|
 |
Dmitry Arefiev Guest
|
Posted: Fri May 04, 2007 8:09 am Post subject: Re: Backslash problem with storing text file in MS SQL Serve |
|
|
Hello
1) Which data access components do you use ?
2) How you sends data to the DB ? Do you use parameterized
SQL command or SQL command with constants ?
Regards,
Dmitry
--
Dmitry Arefiev - www.da-soft.com
AnyDAC - Oracle, MySQL, MSSQL, MSAccess, IBM DB2, Sybase
ASA, DbExpress, ODBC freeware data access framework
ThinDAC - mtier data access engine |
|
| Back to top |
|
 |
Michael Fullerton Guest
|
Posted: Fri May 04, 2007 11:14 pm Post subject: Re: Backslash problem with storing text file in MS SQL Serve |
|
|
"Dmitry Arefiev" <darefiev@da-soft.com> wrote:
| Quote: | Hello
1) Which data access components do you use ?
|
ZEOS 6.6.0 but note that I have no problems with other database
servers.
| Quote: | 2) How you sends data to the DB ? Do you use parameterized
SQL command or SQL command with constants ?
|
constants I guess, like:
SQL.Text:= 'INSERT INTO Config ('+sFile+')
VALUES('+QuotedStr(sValue)+')';
where sValue will be the entire ini file contents. |
|
| Back to top |
|
 |
Dmitry Arefiev Guest
|
Posted: Sat May 05, 2007 1:19 am Post subject: Re: Backslash problem with storing text file in MS SQL Serve |
|
|
| Quote: | constants I guess, like:
|
In your case, you must use parameters.
--
Dmitry Arefiev - www.da-soft.com
AnyDAC - Oracle, MySQL, MSSQL, MSAccess, IBM DB2, Sybase
ASA, DbExpress, ODBC freeware data access framework
ThinDAC - mtier data access engine |
|
| Back to top |
|
 |
Michael Fullerton Guest
|
Posted: Sat May 05, 2007 2:31 am Post subject: Re: Backslash problem with storing text file in MS SQL Serve |
|
|
"Dmitry Arefiev" <darefiev@da-soft.com> wrote:
| Quote: | constants I guess, like:
In your case, you must use parameters.
|
Thanks Dmitry but why? I have the exact same problem when using
parameters. |
|
| Back to top |
|
 |
Michael Fullerton Guest
|
Posted: Sun May 06, 2007 11:52 pm Post subject: Re: Backslash problem with storing text file in MS SQL Serve |
|
|
"Dmitry Arefiev" <darefiev@da-soft.com> wrote:
| Quote: | I have the exact same problem when using
parameters.
I have checked latest ZeosLib sources and I see in following lines:
//This one is to avoid a bug in dblib interface as it drops a single
backslash before line end
if FPlainDriver.GetProtocol = 'mssql' then
SQL := StringReplace(Sql, '\'#13, '\\'#13, [rfReplaceAll]);
So, probably, you should upgrade. Or do the same in your application code.
|
Upgrading to 6.6.1 does not resolve the problem. I tried adding this
code to my app but all it does is put an extra \ at the end of the
problem line. The following carriage return is still stripped. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|