Recent

Author Topic: LazSqlX  (Read 143642 times)

flamer0n

  • Guest
Re: LazSqlX
« Reply #120 on: September 16, 2014, 06:39:30 pm »
Taaz thnx for the icon

Mike, no matter how bizarre it may look, I had to do this 'ninja' stuff to get the correct string from zeos guid field. Though sqldb has some extra spaces in guid field (string representation) it's better than zeos, for the time being :) ofc i could be wrong or lack knowledge in this...
Edit: just check this method in the source (im sorry it's all in one line im on my phone)
Edit: adjusted
Code: [Select]
class function TAsStringUtils.ByteGUIDToString(field: TField): string;

procedure Reorder(var InBytes:TBytes);
var
  tmp:Byte;
  tmpArray:TBytes;
  I: Integer;
begin
  SetLength(tmpArray,Length(InBytes));

  for I:=1 to Length(InBytes) do
  begin
    tmpArray[I-1] := InBytes[I];
  end;
  tmp := InBytes[0];

  tmpArray[Length(tmpArray)-1] := tmp;

{0 - 3 - 0
1 - 2 - 1
4 - 5 - 4
6 - 7 - 6}

  tmp := tmpArray[3];
  tmpArray[3] := tmpArray[0];
  tmpArray[0] := tmp;

  tmp := tmpArray[2];
  tmpArray[2] := tmpArray[1];
  tmpArray[1] := tmp;

  tmp := tmpArray[5];
  tmpArray[5] := tmpArray[4];
  tmpArray[4] := tmp;


  tmp := tmpArray[7];
  tmpArray[7] := tmpArray[6];
  tmpArray[6] := tmp;


  InBytes := tmpArray;


end;

var
  s:AnsiString;
  blob : TBlobField;
  m:TMemoryStream;
  b:Byte;
  by:TBytes;
  I: Integer;
  size:Integer;
begin

  blob :=  TBlobField(field);

  m := TMemoryStream.Create;
  try
    blob.SaveToStream(m);
    size := m.Size;
    SetLength(by,size);

    m.Position:= 0;
    while m.Position<m.Size do
    begin
      I:= m.Position;
      m.Read(b,1);
      by[m.Position] := b;
    end;

    m.Position:=m.Size;
    m.Read(b,1);
    by[0] := b;

    Reorder(by);
    for I:=0 to Length(by)-1 do
    begin
      s:=s+IntToHex(by[I],2);

      if Length(s)=8 then
      s:=s+'-';

      if Length(s)=13 then
      s:=s+'-';

      if Length(s)=18 then
      s:=s+'-';

      if Length(s)=23 then
      s:=s+'-';

    end;
  finally
    m.Free;
  end;

  //Result := RemoveChars(GUIDToString(Hold_GUID),['{','}']);
  Result := s;
end;

« Last Edit: September 17, 2014, 09:12:59 am by flamer0n »

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1260
Re: LazSqlX
« Reply #121 on: September 16, 2014, 06:43:04 pm »
Well, I'd recommend splitting that up across several lines (UPDATE: You did :) ), but I see what you mean :)
Yeah, I'm seeing those extra spaces from SQLDB as well.  For now, I've just modified my SQLs to: Select RTRIM(GUID) From XXXXX
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

flamer0n

  • Guest
Re: LazSqlX
« Reply #122 on: September 17, 2014, 10:11:48 am »
v4.3.1.1365

- replace MsSQL icon with the one that comes with lazarus in sqldb components (24x24 was needed)
- fixed a bug (which was causing a lot of troubles) in removing custom tabs from custom pagecontrol in LazSqlXCtrls

Zath

  • Sr. Member
  • ****
  • Posts: 391
Re: LazSqlX
« Reply #123 on: September 17, 2014, 03:11:07 pm »
So which file do we download ?
That link you just posted takes you to a page with 3 files, all different sizes and the main one says "Want the latest version" and it doesn't match the numbers you posted in the thread ?

Thanks

flamer0n

  • Guest
Re: LazSqlX
« Reply #124 on: September 17, 2014, 03:26:55 pm »
LazSqlX.zip and  LazSqlX_Setup.exe are the same version. One with the setup the other all needed files in the archive in case someone has troubles with setup. The post was at 10am, meanwhile I've updated couple of times (but didn't post anything here), now it's v4.3.1.1369

