Giter VIP home page Giter VIP logo

txquery's Introduction

Introduction

TxQuery is created and owned by Alfonso Moreno. He has stopped the development of TxQuery for years. However, there are many Delphi developers still using TxQuery. A barrier for TxQuery migrating to Delphi 2009 and 2010 is the introduction of Unicode.

I contact Alfonso Moreno on Nov 17, 2009 to ask if he may consider make TxQuery open source and let this great product continue enhanced by the Delphi community. He finally agree and I wish to say big "Thank You" for his contribution.

I have attempted to patch the source code to make it compile and work with Delphi Unicode. Test cases has been created to make sure it works as expected. I know there are other cases that I didn't cover yet, just alert me promptly. You are also welcome to join the maintenance and enhancement for this project.

TxQuery component is a TDataSet descendant component that can be used to query one or more TDataSet descendant components using SQL statements. It is implemented in Delphi 100% source code, no DLL required, because it implements its own SQL syntax parser and SQL engine.

It can be very useful for TDataSet descendants components (including TClientDataSet) that do not use the BDE and that do not implement the SQL language or to mix tables types (dbase, paradox, access).

Source Code

As mention, TxQuery is now open source. The license of the software is Mozilla Public License 1.1

Download the latest source code from the Alfonso Moreno from TxQuery Version 1.86.2.7z.

I patched the source code to make it work for Delphi 2007, 2009, 2010, XE, XE2 and XE3. You may always check out from SVN repository: https://code.google.com/p/txquery/

Support

Post all questions in TxQuery group. I will try my best to answer your question.

Join TxQuery Development

Developers are always welcome to join the TxQuery development and enhancement from GitHub Repository.

txquery's People

Contributors

ccy avatar

Watchers

James Cloos avatar

txquery's Issues

LargeInt data type not supported in parameters

I have a table with dtLargeInt field behind and if I use update sql it throws 
error. I added ftLargeInt in this procedure and now it works.

Function TSqlAnalizer.ReplaceParams(const SQL: string): String;
var
  List: TParams;
  I, DblQuote, Quote: Integer;
  ParamValue: string;
  Param: TParam;
