BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Backslash problem with storing text file in MS SQL Server Te

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers)
View previous topic :: View next topic  
Author Message
Michael Fullerton
Guest





PostPosted: Thu May 03, 2007 11:05 pm    Post subject: Backslash problem with storing text file in MS SQL Server Te Reply with quote



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





PostPosted: Fri May 04, 2007 8:09 am    Post subject: Re: Backslash problem with storing text file in MS SQL Serve Reply with quote



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





PostPosted: Fri May 04, 2007 11:14 pm    Post subject: Re: Backslash problem with storing text file in MS SQL Serve Reply with quote



"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





PostPosted: Sat May 05, 2007 1:19 am    Post subject: Re: Backslash problem with storing text file in MS SQL Serve Reply with quote

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





PostPosted: Sat May 05, 2007 2:31 am    Post subject: Re: Backslash problem with storing text file in MS SQL Serve Reply with quote

"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





PostPosted: Sun May 06, 2007 11:52 pm    Post subject: Re: Backslash problem with storing text file in MS SQL Serve Reply with quote

"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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.