Also the LazSqlX_Source.zip (in Sources dir) are UpToDate






Zath

  • Sr. Member
  • ****
  • Posts: 391
Re: LazSqlX
« Reply #125 on: September 17, 2014, 03:47:26 pm »
I always get this when I install the prog.

I also tried several times to connect as before yet still get the same error.
After several attempts, I was given an access violation error. A few of these and the program closed.
At the time of the Access violation, I was trying to connect but the DBEngine edit box was blank.

flamer0n

  • Guest
Re: LazSqlX
« Reply #126 on: September 17, 2014, 03:55:53 pm »
I'm sorry about that, it's that the setup fails to start the LazSqlX (checkbox on last setup pages "Launch Program"), because it doesn't have the permission by OS to run programs, though I've checked the option "Requires elevated privileges" but it seems it won't work without "Run as admin" so maybe I should remove the "Launch LazSqlX" checkbox after setup finishes

Did you try on Connection form to switch DbEngine to Zeos and then see if you can connect?

Zath

  • Sr. Member
  • ****
  • Posts: 391
Re: LazSqlX
« Reply #127 on: September 17, 2014, 04:13:23 pm »
The Zeos option does let me connect, sometimes.
I remember reading somewhere that it doesn't like NVARCHAR field types and I know some of my fields use that type.
Trying to open one of these just hangs the prog again. Eventually I get an error such as the TMSSQLConnection error again.

I'm in, that's a start  :)

flamer0n

  • Guest
Re: LazSqlX
« Reply #128 on: September 17, 2014, 04:29:38 pm »
this is the message I get when using Zeos on Mssql
Quote
DBError : [10007] : General SQL Server error: Check messages from the SQL Server.
Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier.
but your case is that application hangs   :-\  anyway, if you "Select cast(field as varchar) from table" it shouldn't throw this exception, but it's unpractical and sometimes information gets lost when converted

Quote
Trying to open one of these just hangs the prog again. Eventually I get an error such as the TMSSQLConnection error again.


You mean, even after selecting Zeos, you get TMSSQLConenction error? It's possible I forgot something...

Zath

  • Sr. Member
  • ****
  • Posts: 391
Re: LazSqlX
« Reply #129 on: September 17, 2014, 04:42:45 pm »
Quote
You mean, even after selecting Zeos, you get TMSSQLConenction error? It's possible I forgot something...

If you connect with Zeos, the tables are displayed in the left pane.
Right click over the left pane, select "Drop Table" then say yes to confirm.

Then I get the error.
« Last Edit: September 17, 2014, 04:45:49 pm by Zath »

flamer0n

  • Guest
Re: LazSqlX
« Reply #130 on: September 17, 2014, 05:04:58 pm »
Just fixed it (on new table and delete table)
if you want to try it, here it is (in the same place) 4.3.1.1381

edit: Link fix
« Last Edit: September 17, 2014, 06:10:29 pm by flamer0n »

Zath

  • Sr. Member
  • ****
  • Posts: 391
Re: LazSqlX
« Reply #131 on: September 17, 2014, 05:45:28 pm »
Just fixed it (on new table and delete table)
if you want to try it, here it is (in the same place) 4.3.1.1381

Your link is a bit messed up, (two http:// ) but I got the file now thanks.
I tried to recreate the bug but ended up deleting two tables !
My mistake, I thought dropping the table was from the view not the overall database.
It's all ok though, its all a test.

flamer0n

  • Guest
Re: LazSqlX
« Reply #132 on: September 17, 2014, 06:12:20 pm »
Sorry for broken link

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: LazSqlX
« Reply #133 on: September 19, 2014, 04:39:19 pm »
Yeah, I'm seeing those extra spaces from SQLDB as well.  For now, I've just modified my SQLs to: Select RTRIM(GUID) From XXXXX
FYI, see bug
http://bugs.freepascal.org/view.php?id=26736
re sqldb handling of guids...
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Zath

  • Sr. Member
  • ****
  • Posts: 391
Re: LazSqlX
« Reply #134 on: September 29, 2014, 11:41:29 am »
Any news on this flamer ?

 

TinyPortal © 2005-2018