begin
  List := TParams.Create(Nil);
  try
    Result:= List.ParseSQL(SQL, True); // Result:= StrPas(PChar(List.ParseSQL(SQL, True))); {patched by ccy}
    for I:= 0 to List.Count - 1 do
    begin
      Param:= xQuery.ParamByName(List[I].Name);
      if Param <> Nil then
      begin
        case Param.DataType of
          ftBlob:
            ParamValue := #34 + StringToHex(Param.AsString) + #34;
          ftString, ftWideString: { patched by ccy }
            begin
              ParamValue:= Param.Asstring;
              DblQuote:= AnsiPos(#34, ParamValue);
              Quote:= AnsiPos(#39, ParamValue);
              if (Quote > 0) and (DblQuote = 0) then
                ParamValue:= #34 + ParamValue + #34
              else if (DblQuote >= 0) and (Quote = 0) then
                ParamValue:= #39 + ParamValue + #39
              else
                ParamValue:= #39 + ParamValue + #39;
            end;
          ftFloat, ftCurrency, ftBCD, ftAutoInc, ftSmallInt, ftInteger, ftWord, ftFmtBcd, ftLargeInt : { patched by ccy }
            ParamValue:= Param.Asstring;
          ftDate, ftTime, ftDateTime:
            ParamValue:= FloatToStr(Param.AsFloat);
          ftBoolean:
            ParamValue:= xqbase.NBoolean[Param.AsBoolean];
        end;
        Result:= StringReplace(Result, '?', ParamValue, [rfIgnoreCase]);
      end;
    end;
  finally
    List.free;
  end;
end;

Original issue reported on code.google.com by [email protected] on 27 Dec 2012 at 9:23

SUM,AVG,MAX not work

What steps will reproduce the problem?
1. Query SQL: SELECT SUM(animals.size) FROM animals
2. Error Syntax: "(Result number of sum): syntax error at line: 1, Column:8 
token: ,."
3. SUM,AVG,MAX not work

What is the expected output? What do you see instead?
Any Thing

What version of the product are you using? On what operating system?
Windows Delphi XE4

Please provide any additional information below.
SUM,AVG,MAX not work - MIN work in my cas with negative result(value -33060 is 
correct result)

Original issue reported on code.google.com by [email protected] on 13 Jun 2013 at 5:22

Attachments:

Change dfm to text source

1. pls, convert all *.dfm files in project:
$(DELPHI)\bin\convert.exe -t -i demo\*.dfm
$(DELPHI)\bin\convert.exe -t -i QBuilder\*.dfm
$(DELPHI)\bin\convert.exe -t -i source\*.dfm

for svn visual diff 

2. move all *.dpk from source directory to Packages
- add designtime dcl*.dpk package and redesign runtime xqd*.dpk 

3. fix include or add *.res in distribution package:
  QExprYacc.pas -> {$R Qexpryacc.res}
  xqYacc.pas -> {$R xqyacc.res}

Original issue reported on code.google.com by alto%[email protected] on 5 Dec 2009 at 10:04

Delphi 7

Please tell me what version of txquery can I use for Delphi 7?

Original issue reported on code.google.com by [email protected] on 13 Nov 2014 at 8:02

Not In Can Not Work, what can i do?

What steps will reproduce the problem?
1.  Same Txt Data, one dataset read 3 row, the other dataset read 5 rows
2. use SQL like: 'SELECT * FROM New_dangjuDataSet WHERE StartGanhaoEndGanHao 
not in (SELECT StartGanhaoEndGanHao FROM Old_dangjuDataSet)' ;
3. the more 2 rows can not find

What version of the product are you using? On what operating system?
delphi 2007 + 2.1;

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 23 Oct 2011 at 6:33

Compiling latest version missing .res files

What steps will reproduce the problem?
1. Install latest version (prior version did not exist for me)
2. Open .dpk, compile
3. 2 errors  File not found xqyacc.res  and Qexpryacc.res

I am using Delphi 2006  (BDS 2006)

I will try downloading older source files to see if the .res files are there.


Original issue reported on code.google.com by [email protected] on 19 Apr 2012 at 3:19

First attempt to use TXQuery failed dismally what is wrong?

using latest version in svn http://txquery.googlecode.com/svn/trunk/ 
txquery-read-only

Did not recognize SELECT token, as far as I remember that was the first thing 
you do in SQL. What is happening?

  with slSQL do
    begin
       add('SELECT *');
       add('FROM PB');
       add('LEFT OUTER JOIN PL');
       add('ON( PB.TERMID  = PL.CD_WS )');
       add('AND( PB.SEQNO  = PL.AI_SRC_FILE )');
    end;
      xqry       := TXQuery.Create(nil);
      xdi        := xqry.DataSets.Add;
      xdi.Alias  := 'PB';
      xdi.DataSet := memPOStBOS;
      xdi        := xqry.DataSets.Add;
      xdi.Alias  := 'PL';
      xdi.DataSet := memPOSLOG;
      xqry.SQL.Assign(slSQL);
      xqry.Open;
      { at this point exception is created

ExqueryError: syntax error at line : 1, Column 0, token SELECT

}

      xqry.Close;
      FreeAndNil(xqry);

Original issue reported on code.google.com by [email protected] on 24 Jul 2012 at 7:06

Null value in source field causes incorrect & unexpected results on rare occasions

Hi,

I have been trying to track down this problem for weeks, and believe I finally 
have a way of replicating this issue for demonstration.

I have been experiencing on the vary rare occasion results from TxQuery that 
have not grouped / combined matching records together, where the result gives a 
separate record for every record in the source dataset.

It appears as though the problem has to do with null values in one of the 
fields. This problem does not happen with all result sets, and strangely enough 
- if I add an additional record to the existing result set, the problem 
dissapears (hence it being very difficult to replicate).

However, I have now been able to create a demo application that will show both 
the problem, as well as what the expected result should be (attached).

Steps to replicate:

1) Extract the attached demo project, along with the table (xquery.dbf) to a 
destination

2) Open the project, and change the path of the TicketQAQ.DatabaseName to the 
location of the extracted files. 

3) Run the project. If you click on the RUN USING BDE button, you will see a 
result set with many records - where it does not group as expected.

4) Click on the Remove Contract from XQUERY button, and then the RUN USING BDE 
again - and the resultset will be only 3 records - as I expect it to be.

This problem occurs not only with the BDE, but also with another database 
(DBISAM). It took me some time to be able to replicate the issue using the BDE 
to submit an example project.

This problem is currently plaguing my software, so I'm excited to finally 
hopefully finding a solution. Any help will be greatly appreciated!

I am using Delphi 2007 just incase this is isolated to pre-XE software.

Best Regards

Adam.

Original issue reported on code.google.com by [email protected] on 18 Jun 2013 at 11:45

Attachments:

Fix for: SQL Text Truncated in RichEdit using SinxtaxHighLighter component (Unicode eversion 2.08)

What steps will reproduce the problem?
This will only have probnlems when working with Unicode versions of delphi 
(D2009 and newer)

1. Open the Demo app of TxQuery or create a new project add a txquery, 
TSyntaxHighlighter and a TRichEdit and Bind them
2. if using the demo app, select any of the staments (JOIN, ect) or Add A large 
SQL statement like:
'SELECT * FROM Customer c, Orders o, Items i, 
Parts p WHERE (c.CustNo = o.CustNo) And 
(o.OrderNo = i.OrderNo) And (i.PartNo = p.PartNo) 
And c.CustNo > 1300 AND c.CustNo < 2000;  '

3. The statement will look truncated

What is the expected output? What do you see instead?

The statement should look the same as the input sql, only colored, but instead 
it looks truncated.

What version of the product are you using? On what operating system?
latest TXQuery 2.08 SVN, windows 7, Delphi XE Architect

The solutions is in two steps:

