Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

AdsQuery.SQL.Text

4 posts in Delphi Last posting was on 2003-09-05 10:00:49.0Z
Maikel v/d Lisdonk Posted on 2003-09-04 09:03:17.0Z
From: "Maikel v/d Lisdonk" <m.v.d.lisdonk@cocosoft.nl>
Newsgroups: Advantage.Delphi
Subject: AdsQuery.SQL.Text
Date: Thu, 4 Sep 2003 11:03:17 +0200
Lines: 95
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6700
X-MIMEOLE: Produced By Microsoft MimeOLE V5.00.2919.6700
NNTP-Posting-Host: 194.109.97.234
Message-ID: <3f57002b@solutions.advantagedatabase.com>
X-Trace: 4 Sep 2003 03:04:43 -0700, 194.109.97.234
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!194.109.97.234
Xref: solutions.advantagedatabase.com Advantage.Delphi:13867
Article PK: 1107304

Hi,

Is the following a known problem ?

When I assign a query longer then 255 characters to SQL.Text , I get an
access violation when opening the query.
However , when I put enough CRLF in the original query (so every line is
shorter then 255) and do the same thing , everything is allright.

Another however : I cannot simulate this in the dataarchitect and in a
simple application that only opens my query.

Ok , a logical conclusion would be that's its a bug in my application
instead of something with TAdsQuery.SQL.Text. This would certainly make
sense if the problem wasn't solved with the CRLF's.

Because you probably want to see some code , see below ... It's the code
without the CRLF stuff..

Maikel v/d Lisdonk
Cocosoft R&D


const // Defined in the interface of the unit
NEWTRANSACTIONSSQL =
'SELECT filiaalean , transactieno , kassano , vervallengebruikerno ,
gebruikerno , '+
' datum , tijd , klantno , kaartnr , kortingstype , korting ,
redenkortingno , '+
' info , ontvangenbedrag , ontvangenvalutano , wisselgeldvalutano , '+
' vervallen , transactietotaalbedrag , kortingtotaalbedrag , '+
' factuurno , factuurstatus , retourbedragalstegoedbon FROM Transactie
';


//
// The following method is used to construct a query and return it as a
string
//
function TDatabaseModule.GetNewTransactionSQL: string;
var
AdsTempSQL : TAdsQuery;
First : boolean;
begin

Result := '';
AdsTempSQL := SQLPool.OpenSQL(SELECT_LAST_TRANSACTIONNOS, [], []);
try
if not (AdsTempSQL.Bof and AdsTempSQl.Eof) then
begin
First := True;
while (not AdsTempSQL.Eof) do
begin
if First then
begin
Result := NEWTRANSACTIONSSQL + 'WHERE (VoorraadVerzonden = False
AND KassaNO = '+
IntToStr(AdsTempSQL.FieldByName('KASSANO').AsInteger)+'
AND TransactieNO <= '+

IntToStr(AdsTempSQL.FieldByName('LastTransaction').AsInteger)+')';
First := False;
end else
begin
Result := Result + ' or (VoorraadVerzonden = False AND KassaNO =
'+
IntToStr(AdsTempSQL.FieldByName('KASSANO').AsInteger)+'
AND TransactieNO <= '+

IntToStr(AdsTempSQL.FieldByName('LastTransaction').AsInteger)+')';
end;
AdsTempSQL.Next;
end;
end;
finally
SQLPool.Release(AdsTempSQL);
end;
end;

The thing that raises an AV :

NewTransactionSQLString := Trim(GetNewTransactionSQL);
if NewTransactionSQLString <> '' then
begin
AdsTransactionSQL := SQLPool.OpenSQL(NewTransactionSQLString ,
[],[]); // Here an exception is raised

SQLPool is a component which returns a new query component out of a
pre-created pool. The AV is also raised if I use pre-created AdsQuery
component.
BTW , all query components (also those returned by SQLPool) are linked to a
AdsConnnection component.


Lance Schmidt Posted on 2003-09-04 15:33:15.0Z
From: "Lance Schmidt" <LanceSc@ExtendSys.com>
Newsgroups: Advantage.Delphi
References: <3f57002b@solutions.advantagedatabase.com>
Subject: Re: AdsQuery.SQL.Text
Date: Thu, 4 Sep 2003 09:33:15 -0600
Lines: 117
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 198.60.232.39
Message-ID: <3f575b39@solutions.advantagedatabase.com>
X-Trace: 4 Sep 2003 09:33:13 -0700, 198.60.232.39
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!198.60.232.39
Xref: solutions.advantagedatabase.com Advantage.Delphi:13874
Article PK: 1107309

Hello Maikel,

Make sure that you have set the Delphi compiler option for using huge
strings. If you don't have that option set then Delphi's strings are
limited to 255 characters. This was a very frustrating issue the first time
I ran into to it in Delphi.

Best Regards,

Lance Schmidt
Advantage R&D
LanceSc@ExtendSys.com