1) In Internal procedure strToRichEdit of TSyntaxHighlighter.Execute method
-------------------------------
Procedure strToRichEdit( Const S: String );
  Var
    //aMem: TMemoryStream;  {commented by fduenas}
    aMem: TStringStream;  {changed by fduenas}
    SelStart: Integer;
  Begin
    //aMem := TMemoryStream.Create; {commented by fduenas}
    aMem := TStringStream.Create( s ); {patched by fduenas} //Using a TStringStream avoids casting the var 'S' to AnsiString 
    FChanging := True;
    SelStart := 0; //Basri
    Try
      //aMem.Write( Pointer( S )^, Length( S ) ); 
      //aMem.Write( Pointer( AnsiString(S) )^, Length( AnsiString(S) )  ); {commented by fduenas}
      aMem.Position := 0;
      If FEditor.Focused Then
        SelStart := FEditor.SelStart;
      //LockWindowUpdate( FEditor.Handle );
      fEditor.OnChange := nil;
       FEditor.OnSelectionChange := nil;
      FEditor.Lines.BeginUpdate;
      FEditor.Lines.LoadFromStream( aMem );
      FEditor.Lines.EndUpdate;
      feditor.OnChange := MyOnChange;
      FEditor.OnSelectionChange := MyOnSelectionChange;
      If FEditor.Focused Then
        FEditor.SelStart := SelStart;
      //LockWindowUpdate( 0 );
    Finally
      aMem.Free;
      FChanging := False;
    End;
  End;
------------------------------------------------------------------
2) at Execute's body change the line:
inputStream.WriteBuffer( Pointer( S )^, Length( S ) ); 

To
  inputStream.WriteBuffer( Pointer( S )^, Length( S )*SizeOf(Char) );

This will look like:
------------------------------------------------------------------
Begin
  Reslt := '';
  RtfHeader := '';
{$IFDEF XQDEMO}
  If Not IsDelphiRunning Then
  Begin
    ShowAbout;
    Raise Exception.Create( SDelphiIsNotRunning );
  End;
{$ENDIF}

  If Not Assigned( FEditor ) Or ( csDestroying In ComponentState ) Then
    Exit;
  s := FEditor.Text + ' ';
  inputStream := TMemoryStream.Create;
  //inputStream.WriteBuffer( Pointer( S )^, Length( S ) ); {commented by fduenas}
  inputStream.WriteBuffer( Pointer( S )^, Length( S )*SizeOf(Char) ); {patched by fduenas}
  inputStream.Seek( 0, 0 );
  outputStream := TMemoryStream.create;
---------------------------------------------------------------------

I'm attaching patched SyntaxHi.pas for a full replacement

regards

Original issue reported on code.google.com by [email protected] on 6 Jun 2011 at 2:42

Attachments:

format string

What steps will reproduce the problem?
1.use format function with stringfield some like
SELEC format(" %s ",[strfld]) from table 
and the result is wrong values.


Original issue reported on code.google.com by [email protected] on 1 Aug 2011 at 8:23

Bug fix for Queries like "where Field1 = Field2" with fields from same dataset

Queries with where clause like "Field1 = Field2" (fields from same dataser) do 
not work.

Bug fix in xQuery.pas :

Procedure TSqlAnalizer.DoJoinInWhere;

  Procedure RecursiveJoin(Start: Integer);
  begin
  ... 
  End;

Begin
  { recursively joining }
  if FTableList.Count > 0 then // change to 0 (was 1) from eLion
    RecursiveJoin(-1); // was 0. Have to start from -1 for queries like select ... where Field1 = Field2
End;


eLion

Original issue reported on code.google.com by [email protected] on 25 Jan 2011 at 12:58

Float as field name

Hi, can anybody tellme how can i use the name Float as a field name in a query, 
because i had table with a field called FLOAT but when a try to use this field 
in a query an excexption is raised.. somebody can help me?....


Original issue reported on code.google.com by [email protected] on 16 Aug 2010 at 5:33

Buffer overrun in procedure ReadLn in unit QLexLib

Subprocedure CheckBuffer in procedure ReadLn (unit QLexLib) doesn't take into 
account SizeOf(Char) when checking buffer size and allocating buffer. Existing 
procedure should be changed to

  procedure CheckBuffer;
  begin
    repeat
      //we need to take into account size of char - we are increasing
      //position in stream by SizeOf(char) and not by a byte
      if (i * SizeOf(Char)) >= (BufSize - SizeOf(Char)) then
      //(- SizeOf(Char) is needed if BufSize is odd number and
      //GetMem works in chunks of 1 byte
      begin
        BufSize := max (BufSize * 2, 256);
        ReallocMem (Buf, BufSize);
      end;
    until (i * SizeOf(Char)) < (BufSize - SizeOf(Char));
  end;

Original issue reported on code.google.com by [email protected] on 27 Jul 2010 at 10:48

dash or hyphen in field name not working

I have the following SQL that is getting hung up on a field that contains a 
dash in its name.

SELECT TableMain.Holw-serm-ID FROM TableImport INNER JOIN TableMain ON 
TableImport.[Holw-serm-ID]=TableMain.[Holw-serm-ID] WHERE 
TableMain.do_not_update IS NULL

I have tried putting the field quoted in [, ", and ` but makes no difference.

I get an ExQueryError with 'Field serm was not found'.

It seems the field name Holw-serm-ID is getting broken into TableMain.Holw, 
serm and ID.

What version of the product are you using? On what operating system?
3.0.1

Original issue reported on code.google.com by [email protected] on 13 Aug 2013 at 8:47

Delphi 6 compilation error - ftWideMemo not supported prior to Delphi 2006

What steps will reproduce the problem?
1. TxQuery 2.4.7
2. Delphi 6
3. compile Xqd6.dpk

What is the expected output? What do you see instead?

Expected:
Successful compile.

Instead:
[Error] xquery.pas(1146): Undeclared identifier: 'ftWideMemo'


What version of the product are you using? On what operating system?
Delphi 6 Pro update 4
TxQuery v2.4.7
Win7 x64 Ultimate / WinXP x86

Please provide any additional information below.

Clearly this version was modified (as a stated goal) for unicode support. Has 
support for older compilers been abandoned? The ftWideMemo was introduced in 
Delphi 2006 so everything prior to that should be broken even though there ARE 
packages for them. I hope that this is just an oversite and not a choice.

Thanks for keeping this project alive.



Original issue reported on code.google.com by [email protected] on 14 May 2012 at 4:44

Order by in ansi sequence

TxQuery sort string fields in ascii not in ansi sequence.
To crrect that SortCompare_S function in xqbase (line 2165) must be 
replaced by:
  Function SortCompare_S( Recno: Integer; Const Value: String ): Integer;
  Begin
    SetRecno( Recno );
    Result := AnsiCompareStr(FFields[Idx].AsString, Value);
    if IsDesc then Result := - Result;
  End;

Best regards
Branko


Original issue reported on code.google.com by [email protected] on 5 Dec 2009 at 8:44

Updated and improved Sources Of TXQuery 2013-05-15, (based on rev. 2012-10-11 by cychau) [Posted HERE] (Added Full Unicode support)

Hi Guys, I have Uploaded a new modified  version. this make a lot changes to 
the sources. mainly for the puprose to add full unicode support of TXQuery, at 
least for Unicode IDEs (2009 an up).

I have a added full support for Unicode in TXQuery, now you can also add 
unicode chars to the SQL script, an the parse will manage it gracefully.

so you can add something like:

SELECT field1, field2, field3, ('รหัสสินค้า'+'  => 
'+field3) as UnicodeField3
FROM
 table1
WHERE field3 = 'ěščřžýáíé';

--------------------------------------------------------------------
--NOTES Regarging NON Unicoe IDEs:
I have also made a lot of changes to add uniode support to NON Unicode IDES 
(delphi 2007 and older) via the use WideStrings. I cannot validate this changes 
because for now I don't have an IDE installed for those compilers.

Please feel free to test them, they should work.

In the x_flag.inc there is a compiler definition 

{.$DEFINE XQ_USE_WIDESTRINGS}

This is for the NON unicode compilers, Please enable it by removing the '.', 
This will force the compiler to use WideStrings instead of AnsiStrings. 

When this define is disabled, the widestrings are still managed but only via 
the data contained in the fields, the SQL script will be ANSI so, you cannot 
put Unicode Chars in the SQL script, But any Unicode data contained in your 
Datasets should be managed correctly.

I have fully tested this in Delphi XE, and should work correctly in Unicode 
compilers (D2009 and up).

Some TXQuery Events would change if you force the use of WideStrings, so I 
recommend to do the corrections, By default Those AnsiString Fields will be 
changed to WideString and the TStringList will be changed to TWideStringList.

The changes were made to these events:
OnUDFCheckEvent
OnUDFSolveEvent
OnIndexNeededForEvent
OnSetRangeEvent
OnSetFilterEvent
OnCreateIndexEvent
OnDropTableEvent
OnDropIndexEvent
OnSyntaxErrorEvent
OnResolveDatasetEvent
OnQueryFieldNameEvent
OnSetUserRangeEvent

If you use in your code one or more of these events, You will have to copy the 
code you PUT there, Remove the event and recreate it, then Paste again the code 
you used in that event. This change have to be done only when you FORCE the use 
of WideStrings with Delphi 2007 and older compilers.

For further changes you can ADD a compiler condition in the method definition 
of the event, so it wont be affected when you migrate to a newer IDE (Unicode) 
or remove the forced use of WideStrings, 

Example:

procedure XQuery1ResolveDataset(Sender: TObject;
      const Filename: {$IFDEF XQ_USE_WIDESTRINGS}WideString{$ELSE}String{$ENDIF};
      var ATableName: {$IFDEF XQ_USE_WIDESTRINGS}WideString{$ELSE}String{$ENDIF};
      var Dataset: TDataSet);

procedure XQuery1CreateIndex(Sender: TObject; Unique, Descending: Boolean; 
const TableName,
      IndexName: {$IFDEF XQ_USE_WIDESTRINGS}WideString{$ELSE}String{$ENDIF};
      ColumnExprList: {$IFDEF XQ_USE_WIDESTRINGS}TWideStringList{$ELSE}TStringList{$ENDIF});

procedure XQuery1IndexNeededFor(Sender: TObject; DataSet: TDataSet;
      const FieldNames: {$IFDEF XQ_USE_WIDESTRINGS}WideString{$ELSE}String{$ENDIF}; ActivateIndex, IsJoining: Boolean;
      var Accept: Boolean);

Don't forget to Include the 'XQ_Flag.inc' file at the begining of your .pas 
form unit and in any unit where you use the XQ_USE_WIDESTRINGS definition, so 
the compiler definition can be evaluated correctly

This will make you code adaptable to any Delphi version.
REMEMBER This is only needed when working with delphi 2007 and older compilers
-------------------------------------------------------------------

Regards and have fun

Original issue reported on code.google.com by [email protected] on 16 Apr 2013 at 3:07

Attachments:

Usage of NULL in where clause fails

When a query has a where statement such as

where (field is not null)

It now raises an error "Expresion is not of Boolean type .!"

This used to work in earlier versions, but now fails.

Tested on D2007 Windows 7 Pro x64.

Original issue reported on code.google.com by [email protected] on 6 Jun 2013 at 5:20

TxQuery with JOINS

I am upgrading an application from C Builder 2007 to C Builder XE.

I am using the latest version of TxQuery 2.x that supports XE.

I have SQL statements with multiple JOINS that have worked with TxQuery 1.86 
for YEARS and now cause EAccessError / crashes in the latest version.

The data sets attached to the TxQuery are TkbmMemTables. An example SQL 
statement that is failing is below:

SELECT EventSchedule.*,
       EventLocations.Location,
       EventResources.Name AS Resource,
       EventRevenueCodes.Description AS RevenueCode,
       EventScope.Description AS Scope,
       EventStatus.Status
FROM   EventSchedule
INNER  JOIN EventLocations
   ON  EventLocations.RecordID    = EventSchedule.LocationID
INNER  JOIN EventResources
   ON  EventResources.RecordID    = EventSchedule.ResourceID
INNER  JOIN EventStatus                                                                 
   ON  EventStatus.RecordID       = EventSchedule.StatusID
INNER  JOIN EventScope
   ON  EventScope.RecordID        = EventSchedule.ScopeID
LEFT   OUTER JOIN EventRevenueCodes
   ON  EventRevenueCodes.RecordID = EventSchedule.RevenueCodeID
ORDER BY LateDeparture,DepartTime,Resource

Has anyone else had this problem and a solution?

Best Regards,

Shane

Original issue reported on code.google.com by [email protected] on 21 Jan 2011 at 8:05

Recno Out of Range

When a Txquery has a null value (or potentially an empty string too) in one of 
the transform or group by fields, it breaks with the error Recno Out of Range. 

Experienced Delphi 2007 using TxQuery 2.0 and 2.7.7

Original issue reported on code.google.com by [email protected] on 23 Oct 2012 at 4:10

Text unreadable in richedit components in demo application

What steps will reproduce the problem?
1. Start the application as it is now
2. Look at the richedit contents

You'll get error messages that the line cannot be inserted into the 
richedit too.

What is the expected output? What do you see instead?
I expected syntax highlighted text. I see raw richedit code with blocks 
instead.

What version of the product are you using? On what operating system?
I'm using version 2.0 (r7).

Please provide any additional information below.

As a quick fix, modify function strToRichEdit() in SyntaxHi.pas on line 266 
from:
      aMem.Write( Pointer(S)^, Length(S) );
to:
      aMem.Write( Pointer( AnsiString(S) )^, Length( AnsiString(S) ) );

Original issue reported on code.google.com by [email protected] on 4 Dec 2009 at 5:26

select with unicode alias

when i query data ie.
select a.col1, a.col2 as "รหัสสินค้า"
from table a
when active txquery with d2010 error a.[รหัสสินค้า] 
then run d7 not error 

Original issue reported on code.google.com by [email protected] on 6 Dec 2009 at 8:10

Refresh does not work

TxQuery ver 3.01.

TxQuery.Refresh does not work - AV after Refresh.

TIA and best regards
Branko

Original issue reported on code.google.com by [email protected] on 3 Aug 2013 at 4:10

how can i muiti table update?

i used 
update PICBYQDL p,DBBYQDL db Set p.YgDL=db.ygdl, p.WgDL=db.wgdl,p.glys=db.glys  
where p.Name=db.NAME;


update PICBYQDL p set p.YgDL=(select db.ygdl from DBBYQDL db where 
p.Name=db.NAME)


both error,   i search chm help file but no answer,how can i do?

Original issue reported on code.google.com by [email protected] on 14 Nov 2011 at 4:30

Sources Updated (fixed some reported issues, changes posted here)

Hi this is at least the updated sources since I started working on TXQuery.

- fixed display value errors when using Number fields in functions that uses 
normally String Fields. Ex: LeftStr, Copy, Length, etc.

-- Added some Extra String Functions: LeftStr, RightStr, MidStr, Copy, Substr.

- Fixed issue with Format() function. Some values where displayed wrongly, not 
displayed or truncated

- Fixed Issues with CAST() function, at least for String and Float values 
casted to string.

- Small fixes

Original issue reported on code.google.com by [email protected] on 10 Aug 2011 at 12:37

Attachments:

TxQuery on XE2?

I'm trying to install TxQuery on Delphi XE2, but I'm getting error while 
installing package dclXq_D2011.bpl:

"Registration procedure, Xqreg.Register in package 
C:\De16_ut\xQuery\Packages\D2011\bin\dclXq_D2011.bpl raised Exception class 
EAccessViolation: Access violation at address 5003C397 in module 'rtl160.bpl'. 
Read of address FFFFFFC8."

Changes that I did prior to installation:

in file xq_glag.inc I added section for XE2 version of Delphi 
...
{$IFDEF VER230}      // Delphi 16
{$DEFINE LEVEL4}
{$DEFINE LEVEL5}
{$DEFINE LEVEL6}
{$DEFINE LEVEL7}
{$DEFINE DELPHI7}
{$DEFINE DELPHI}
{$ENDIF}
...

Original issue reported on code.google.com by [email protected] on 7 Dec 2011 at 8:51

doubt

This is not an issue is only a question how can i parse the expression without 
execute the query, i just only need to know if the query can be executed?


Original issue reported on code.google.com by [email protected] on 11 Jan 2012 at 2:48

Updated and improved Sources Of TXQuery 2012-09-13, based on r28 [Posted HERE]

I'm glad to post updated sources for TxQuery as of 2012-09-13
this version include the following:

- Fully thread safe operations.
- Reworked Parser and lexer (Yacc/Lex) to work thread safe and to use an 
individual copy of TFormatsettings record, (avaliable from delphi 7 and up) to 
use thread safe formatting functions like StrToInt, FormatFloat, StrTodate, 
DatetoStr, etc.

- Addded 'ActiveStoredUsage' property to determine if the Stored value of the 
property 'Active' will be used when loading the component at design time and at 
runtime. this prevents the Txquery to automatically open when loadign a project 
at design time or to auto open when running the app and that previously that 
txquery has the 'Active' porperty set to True.

- Added 'FormatSettings' property to configure the Locale setttings, those will 
be used with the parser and the SQl functions.

- The DateFormat and DateSeparator (recently added) properties will be soon 
removed, because now the Formatsettings.Parser.ShortDateFormat and 
Formatsettings.Parser.DateSeparator properties will do the work, so please 
migrate your values to that properties.

My default the Locale options that the prasers uses to detect date values and 
float values that are specified directly inside an sql script are:

Formatsettings.Parser.ShortDateFormat Formatsettings.Parser.DateSeparator
Formatsettings.Parser.ThousandSeparator
Formatsettings.Parser.DecimalSeparator

The default values for those properties are specified in the file 
QFormatSettings.pas at the 'ResourceStrings' section, you can change them 
whenever you want. Just make sure that the 'DateSeparator' Char have to be the 
same the you use in the 'ShortDateFormat' string to separate the Moths,days and 
years, ex: for a ShortStringFormat='yyyy-mm-dd', the 'DateSeparator' must be 
'-'.

- Fixed some memory leaks.
- Improvements in the source code execution flow
- Improved the function 'Round', it now acccepts a second para to determine the 
number of decimals to round. Ex: Round(12345.6789,2) will result in 12345.68

- Fixed some TestCases
- Fixed some issues with the Demo app.

I have only tested them in delphi XE and should wpork with delphi 7 and newer

Please make your tests and have fun

Regards
Francisco Armando Dueñas Rodriguez

Original issue reported on code.google.com by [email protected] on 14 Sep 2012 at 12:47

Attachments:

Some issues Solved and Corrected

Hi I have been working a little bit on TxQuery from the latest sources on this 
repository and applying some changes and fixes already posted here in this 
issue section.

I have reworked the Managment and transition from pansiChar and PChar (Ansi to 
unicod versions). and fixes some unsolved issues like the Issue #9 (TlargeInt 
field work field value) this is related to PChar management and memory 
operations. I have made some test and at leats in my place all is working 
perfectly, 

Some issues solved:
1) Previously the length of each source string field has the double of length + 
2 as a txquery field, now it uses the same length as the original Source Field
2) fixed Issue #9 when combining string fields, integer fields and float 
fields, it display strange values.
3) Change some ANSIXX function to unicode Functions like AnsiCompareXX to 
CompareXX, AnsiPos to Pos.
4) All clases in XQuery.pas including TFileReusltset works now with Unicode and 
Pchar