"Maikel v/d Lisdonk" <m.v.d.lisdonk@cocosoft.nl> wrote in message
news:3f57002b@solutions.advantagedatabase.com...
> Hi,
>
> Is the following a known problem ?
>
> When I assign a query longer then 255 characters to SQL.Text , I get an
> access violation when opening the query.
> However , when I put enough CRLF in the original query (so every line is
> shorter then 255) and do the same thing , everything is allright.
>
> Another however : I cannot simulate this in the dataarchitect and in a
> simple application that only opens my query.
>
> Ok , a logical conclusion would be that's its a bug in my application
> instead of something with TAdsQuery.SQL.Text. This would certainly make
> sense if the problem wasn't solved with the CRLF's.
>
> Because you probably want to see some code , see below ... It's the code
> without the CRLF stuff..
>
> Maikel v/d Lisdonk
> Cocosoft R&D
>
>
> const // Defined in the interface of the unit
> NEWTRANSACTIONSSQL =
> 'SELECT filiaalean , transactieno , kassano , vervallengebruikerno ,
> gebruikerno , '+
> ' datum , tijd , klantno , kaartnr , kortingstype , korting ,
> redenkortingno , '+
> ' info , ontvangenbedrag , ontvangenvalutano , wisselgeldvalutano ,
'+
> ' vervallen , transactietotaalbedrag , kortingtotaalbedrag , '+
> ' factuurno , factuurstatus , retourbedragalstegoedbon FROM
Transactie
> ';
>
>
> //
> // The following method is used to construct a query and return it as a
> string
> //
> function TDatabaseModule.GetNewTransactionSQL: string;
> var
> AdsTempSQL : TAdsQuery;
> First : boolean;
> begin
>
> Result := '';
> AdsTempSQL := SQLPool.OpenSQL(SELECT_LAST_TRANSACTIONNOS, [], []);
> try
> if not (AdsTempSQL.Bof and AdsTempSQl.Eof) then
> begin
> First := True;
> while (not AdsTempSQL.Eof) do
> begin
> if First then
> begin
> Result := NEWTRANSACTIONSSQL + 'WHERE (VoorraadVerzonden = False
> AND KassaNO = '+
>
IntToStr(AdsTempSQL.FieldByName('KASSANO').AsInteger)+'
> AND TransactieNO <= '+
>
> IntToStr(AdsTempSQL.FieldByName('LastTransaction').AsInteger)+')';
> First := False;
> end else
> begin
> Result := Result + ' or (VoorraadVerzonden = False AND KassaNO =
> '+
>
IntToStr(AdsTempSQL.FieldByName('KASSANO').AsInteger)+'
> AND TransactieNO <= '+
>
> IntToStr(AdsTempSQL.FieldByName('LastTransaction').AsInteger)+')';
> end;
> AdsTempSQL.Next;
> end;
> end;
> finally
> SQLPool.Release(AdsTempSQL);
> end;
> end;
>
> The thing that raises an AV :
>
> NewTransactionSQLString := Trim(GetNewTransactionSQL);
> if NewTransactionSQLString <> '' then
> begin
> AdsTransactionSQL := SQLPool.OpenSQL(NewTransactionSQLString ,
> [],[]); // Here an exception is raised
>
> SQLPool is a component which returns a new query component out of a
> pre-created pool. The AV is also raised if I use pre-created AdsQuery
> component.
> BTW , all query components (also those returned by SQLPool) are linked to
a
> AdsConnnection component.
>
>
>


Maikel v/d Lisdonk Posted on 2003-09-05 09:16:07.0Z
From: "Maikel v/d Lisdonk" <m.v.d.lisdonk@cocosoft.nl>
Newsgroups: Advantage.Delphi
References: <3f57002b@solutions.advantagedatabase.com> <3f575b39@solutions.advantagedatabase.com>
Subject: Re: AdsQuery.SQL.Text
Date: Fri, 5 Sep 2003 11:16:07 +0200
Lines: 32
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6700
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700
NNTP-Posting-Host: 194.109.97.234
Message-ID: <3f5854d6@solutions.advantagedatabase.com>
X-Trace: 5 Sep 2003 03:18:14 -0700, 194.109.97.234
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!194.109.97.234
Xref: solutions.advantagedatabase.com Advantage.Delphi:13879
Article PK: 1107315

Hi,

Huge strings was already on. I think this is the default setting in delphi ,
but I'm not sure.
I also checked for a {$H-} in my appplication, but it's not there.

btw, the project is build in Delphi5.

Maikel


"Lance Schmidt" <LanceSc@ExtendSys.com> schreef in bericht
news:3f575b39@solutions.advantagedatabase.com...

> Hello Maikel,
>
> Make sure that you have set the Delphi compiler option for using huge
> strings. If you don't have that option set then Delphi's strings are
> limited to 255 characters. This was a very frustrating issue the first
time
> I ran into to it in Delphi.
>
> Best Regards,
>
> Lance Schmidt
> Advantage R&D
> LanceSc@ExtendSys.com
>
> "Maikel v/d Lisdonk" <m.v.d.lisdonk@cocosoft.nl> wrote in message
> news:3f57002b@solutions.advantagedatabase.com...


Udo Nesshoever Posted on 2003-09-05 10:00:49.0Z
Message-ID: <bj9ttk.99.2@nesshoever.net>
From: "Udo Nesshoever" <newsgroup.reply.4@gmx.net>
Newsgroups: Advantage.Delphi
Subject: Re: AdsQuery.SQL.Text
Date: Fri, 05 Sep 2003 12:00:49 +0200
References: <3f57002b@solutions.advantagedatabase.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 18
NNTP-Posting-Host: 62.225.210.25
X-Trace: 5 Sep 2003 04:05:03 -0700, 62.225.210.25
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!62.225.210.25
Xref: solutions.advantagedatabase.com Advantage.Delphi:13880
Article PK: 1107319


On Thu, 4 Sep 2003 11:03:17 +0200 Maikel v/d Lisdonk wrote:

>The thing that raises an AV :
>
> NewTransactionSQLString := Trim(GetNewTransactionSQL);
> if NewTransactionSQLString <> '' then
> begin
> AdsTransactionSQL := SQLPool.OpenSQL(NewTransactionSQLString ,
>[],[]); // Here an exception is raised
>
>SQLPool is a component which returns a new query component out of a
>pre-created pool. The AV is also raised if I use pre-created AdsQuery
>component.

Show us the code of the OpenSQL method.

Cheers,
Udo