Some patches are based on CY's and applied to ther classes, all the changes are 
marked by my nickname 'fduenas'

There still some work to do like converting all code in XqBase,pas from 
managing PansiChar to PChar (unicode versions).

Hope this fixes can be applied to the main trunk, I will email CY with the full 
changed files so he can review them.

The sources are based on Latest Release 2.1 r16 and applied some fixes posted 
here after that update.

Any other issue please contact me at [email protected].
Regards and happy programming

Original issue reported on code.google.com by [email protected] on 12 Jul 2011 at 4:07

Attachments:

Rad Studio XE??

Does anyone have a RadStudio XE set of packages? I am trying to use the Rad 
Studio 2010 packages and I am getting compiler errors.

Happy New Year!

Shane

Original issue reported on code.google.com by [email protected] on 28 Dec 2010 at 4:42

Calculated fields - TxQuery

Calculated fields on TxQuery component do not seem to work. Setting the value 
of the calculated field (datatype string) in the CalcFields event does not 
update the value of the calc field.

Original issue reported on code.google.com by [email protected] on 24 Aug 2012 at 7:40

Updated and improved Sources Of TXQuery 2013-04-13, based on rev. 2012-10-11 [Posted HERE] (fixes Delphi XE3 issues)

We have added the fixes made by cychau to fix the delphi XE 3 issues

Please be free to test it.

there are no new stuff, just a mantainance release.

- fixed some compiler warnings and Package issues (2010 and below)
- fixed compilation issue in delphi 2010 and delphi 2007, for users that have 
reported them.

- Applied Delpi Xe 3 patch by cychau, i have not made tests because I don't 
have Delphi XE 3 :(, but I trust in him :)

We plan to add a feature for JOINS optimization, to be able to use indexes.But 
this is a long term feature because of schedule problems (I have a life!! :) )

REGARDS

Original issue reported on code.google.com by [email protected] on 13 Apr 2013 at 10:18

Attachments:

Multi-relation fields of Master-detail not work

these are master-detail codes:
those relations fields only B2_DESC = :B2_DESC dose work.
otheres B2_SPEC = :B2_SPEC and  B3_GRD = :B3_GRD and B3_SZE = :B3_SZE do not 
work.
xQuery := TxQuery.Create(nil);
 with xQuery do
  begin
   DataSource := MasterSrc;
   AddDataSet(C3, 'C3');
   cSQL   := ' select * from C3 ';
   cWhere := ' where  B2_DESC = :B2_DESC and B2_SPEC = :B2_SPEC and         B3_GRD = :B3_GRD and B3_SZE = :B3_SZE ';
   cOrder := ' Order by B2_DESC, B2_SPEC, B3_GRD, B3_SZE ';
   cSQL   := cSQL + cWhere + cOrder ;
   SQL.SetText(PChar(cSQL));
   Open;
end;

delphi 2006 winxp.


Original issue reported on code.google.com by [email protected] on 7 Jun 2013 at 3:36

IndexNeeded not working for joins

Does anyone use indexes with xquery?
On the help says it should work with joins, but the indexneeded event is not 
fired.

I have checked the code and it looks like the JOIN part is missing or deleted.

the code says: 
    { Check WHERE clause sections that can be optimized by using indexes
      JOINing has precedence over WHERE statement
      WHERE statement has precedence over an ORDER BY }

however, there is only 2 IFs above that, for the WHERE and the ORDER BY

If anyone have any experience with, i appreciate.
I using the original 1.86, but have also checked the updates from the group, 
they are the same.
I am using with titan for btrieve, with big files, so a index is very needed.

Thanks guys, and congratulations for the excellent work on xquery

Lucio

Original issue reported on code.google.com by [email protected] on 19 Nov 2011 at 1:04

Posted Updated Sources Of TXQuery [HERE]

Hi I have updated sources of txquery. 
- Fixed some JOIN bugs (tested with two tables with more than 50,000  records.
- Ported almost all units to manage PChar instead of PAnsiChar
- fixed some memory leaks
- fixed a possible AV error when working with JOINS and joining with string 
fields.
- tested only in Delphi XE, but it shoudl work on Delphi 2007 and lowr versions

- I have included QBuilder in the 'all' sources

Please make some tests, the demo app work good in all the query examples




Original issue reported on code.google.com by [email protected] on 23 Aug 2011 at 5:19

Attachments:

Updated and improved Sources Of TXQuery 2012-09-17, based on r28 [Posted HERE]

This latest update include:
- some bug fixes
- removed some potential memory leaks regarding type conversion (some 
ExException and EqException were created but never raised, so they where never 
freed)
- Fixed very old issue when the parser gave an error, the dataset associated to 
txquery where never enabled or their states restored.


Regards

Original issue reported on code.google.com by [email protected] on 17 Sep 2012 at 6:04

Attachments:

Bug fixes in yQuery.pas

I noticed 2 bugs in xQuery.pas
Here are the fixes.

1) in procedure TSqlAnalizer.DoGroupBy, a query without results should have no 
'Group By' results

  if ResultSet.RecordCount=0 Then
  Begin
    ResultSetHasRecords:= False;
//  ResultSet.Insert(); // changed by eLion. Queries without results should 
have no GroupBy results
  End Else
    ResultSetHasRecords:= True;

and further:

    // all but pivots are marked with negative number
    if vSortList.Count > 0 then begin // changed by eLion
      vSortList.Recno := 1;
      vSortList.SourceRecno := -vSortList.SourceRecno;
    end;

2) The patch in function TSqlAnalizer.ReplaceParams is wrong (at least for 
D2007: for D2010, this should be tested.

//  Result := List.ParseSQL(SQL, True); // Result:= 
StrPas(PChar(List.ParseSQL(SQL, True))); {patched by ccy} <- wrong patch
//  above patch would replace parameter condition like ':ElementNr' by 
'1'#0'mentNr' which is wrong: it should be '1'
    Result:= PWideChar(List.ParseSQL(SQL, True)); // changed by eLion

Hope this will help.

eLion

Original issue reported on code.google.com by [email protected] on 5 Aug 2010 at 6:55

Attachments:

Updated and improved Sources Of TXQuery 2012-09-07, based on r28 [Posted HERE]

Hi I have uploaded I new version and updated of txquery.
this include some fixes like:

- Complete review for TWideStringField and TLargeIntField support
- Code improvements regarding field testing
- When using a TRANSFORM..PIVOT, if the trasnform has more than one aggregate 
expression:
ex:

TRANSFORM SUM(AmountPaid), COUNT(*), AVG(AMOUNTPAID) SELECT CUSTNO 
FROM ORDERS GROUP BY CUSTNO 
PIVOT FormatDateTime("yyyy", SALEDATE) IN 
(SELECT DISTINCT EXTRACT(YEAR FROM LASTINVOICEDATE) FROM
CUSTOMER ORDER BY 1);    

The query resturned fields 1998, 19981, 19982, 2001, 20111, 20012,etc
For each aggregate field, not it will return: SUM_OF_1998, COUNT_OF_1998, 
AVG_OF_1998, SUM_OF_2000, COUNT_OF_2000, AVG_OF_2000,
etc.

--Fixed issues with Calculated Fields
The only requirement is that TxQuery data fields (fkdata) must be already 
defined before query execution and the Calculated fields (fkcalculated) must be 
put at the end of the TXQuery dataset field list (after all data fields).

- Added Testing for LargeInt fields to DUnit testing Framework
- Added Testing for Calculated  fields to DUnit testing Framework
- added some new custom functions like 'Concat' and 'Concat_ws'.

I have only tested it in delphi XE, but whould run on delphi 7 or newer.

* Run the Demo app and the Testing DUnit framework to try to test issues

Have fun and regards

Original issue reported on code.google.com by [email protected] on 7 Sep 2012 at 7:25

GUID Field Bug

For Unicode versions of Delphi, ftGUID fields truncate data when the source 
field is a TGUID field. (Effectively a string field).

I've found a problem where for field types of ftGUID results will be 
incomplete. (Values are clipped).

A work around to the problem is to ensure that the source datasets have no 
TGUID fields. (Use TStringFields instead, or use CAST in queries) 

however the fix appears to be to search and replace all instances of

in [ftString, 

to

in [ftString, ftGUID, 

within the xquery.pas file

Which appears to resolve the issue as well. Can this be updated in the next 
release please?


Original issue reported on code.google.com by [email protected] on 1 Oct 2014 at 5:41

Updated and improved Sources Of TXQuery [Posted HERE]

Hi I have made a little improvements in TXQuery.

The change is regarding Issue 20.

When using a query like:

select distinct adr_id as id from amr where
                 (adr_id NOT IN (select adr_id from amr where mer_id = 5))

The default behaviour is like:

select distinct adr_id as id from amr where
                 (adr_id NOT IN ANY (select adr_id from amr where mer_id = 5))

So this causes each record of 'amr' to be included in the resultset.

Using a query with the 'ALL':
select distinct adr_id as id from amr where
                 (adr_id NOT IN ALL (select adr_id from amr where mer_id = 5))

will do the work as expected.

So I changed the behaviour to, by default use the 'ALL' instead of 'ANY' if 
those keywords are not specified when using the 'NOT IN' clause.

so:

select distinct adr_id as id from amr where
                 (adr_id NOT IN (select adr_id from amr where mer_id = 5))

will be treated the same as:

select distinct adr_id as id from amr where
                 (adr_id NOT IN ALL (select adr_id from amr where mer_id = 5))


this change only affects when using the 'NOT IN'

As always updated sources are uploaded here

Please give some feedback

Original issue reported on code.google.com by [email protected] on 3 Nov 2011 at 4:25

Attachments:

JOIN

What steps will reproduce the problem?
1. Do a query with two tables with 10000 record or more the second table copy 
is copy of first.
2.select all fields of both tables,in where clause set a something like that 
table1.field  = table2.field  when field is a char field[20]   
3. use TDBF as your dbf manager.

the query just crash, how can i solve the problem???

Original issue reported on code.google.com by [email protected] on 10 Aug 2011 at 8:33

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.