Lazarus
Miscellaneous => Other => Topic started by: flamer0n on September 16, 2013, 12:25:42 pm
-
LazSqlX is a Multiplatform mini sql Manager built completely with Lazarus FPC. It comes in handy to any developer who works with MsSQL, Oracle, MySql,Sqlite or Firebird. It provides them with an intuitive database management tool that can be used to browse the database structure, generate and execute queries and stored procedures, view table information and create new tables. I think it's important to let you know that because of security reasons I'm only sharing Softpedia download link so you can be assured that it has passed the 100% Clean from Softpedia (http://www.softpedia.com/progClean/LazSqlX-Clean-241938.html) .
Free Download
Softpedia:
http://www.softpedia.com/get/Internet/Servers/Database-Utils/LazSqlX.shtml
Get latest from SourceForge:
LazSqlX Sourceforge (http://sourceforge.net/projects/lazsqlx/)
Greets!
-
Hi,
Is there a linux version available? I only see a Windows download.
Thanks
-
HI @CaptBill,
I just managed to build it in Kubuntu but it has some heavy issues so for now it's unusable for Linux that's why I didn't publish it yet, but I'm working on it.
Thanks
-
I've tested with MsSql, Oracle and Sqlite3 DB, works nice :)
I have to ask, which connection components did you use, I see that query with oracle works, I had some troubles with executing query in Laz.
Thanks and keep up the good work.
EDIT: I see it's Zeos for OracleDB.
-
@sin_dragan Hi dragan! Thank you!
Yes you're right, I used Zeos components. For Oracle, in database property of zconnection I put the whole server descriptor (same that is in ORA TNS File), I've also included ora light client libs so you don't need Oracle Client installed on client machine. Installed files can also be packed into a zip and it will work, you can take it with you in your usb stick memory, especially useful when someone needs to go to some client but has no access to install any sql manager in client's client machine, so one could use this tool to query and browse DBs.
-
I've also included ora light client libs so you don't need Oracle Client installed on client machine.
Didn't know you could do that. That's brilliant :-) I presume there's no licensing issue from Oracle?
Installed files can also be packed into a zip and it will work, you can take it with you in your usb stick memory, especially useful when someone needs to go to some client but has no access to install any sql manager in client's client machine, so one could use this tool to query and browse DBs.
Again, superb. I'm in this exact situation far too often. I've been using either Portable Database Browser or a variety of smaller tools I've written myself. I've added your app to my arsenal :-) Many thanks.
-
@Mike.Cornflake
Didn't know you could do that. That's brilliant :-) I presume there's no licensing issue from Oracle?
I don't know about licensing, but I'm not selling anything so I shouldn't be worried :) , I think it's just as same as downloading those libs from the internet which is free and no restrictions at all.
Enjoy!
ps.
I'll be adding more stuff to it later, like cloning db structure from one db platform to another one, (ie from MsSql to MySql or Oracle and vice versa)
-
I have to ask, which connection components did you use, I see that query with oracle works, I had some troubles with executing query in Laz.
Please don't hesitate to start a forum thread about those troubles - if we can improve Oracle support in SQLDB, we'd be happy to...
-
I just uploaded new version
3.16.1
-Fixed a bug for MsSql mode, when opening TableData wouldn’t allow editing data in the grid
-Fixed a bug where copy rows didn’t copy data properly if they contained GUID fields (MsSql)
SouceForge
https://sourceforge.net/projects/lazsqlx/files/Version%203.16.1.1145/
I just sent Softpedia a request for new version, I hope they update it soon.
ps.
Zeos Components don't handle GUID properly, so I had to work-around to get guid as string.
-
Hi flamer0n, i want to make a suggestion, ini configuration file, to work better platform, and also run without elevation of permissions in windows 7/8 would be better left in the appdata directory, I pass a code sample:
procedure TfrmMain.LoadConfig;
var
Archivo: TINIFile;
begin
Archivo := TINIFile.Create(IncludeTrailingPathDelimiter(GetAppConfigDirUTF8(False)) +
'LazSqlX.ini');
......
end;
Finally, maybe if u can release the code, we can contribute :).
Thanks for your effort!
edit: surrounding code, thanks to BigChimp :) for the suggestion, and for contributing to fpc / lazarus the 25 hours of the day :)
-
Hi flamer0n, i want to make a suggestion, ini configuration file, to work better platform, and also run without elevation of permissions in windows 7/8 would be better left in the appdata directory, I pass a code sample:
procedure TfrmMain.LoadConfig;
var
Archivo: TINIFile;
begin
Archivo := TINIFile.Create(IncludeTrailingPathDelimiter(GetAppConfigDirUTF8(False)) +
'LazSqlX.ini');
......
end;
Good idea. One addition: you could first try to read the ini from the current dir so you can use an ini file with settings on USB sticks etc, then read from GetAppConfigDirUTF8 and override with that one if found.
@esvignolo: next time you post, you may look into surrounding code snippets with code tags (see the button marked # on the editor toolbar)... that makes the code much more readable ;) e.g.:
procedure TfrmMain.LoadConfig;
var
Archivo: TINIFile;
begin
Archivo := TINIFile.Create(IncludeTrailingPathDelimiter(GetAppConfigDirUTF8(False)) +
'LazSqlX.ini');
......
end;
Finally, maybe if u can release the code, we can contribute :).
Yes, that would be very nice!
Thanks for your effort!
Thanks from me as well, glad to see more Laz db programs ;)
-
Thank you so much guys! I thought of releasing the code, but before I do that I must remove some functionality as they are considered know-hows of the company I work in, some portions of code are used in commercial products.
I just hope you understand
-
Of course. Good luck & thanks.
-
I have to ask, which connection components did you use, I see that query with oracle works, I had some troubles with executing query in Laz.
Please don't hesitate to start a forum thread about those troubles - if we can improve Oracle support in SQLDB, we'd be happy to...
My mistake, this problem has been reported and it's related to Lazarus 1.0.8.
Oracle 12g Express
NAME VALUE$
------------------------------ ----------
NLS_CHARACTERSET AL32UTF8
NLS_NCHAR_CHARACTERSET AL16UTF16
I am able to set SQLQuery.Active := true in the Object Inspector in Lazarus 1.0.6 / FPC 2.6.0.
This doesn't work in Lazarus 1.0.8 and up with FPC 2.6.2.
Thanks for looking into this issue.
-
My mistake, this problem has been reported and it's related to Lazarus 1.0.8.
Oracle 12g Express
NAME VALUE$
------------------------------ ----------
NLS_CHARACTERSET AL32UTF8
NLS_NCHAR_CHARACTERSET AL16UTF16
I am able to set SQLQuery.Active := true in the Object Inspector in Lazarus 1.0.6 / FPC 2.6.0.
This doesn't work in Lazarus 1.0.8 and up with FPC 2.6.2.
Ah, that looks like bug 24723: OracleConnection: ORA-01062: unable to allocate memory for define buffer
As I cannot reproduce that bug, it would help a lot if you could try on FPC trunk+Lazarus (say Lazarus trunk) and see if the bug is still present there. If you do so, please report your findings in the bug tracker...
I'd also be happy to try and respond on the forum though starting a different thread may be appropriate ;)
-
My mistake, this problem has been reported and it's related to Lazarus 1.0.8.
Oracle 12g Express
NAME VALUE$
------------------------------ ----------
NLS_CHARACTERSET AL32UTF8
NLS_NCHAR_CHARACTERSET AL16UTF16
I am able to set SQLQuery.Active := true in the Object Inspector in Lazarus 1.0.6 / FPC 2.6.0.
This doesn't work in Lazarus 1.0.8 and up with FPC 2.6.2.
Ah, that looks like bug 24723: OracleConnection: ORA-01062: unable to allocate memory for define buffer
As I cannot reproduce that bug, it would help a lot if you could try on FPC trunk+Lazarus (say Lazarus trunk) and see if the bug is still present there. If you do so, please report your findings in the bug tracker...
I'd also be happy to try and respond on the forum though starting a different thread may be appropriate ;)
@BigChimp
Hi, sorry to post here again, I just wanted to let you know that I ve tried on Lazarus 1.1, FPC 2.7.1, rev. 42538 and it's working okay :) I'll post detailed report on bug tracker soon.
@flamer0n
I've done some tests. I ve tried to connect to two Oracle servers.
The first one is Oracle 10g XE 10.2.0.1.0 and I connected and run queries without problems.
The second is Oracle Database 11g 11.2.0.3.0 and when I enter credentials I get this message:
Invalid ConnectionString: SQL Error: OCI ERROR ORA 28547: connection to server failed, probable Oracle Net admin error.
The solution was to copy file oraociei11.dll from bin folder of Oracle client 11 to system path or application base dir.
Now I can connect with same parameters, although I found problem when I tried to run query on several of the tables. I got this message:
SQL Error: OCI_ERROR: ORA-01406: fetched column value was truncated.
When I execute same script with other DB management systems, result is okay.
Dragan
-
@sin_dragan Thank you for testing it. Did you try to execute the same script in a dummy project with zeos connection and zquery ? I'll take a look into it to see if it's the libs' fault of the version that is shipped with lazsqlx or some kind of bug with zeos components. I also found here (http://www.dba-oracle.com/t_ora_01406_fetched_column_value_was_truncated.htm) that it was reported as ora bug and supposedly fixed in the ora version you tested.
thank you, I really appreciate it
-
@sin_dragan Thank you for testing it. Did you try to execute the same script in a dummy project with zeos connection and zquery ? I'll take a look into it to see if it's the libs' fault of the version that is shipped with lazsqlx or some kind of bug with zeos components. I also found here (http://www.dba-oracle.com/t_ora_01406_fetched_column_value_was_truncated.htm) that it was reported as ora bug and supposedly fixed in the ora version you tested.
thank you, I really appreciate it
Yes, I tried to execute from Lazarus 1.0.8/2.6.2 and 1.1/2.7.1 it gives me same error, Zeos was 7.0.5-stable and 7.1-alpha. Strange, but after several reconnects it goes okay but when I compile the application as soon as I start scrolling down the dbgrid it throws back same error.
After that I used in Delphi sample project with UniDac 5.0.1 components and it throws back Metadata error only after first connect, after disconnect and reconnect it's okay.
I thought that the data in the DB is faulty, it states varchar2 (30), when I connect with Database .Net I see that the maximum populated field size with text is 30.
Eventualy, I tried with SQLDB components (1.1/2.7.1) and it worked without a glitch! Nice 8-)
You're welcome, keep up the good work.
Dragan
-
Thanks! It is a very good tool.
Why don't you add Firebird support? You are using Zeos, it should be easy to add.
-
@joseme I'll probably add later more db platforms including Firebird. Yea it's easy with zeos components to add any db platform support, except some query/sp generations and table informations and table edit. That's not hard either, but requires a little bit more effort.
I'm soon to publish another version of LazSqlX with a new feature called Database Cloner, for copying database/tables/references from one db platform to the other db platform (within supported range of course, and for now it's mssql,mysql,oracle and sqlite). Some kind of very simple migration tool. First only table structures and keys with references. In later versions I'll probably add also data migration and other stuff...
I hope you enjoy it. Thank you.
-
3.17.2.1197 (New version)
Feature:
+ Added a feature called Database Cloner (*partially tested for all directions except others to oracle)
+ Ora libs shipped with setup are now of instantclient-basiclite-nt-12.1.0.1.0, which explains the doubled size of the setup
Fixes:
- last connection saved to temp (to avoid special permissions for running)
- running under special permission removed
- Fixed a bug where fields containing spaces caused an exception to occur when viewing table informations and/or adding table in query designer
- Fixed a bug where Run Procedure with GUI helper in procedureList wouldn't execute for Oracle, raising an exception.
* Known Issues:
Run Procedure for MySql (with GUI Helper) still doesn't work (the exception occurs in zeos dataset component, FetchOneRow function, so I'll wait for some fixes)
Requested version update at Softpedia, they'll probably add it soon, anyway here's download link:
Download:
https://sourceforge.net/projects/lazsqlx/files/Version%203.17.2.1197/LazSqlX_3.17.2.1197_Setup.exe/download
Thank you for suggestions.
-
It will be good if enable your application to connect to sqlite encrypted databases.
Allow choose the dll file and the parameter string of ZConnection component. See here:
http://zeoslib.sourceforge.net/viewtopic.php?f=25&t=1674&p=7637&hilit=sqlite+encrypt#p7637
thank you
-
3.17.3.1209
+Added Recent Connections Feature (up to 10 last connections used listed)
+Added Advanced properties for Connection (in connection dialog, you can specify custom library and enter custom connection properties)
-Bugfixes
Download at SourceForge (https://sourceforge.net/projects/lazsqlx/files/Version%203.17.3.1209/LazSqlX_Setup.exe/download)
-
@hrayon check out new version I just uploaded, and see if it can open sqlite encrypted DB, by specifying custom sqlite3.dll (that supports encryption) and password field to enter the password used to encrypt sqlite db. Leave password field empty to connect normally to sqlite db.
Thank you
-
Good news! Thank you @flamer0n! :)
-
@joseme
Firebird support added. It will be in the next version I publish.
thank you
-
LazSqlX New Version (4.0.0.1219)
+ Added Firebird support
- Bugfixes
Already requested to update the version in Softpedia, it will take a while there, but here it is in SourceForge
Download from SourceForge (https://sourceforge.net/projects/lazsqlx/files/Version%204.0.0.1219/LazSqlX_Setup.exe/download)
-
:) :) :) :) :) Thanks!
-
LazSqlX (4.0.0.1223) Linux Version Preview
Only binary included, no libs, so this version expects you to have let's say MySql,Sqlite,Firebird libs installed on your linux machine. This is first release for linux and is highly untested.
- Just fixed some critical bugs for linux version. Tried some simple stuff in MySql and Sqlite and it worked.
Download (https://sourceforge.net/projects/lazsqlx/files/Version%204.0.0.1223/LazSqlX_Linux_Bin.zip/download)
-
LazSqlX v4.0.1.1232
+ Allow zooming of text in editor while scrolling mouse wheel while ctrl is pressed
- Fix GenerateProcedure for SelectItem
- Fix procedure list in FireBird
- Fix Running Procedure with GUI Helper for MySql,Firebird,MsSql (right-click procedure name and then "Run")
*Known issues
- Procedures in Oracle cannot be executed
SourceForge:
Download (https://sourceforge.net/projects/lazsqlx/files/Version%204.0.1.1232/LazSqlX_Setup.exe/download)
-
LazSqlX (v4.0.2.1270) new version available for download
What's new:
- Data Importer (import data from delimited text file)
- Script Create Table
- Bug fixes
Download from SourceForge
https://sourceforge.net/projects/lazsqlx/files/Version%204.0.2.1270/LazSqlX_Setup.exe/download
-
I just discovered this DM Admin project & I'm very impressed! :D
Hats off to flamer0n for the good work. Nice to see a Linux version exists - an alternative to FlameRobin & TurboBird on Linux for a Firebird user like myself.
Looking forward to your publishing the source so we can all contribute (after you've removed your company's proprietary code, of course).
You still haven't added your applications to the Lazarus Application Gallery like BigChimp suggested. You ought to. It is very important so that we can show what one can do with Lazarus.
JD
-
sorry JD and others, I've been busy i just uploaded the source codes. Please don't laugh at me :), LazSqlx has been started as a very small util for executing queries only, than adding little by little stuff there over time, it grew a bit more (along with me), and as you can notice, code is not very good structured, no pattern followed or whatsoever, a bit of spaghetti :), some things unfinished yet, very few comments... anyway I just hope you guys take care of the rest.
The big size of the archive is because of libs of DB clients there, sorry;
Here is the download link from source forge:
https://sourceforge.net/projects/lazsqlx/files/Sources/LazSqlX_Sources.zip/download
Components Used:
- Zeos Db Components 7.1 Stable (3rd Party)
- lazMouseAndKeyInput (in Lazarus components list)
- lazDbExport (in Lazarus components list)
The rest are included by default in Lazarus IDE.
ps. I didn't add it to the project list of lazarus where BigChimp suggested because I forgot, sorry. I'm giving you the code (ok some stuff removed, but unnoticed) and please take care of the rest, of course who can and has will to do so, make it public on git or svn or whatever.
Thank you Lazarus community!
-
Flamer0n, thanks a lot for that. About spaghetti code etc: I think we've all done this... or are doing this between posting messages on the forum ;)
Thanks again!
-
ps. for Linux version to work, ListBox of tables must be changed to=> Style=lbStandard, (yeah I could have done it with compiler directives but I didn't), it's probably some bug, for linux only
-
Has anyone managed to compile sources successfully? Just curious...
-
@flamer0n
Has anyone managed to compile sources successfully? Just curious...
Yes I succeeded:
http://zeoslib.sourceforge.net/viewtopic.php?f=40&t=3795&p=25124#p25124 (http://zeoslib.sourceforge.net/viewtopic.php?f=40&t=3795&p=25124#p25124)
But I have a problem with the 64-bit Windows version.
At this building stops:
Forms\EditMemoFormU.pas(11,3) Hint: Unit "messages" not used in EditMemoFormU
DbInfo\AsSqlKeywords\AsSqlKeywords.pas(10,2) Warning: Illegal compiler directive "$STATIC"
DbInfo\AsSqlKeywords\AsSqlKeywords.pas(15,21) Hint: Unit "strutils" not used in AsSqlKeywords
Calling resource compiler "c:\codetyphon\fpc\bin\x86_64-win64\gorc.exe" with "/machine x64 /nw /ni /r /d FPC /fo .\DbInfo\AsSqlKeywords\AsSqlKeywords.res C:\lproj\LazSqlX_64\DbInfo\AsSqlKeywords\AsSqlKeywords.rc" as command line
Compiling resource C:\lproj\LazSqlX_64\DbInfo\AsSqlKeywords\AsSqlKeywords.rc
DbInfo\AsSqlKeywords\AsSqlKeywords.pas(161,1) Error: Error while compiling resources. Compile with -vd for more details. Check for duplicates.
DbInfo\AsSqlKeywords\AsSqlKeywords.pas(161,1) Fatal: There were 1 errors compiling module, stopping
Michal
-
If the .rc file is in a subdirectory of the .lpi file, it might be this bug:
http://bugs.freepascal.org/view.php?id=24483
-
@BigChimp
If the .rc file is in a subdirectory of the .lpi file, it might be this bug:
So that was it.
I copied resources files to .lpi directory and Windows-64 version builds and running.
Michal
-
Has anyone managed to compile sources successfully? Just curious...
Many thanks for open sourcing this. I've been offline for a few months. I'll be trying this out sometime over the next weeks, and am looking forward to it. I'm particularly keen to see how you use the Oracle Lite library, I'd love to bypass the need for Oracle Client installed.
The app I spend most of my time has similar technical requirements for yours. Yours is more geared around admin tasks, mine is extracting data from Master/Detail/(Detail) relationships from various databases. I'm hoping there's enough commonality that we can share code :-)
-
I just added LazSqlX to :)
Lazarus Application Gallery (http://wiki.freepascal.org/Lazarus_Application_Gallery#LazSqlX)
-
LazSqlX on Source Forge (http://sourceforge.net/projects/lazsqlx/)
v4.2.1
- Query Execution runs with SQLDB for MsSql,Oracle and Sqlite (except for Firebird and MySql). Expected result: Much more stability and improvement.
- Sqlite returns descriptive execution erros now (using sqldb)
-Guid fields are displayed correctly in a DbGrid when connected to MsSql,Oracle (using sqldb)
- some improvements and bugfixes in select query generation
- some improvements in autocompletion
- Query Execution now works as a thread
- A little bit of code refactorings
GUI:
-UI Tweaks
- TMemo field displays as text on DBGrid (thnx to a post here on forum)
- Grid PopUpMenu: SelectAll DBGridRows
- LoadingIndicator when queries are being executed (using TAnimatedGif)
-Syntax Check (using TSqlParser)
-
Great news :-)
-
Nice, thanks a lot!
- Query Execution runs with SQLDB for MsSql,Oracle and Sqlite (except for Firebird and MySql). Expected result: Much more stability and improvement.
Could you indicate why you didn't switch to sqldb for Firebird? No time/too much effort? Something else?
Anything I can do to help (if I can)?
-
Yes, I had a problem connecting to a Firebird-2.5 database using SQLDB (on Win7):
"IBConnection1 : DoInternalConnect : -unavailable database"
the thing is that Employee.fdb" exists, it's there and Zeos connects and runs queries against it without problems
-
Ok, I'd guess the connection string is wrong... but my crystal ball needs coffee, too ;)
I'd be happy to look at the code and see if I can get it going. I'll send you a PM.... thanks.
-
Thanks. I just found out that main library "fbclient.dll" wasn't in the directory, after I put it there it can connect. So, the next version lazsqlx will have Firebird that will work with SqlDb.
-
LazSqlx v4.2.2 (https://sourceforge.net/projects/lazsqlx/)
Changes:
-Query Execution with Firebird runs with SQLDB
-Bugfix: Autocomplete wouldn’t invoke when pressing “.” after table name or table alias.
-
Thanks a lot!
Some notes/remarks/issues:
- when installing into program files with Win 7, I get an error createeprocess failed error 740 (or something, sorry, from memory). Probably a permissions thing in the installer... you could perhaps remove the run exe from installer functionality entirely
- connected to Firebird db ok. Then, while connected, clicked File/Connect again which crashed the application.
Now going to actually use the program - the importer tool looks exactly what I need btw ;)
-
Hi,
Fiddled around some. Please find some remarks below in case they are useful.
Imported a ; separated text file using tools/import. ; was autodetected - nice!
- delimiter: there doesn't seem to be a way to choose the tab (ASCII 9) character or other low ascii characters as delimiter?
- end row was 1 while it was a large file. Tried to set it to 0, didn't work. Perhaps add an "Everything" option or something? (Note: pressing "validate" correctly popuplated end row with the max row number from the file, but the GUI is a bit confusing)
- Mapping: if first row as schema is deselected, perhaps show the field content of the field in question below the Field1 combobox. Or perhaps in the memo with field mappings? (Not much of a GUI guy) Makes it easier to choose/visualise.
- Sample line of the import file:
410680;"8255PE";82558069;8255;"PE";2;78;"even";"De Kolk";"Swifterbant";2431;"Dronten";303;"Flevoland";"FL";"52.5733977717603";"5.6500083564955";"172815.72730555555555555556";"509565.93941666666666666667";"postcode";"2014-04-10 13:20:28"
Unfortunately, the mapping only shows Field1 to 4 while there are many more fields in the line. Suggestion (haven't looked at the code): you could use http://wiki.lazarus.freepascal.org/CsvDocument for reliable import of CSV-type file
Thanks a lot for all your work - I have installed Zeos and am going to look at the source code next...
-
Thank you for your feedback BigChimp. I haven't done much testing, I'll look into DataImporter tool now, considering your suggestions.
-
Mmmm, was just busy doing the same. But it's your code, and you're probably much quicker.
In any case, please find attached my current version... was busy implementing csvdocument...
(csvdocument.pas to be placed in 3rdparty\csvdocument\)
-
Thanks! I need to get familiar with this component to see how it works and how to use it and I'll post any news here
-
Ok, had some other work, then got back to LazSqlx and I replaced the CSVDataset with CsvDocument as you suggested and did some testing and it worked good. Now, let's talk about GUI... I just want to know if this is ok:
- when the file being imported contains no column names (no 1st row definition), should I display the first data row cells as column names so the user can figure out what goes with what and do the mapping himself?
- I'm also thinking to get rid of "Validate" button, so that the event happens when user accepts the file to be imported
-
- when the file being imported contains no column names (no 1st row definition), should I display the first data row cells as column names so the user can figure out what goes with what and do the mapping himself?
Yes, that sounds great.
- I'm also thinking to get rid of "Validate" button, so that the event happens when user accepts the file to be imported
Mmmm... only problem: at the moment Validate populates the end line spinbutton with the maximum line number.
Perhaps allow users to enter 0 for last line number and modify import code accordingly.
Apart from that: good idea; it makes things more simple.
(However, I'm wondering how you read the file etc and provide the field mappings as that does depend on delimiter etc)
-
Mmmm... only problem: at the moment Validate populates the end line spinbutton with the maximum line number.
Perhaps allow users to enter 0 for last line number and modify import code accordingly.
Yes, I have to change it, spinedits will be limited to maxrows but also allow user to enter 0 on both.
(However, I'm wondering how you read the file etc and provide the field mappings as that does depend on delimiter etc)
After populating cmbSourceColumns and cmbDestColumns and user has finished mappings
Something like this:
{...foreach row}
for J := 0 to lstColumnsMapping.Count - 1 do
begin
SrcColumn:= TAsStringUtils.SplitString(lstColumnsMapping.Items[J], '=')[0];
SrcValue:=FCSVDocument.Cells[cmbSourceColumns.Items.IndexOf(SrcColumn),I];
DestColumnName:= TAsStringUtils.SplitString(lstColumnsMapping.Items[J], '=')[1];
if FDestQuery.FieldByName(DestColumnName).DataType <> ftAutoInc then
begin
if not FDestQuery.FieldByName(DestColumnName).ReadOnly then
FDestQuery.FieldByName(DestColumnName).Value := SrcValue;
end;
end;
{...}
-I'm trying to do some Autodetection of Delimiter reading first row of the file but it seems hard to make it smart, I'll check only for most common delimiters [; , #9 |]
-
Totally agreed.
-
uploaded v4.2.3.1343 (https://sourceforge.net/projects/lazsqlx/files/Latest/)
Changes
-DataImport tool improvements thanks to BigChimp for suggestions and CVSDocument
-GetFields (in MainForm) improved
-Zip Archive (apart from setup.exe), just in case you have problems with setup
Source (https://sourceforge.net/projects/lazsqlx/files/Sources/)
I know there are a lot of bugs that need fixing, I'm sorry for inconvenience.
-
This is an old problem in LazSqlX, I hope someone can help.
When new tab is created all components needed to run queries and display results are children of the new tab created. I want to free TabSheet when user clicks "Close Tab" to free memory, but it throws an exception (the moment I call tab.free) and I cannot trace it, so currently (as a workaround) I only make TabVisible:=False and I free children components , but not the TabSheet. Is there any solution to this? Thank you in advance.
-
I came across this a long time ago in another app and did the same fudge as you did (hid the created tab)
After a bit of twiddling, I found the reason for my Exception after calling .Free - I had failed to adjust the array via SetLength.
Here's my test unit code which may or may not help in your situation:
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
StdCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
PageControl1: TPageControl;
TabSheet1: TTabSheet;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ private declarations }
ExtraTabs:Array of TTabSheet;
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
Var i:Integer;
begin
i:=High(ExtraTabs);
ShowMessageFmt('High before create = %d',[i]);
Inc(i);
SetLength(ExtraTabs,i+1);
ExtraTabs[i]:=TTabSheet.Create(PageControl1);
ExtraTabs[i].Parent:=PageControl1;
ExtraTabs[i].Caption:='New Tab';
ExtraTabs[i].Visible:=TRUE;
i:=High(ExtraTabs);
ShowMessageFmt('High after create = %d',[i]);
end;
procedure TForm1.Button2Click(Sender: TObject);
Var i:Integer;
begin
i:=High(ExtraTabs);
ShowMessageFmt('High before free = %d',[i]);
If i >= 0 then
begin
ExtraTabs[i].Free;
SetLength(ExtraTabs,i);
end;
i:=High(ExtraTabs);
ShowMessageFmt('High after free = %d',[i]);
end;
end.
-
Hmmm. I've got similar code to you, and Tabsheet.Free works just fine for me... I note in my code I'm ensuring the Tabsheet isn't selected first (by setting PageControl.TabIndex to something other than the selected code), but I think I was only doing that to help reduce some flicker when the tabsheet was free'd.
I'm docking a form into the tabsheet and in my code, I free the tabsheet first, then free the form that was docked into the tabsheet.
Here's my code. oDock: TdckBase is just a TForm that knows it's going to live in a PageControl. I've then got several PageControls. pcMain is a static page control, each tabsheet in pcMain contains another PageControl, and this code removes the tabsheet from that inner PageControl.
Procedure TfrmMultiDock.DeleteDock(oDock: TdckBase);
Var
oPageControl: TPageControl;
Begin
// Ensure the correct TabPages are visible;
// First ensure the correct Category PageControl is visible
oPageControl := PageControl(oDock.Category);
pcMain.ActivePage := TTabSheet(oPageControl.Parent);
// Now ensure the active tab page ISN'T selected
oPageControl.TabIndex := Max(0, oDock.TabSheet.TabIndex - 1);
// Hide first to stop some flicker
oDock.Hide;
// Now free the dock and clear the reference..
oDock.Tabsheet.Free; // oDock.Tabsheet is just a reference to the TabSheet in oPageControl..
oDock.Free;
FDocks.Delete(DockIndex(oDock));
End;
You know what - I haven't looked at that code for several years now. I'm now asking myself how that last line doesn't AV. OK - except for that wierd last line, the code above successfully free's a TabSheet for me :-)
UPDATE: Brilliant - fixing that last line solved a long time intermittent issue I've had. I had been assuming the intermittent issue was in my code that loaded/saved the contents of FDocks...
@flameron: Thanks for asking the question :)
-
thank you. My case is similar. Since this is working fine for you, it should for me too. I probably forgot something :-[
-
I notice Windows Authentication isn't available for MSSQL, is this by design ?
After creating a new pword for SQL Auth, (forgot original), it connected straight away.
Once connected, with a list of tables on the left, the right side window is an inactive dataset. Clicking on it, with the table name at the top on a tab, you get an error (Unhandled Exception, Dataset Inactive).
Now I've finally managed to connect, I do like the look and feel of this.
Great work.
I'm running MS SQL 2014 on Win 7 Pro 64.
-
When I last tested Windows Authentication (two years ago) it wasn't implemented in either SQLDB or ZEOSDB (despite being documented in both - I vaguely remember there's an empty placeholder function in both libraries). I've lodged a ticket on the subject in the Zeos forum, and haven't heard anything. I also seem to remember you require a special build of the connection dll's (but yeah, when I tried that special build, nothing worked, which is when I dove into the code)
Hopefully in the past two years this has been addressed, and there's something else going on :)
UPDATE: I forgot to mention. Windows Authentication works just fine with the ODBC connection, I presume that's implemented in LazSQLx
FConnection.Params.Add('DRIVER=SQL Server');
FConnection.Params.Add('Trusted_Connection=Yes');
FConnection.Params.Add('DATABASE=' + FDatabaseName);
FConnection.Params.Add('SERVER=' + FServer);
UPDATE to UPDATE: Basically, please ignore this post. I shouldn't have answered (I was answering general code, not LazSQLx functionality), and I think this issue has been addressed in SQLDB... Sorry for the noise...
-
Thank you Zath. I never had a chance to test it on MsSql2014 though. Anyway, I'm currently changing the UI a little bit, so there won't be a visible grid for you to click on it, unless there's an active dataset attached to it (I guess this was the problem). Since the latest version doesn't display that message (i've commented that line for now), I guess you're using an older version;
I'm using SQLDB (previously Zeos) for MsSQL connection, neither of them had IntegratedSecurity option, and it doesn't seem to work passing it in the connection properties.
thanks
-
I just downloaded what I thought was the latest but obviously not !
Ver. 316 1 1145
-
This is an old problem in LazSqlX, I hope someone can help.
When new tab is created all components needed to run queries and display results are children of the new tab created. I want to free TabSheet when user clicks "Close Tab" to free memory, but it throws an exception (the moment I call tab.free) and I cannot trace it, so currently (as a workaround) I only make TabVisible:=False and I free children components , but not the TabSheet. Is there any solution to this? Thank you in advance.
Well from a quick look around I see this
tab := TTabSheet.Create(pgcMain);
tab.Parent := pgcMain;
tab.ParentWindow := Handle;
And at this point I have to ask why? what do you gain by setting the parrent to the page control and parent window to the form's handle? It is at least puzzling but not more than the following nugget
pnlTop := TPanel.Create(tab);
pnlTop.Name := 'pnlTop' + numbering;
pnlTop.Caption := '';
synMemo := TSynEdit.Create(pnlTop);
synMemo.Name := 'txtSyn' + numbering;
synMemo.Font := txtSyn0.Font;
synMemo.OnKeyPress := txtSyn0KeyPress;
synMemo.OnChange := txtSyn0Change;
synMemo.Options := txtSyn0.Options;
synMemo.RightEdge := txtSyn0.RightEdge;
synMemo.MouseOptions:= txtSyn0.MouseOptions;
pnlTop.InsertControl(synMemo);
again why? What is the reason you suddenly changed from parent:=pnltop to calling insertcontrol? What do you gain this way? TRy to rework that code to use the parent property as much as possible I am not sure what insertcontrol does in lazarus but in delphi it was needed for the form designer/streaming system only there is no need to call it for dynamically created controls that do not need to interact with the designer.
Please clarify the above questions while I install zeoslib to be able to compile sqlx and see what I can find
-
I don't know. When I was stuck there (tab.free exception or something else...i can't recall), I tried various tricks with/without parent, set pageControl property of tabsheet, insertcontrol etc and something remained as you see it for no apparent reason (test stuff, forgotten). Anyway, I'm currently making a custom page control with custom tabsheet, and possibly make the mainform code a little less messier, so the code from lazsqlx you posted will no longer be there (or that way). Thank you for your suggestions.
-
This is what happens when tab.Free is called: a SIGSEGV exception. As I said i'm refactoring and 'beautifying' the code a little bit, and if this happens even in the CustomPageControl/TabSheet i'm coding then I'll get back to it.
-
I'm using SQLDB (previously Zeos) for MsSQL connection, neither of them had IntegratedSecurity option, and it doesn't seem to work passing it in the connection properties.
No, SQLDB does allow you to use IntegratedSecurity/TrustedAuth/SSPI; see:
http://www.freepascal.org/docs-html/fcl/mssqlconn/tmssqlconnection.username.html
-
well this is cool! So i guess it should allow you to connect to mssql without typing any username or password, just as it is (if you type dbname manually - because db listing from mssql server still uses zeos)
-
Yes, or perhaps add a checkbox Trusted Authentication that greys out username/password on check etc.
But I'm not that much of a GUI guy :)
-
Is there a specific lazarus version I should be using? I'm getting messages for unsupported properties (txtSyn0.MouseTextActions for one) and also there seem to be undefined event handlers. TMainform raises 6 or 7 missing event handlers.
-
Latest release lazarus 1.2.4 with fpc 2.6.4
Ofc there may be empty methods and unneeded stuff but it's a work in progress, and we're fixing and improving it whenever we have time
-
Latest release lazarus 1.2.4 with fpc 2.6.4
Ofc there may be empty methods and unneeded stuff but it's a work in progress, and we're fixing and improving it whenever we have time
I don't mind empty methods I do wander how you compile it though for example the handler txtSyn0KeyPress does not exists in the form code at all but you do use it on the actnewtabexecute method to assign it to the new synedit created. I most of the errors I was getting was from lazarus substituting the zconnection and the rest of the zeos combonents with tform when I a opened them with out zeos installed reverted to the code in the zip because i saved the buffoon.
-
Does LazSqlX work with Postgres?
-
@taazz ok i can't talk about that now because I'm making huge changes to code in that form. As soon as I finish, I'll upload new sources then we can discuss. But I'm wondering why you can't compile sources, and why you didn't install ZeosDB...
@vfclists no, not yet. If Sqldb or zeos supports that, i will add that to lazsqlx...as soon as I finish some other stuff I'm working on
-
....
@vfclists no, not yet. If Sqldb or zeos supports that, i will add that to lazsqlx...as soon as I finish some other stuff I'm working on
Both sqldb and zeos support Zeos.
If I can make some time I will have a look at the sources.
-
@taazz ok i can't talk about that now because I'm making huge changes to code in that form. As soon as I finish, I'll upload new sources then we can discuss. But I'm wondering why you can't compile sources, and why you didn't install ZeosDB...
Zeos is already installed it was a temporary state until I finished setting up the ide. As I said after the problems with lack of zeos where solved I stumbled upon the missing handler which I thing I commented out already but other matters got in the way and I had to stop for tonight I'll continue again either early in the morning (4~5 o'clock) or tomorrow afternoon.
-
Attached is an edited mainFormU.pas file that when you create and destroy tabs will not raise any errors.
There are a couple of things that need to be taken care off but since this is going to be tossed away I'll just stop here and I'll give the new version a go when it is released.
EDIT:
forgot to add I'm still on 1.2.0 and fpc 2.6.2 so the SqlConn.close(true) was converted to SqlConn.Close;
as the parameter is not support of fpc 2.6.2 (didn't look close enough I'm guessing at this point).
-
It would perhaps be nice to have a publically accessible subversion/mercurial/git repository so people can more easily make contributions...
Depends of course on what you're comfortable with, flamer0n - looks like we've got quite a few requests and changes etc :)
-
It would perhaps be nice to have a publically accessible subversion/mercurial/git repository so people can more easily make contributions...
Depends of course on what you're comfortable with, flamer0n - looks like we've got quite a few requests and changes etc :)
personally I use git for all my external repos if available and svn for my internal this way I can have a single directory for both repos.
-
thank you guys, this is what I've been working (see attach) because I wanted to seperate some code from MainForm.
I found out in a New Test Project that when adding Tabs at runtime, and then add components with tab owner, it raises exception when inherited Destroy; is called.
I also I found out that TSynEdit must be created with an owner .Create(Self) otherwise , some keyboard keys won't work on TSynEdit (arrows,insert,home,end,pgup,pgdown and del works only on selected text) . The strange thing happens with TSynEdit when creating .Create(nil) and then on
.Free;
inherited Destroy; the inherited Destroy thinks SynEdit is not freed yet and then raises an exception because tries to free it again.
Ok, I think we need e source repository for LazSQLX :)
-
taazz thank you so much
-
Hello.
Version 4.2.3 1343 now gives me TMSSQLConnection :Error 0. when I try to connect using SQL auth /odbc to MSSQL 2014 Studio.
When connecting via SQL Server 2014 studio, you need the server name and login. Then, once connected, you are shown the database and any associated tables. Needing the table name at login assumes you know a table name and also that a table even exists.
-
lazsqlx sources on GitHub
https://github.com/flakron-shkodra/LazSqlX.git
-
zath I'm trying to reproduce that but I still can't on my Win7 pc, I also tried it on another Win8 machine but still connects to mssql :(
I can't find anything about that error neither here http://wiki.freepascal.org/mssqlconn nor anywhere online. Maybe someone else here on the forum can help us
-
lazsqlx sources on GitHub
https://github.com/flakron-shkodra/LazSqlX.git (https://github.com/flakron-shkodra/LazSqlX.git)
May I ask why not adding them in sourceforge instead?
-
May I ask why not adding them in sourceforge instead?
Because this was the fastest-easiest way for me. I just made github account for the first time, and made the first commit ever. So if I can link sf github to this I'd like to know how
-
As far as I am concerned, github is fine. What is the difference with sourceforge anyway? Another site? Something I'm missing?
The most important thing is that it is publically accessible...
-
There is nothing wrong with github I simple asked because you already have a project in sourceforge and instead of using it to add the code there, you wend to github. I don't mind what you will use, my smartgit client will work with any public git repo it just made me wander thats all.
Do you plan to use both sites or close the SF one?
-
Head, meet facepalm.
Facepalm, this is head.
@taazz: of COURSE. Sorry ;)
-
I was trying different settings to see if I could circumvent my MSSQLCon error.
I deleted the list of previous log in attempts then tried with the fields that remained populated.
This error, as a result, suggests the info isn't taken from the single fields but the stored list ?
-
Isn't that a named pipe connection string? Does the included dll support named pipes? HAve tried to connect using tcp/ip ?
-
This error, as a result, suggests the info isn't taken from the single fields but the stored list ?
Try using Port 1433 instead of Port 0.
Isn't that a named pipe connection string? Does the included dll support named pipes? HAve tried to connect using tcp/ip ?
Dunno about named pipes (never understood what they were), looks like a SQL Instance though, and the SQLDB documentation say they're supported. (untested by me though)
-
This error, as a result, suggests the info isn't taken from the single fields but the stored list ?
Try using Port 1433 instead of Port 0.
I did, no joy.
-
This error, as a result, suggests the info isn't taken from the single fields but the stored list ?
Try using Port 1433 instead of Port 0.
I did, no joy.
Can you try the IP address of your PC instead of the pc name? If it's running on your PC, try 127.0.0.1\SQLEXPRESS
-
This error, as a result, suggests the info isn't taken from the single fields but the stored list ?
Try using Port 1433 instead of Port 0.
Isn't that a named pipe connection string? Does the included dll support named pipes? HAve tried to connect using tcp/ip ?
Dunno about named pipes (never understood what they were), looks like a SQL Instance though, and the SQLDB documentation say they're supported. (untested by me though)
on tcp/ip there is no notion of 127.0.0.1\XXXXXXXXXX this is a named pipe a windows specific network protocol this translates in tcp/ip 127.0.0.1:1434 or something along those lines the server management for sqlexpress has a tool that allows to enable and disable the communication protocols, when first installed the express server is only accepting local connection using what is calls the shared memory method you have to explicitly enable the rest of the protocols including tcp/ip and there you can define the port to use too.
-
No, I can't connect at all using MSSQL with the latest build.
The older version was fine.
127.0.0.1 throws up lots of other errors.
-
The older version was using zeos (which uses ntwdblib.dll - but doesn't support unicode), and the latest uses SQLDB and TMSSQLConnection for sqlserver (using these libraries dblib.dll, libiconv2.dll).
As I said, I can't reproduce it, i even told some of my colleagues to install lazsqlx and connect to different mssql servers, but they all succeeded.
it could be some "phantom" prerequisite for dblib.dll.
As long as we can't find a solution for this, I'm thinking to make an option on connection form to choose between Zeos or SQLDB engine.
But as I said, Zeos connects to mssql but when table fields are of type nvarchar or ntext, it raises an exception because it doesn't work with unicode and GUID fields are all messed up, even the bytes of TField (guid which zeos recognizes it as TBlob) are all scrambled (zeos). This was the reason to switch to SQLDB.
-
As I said, I can't reproduce it, i even told some of my colleagues to install lazsqlx and connect to different mssql servers, but they all succeeded.
Out of curiosity, were all your tests connecting back to MS SQL installed as Default Instance, or were they to Named Instances? And either way, were they able to use the PC name as hostname, or did they have to fall back to IP address?
-
Using both hostnames and ipaddresses, named instances (such as ip\instancename) and default instances. Mssqlservers 2005,2008,2012
-
Does installing to D: rather then C: have any bearing on the issue ?
-
Installing what? Either SQL Server or lazsqlx: no, it should have no relevance.
Are you using dynamic ports (default) or a static port (e.g. 1433)? The connection code in lazsqlx may (I don't know, haven't looked at that) deal with either situation incorrectly...
-
It shouldn't but...
I don't know if dblib reads or writes to any file or needs extra permissions, lazsqlx writes only the recent connections to %temp% which should be ok with read/write permissions. Anyway, d: should be less protected than c: if OS files reside on c: (just a thought), but you can try to see if that makes any difference. You can also use the zip archive (without setup) and it should work as portable
-
Installing what? Either SQL Server or lazsqlx: no, it should have no relevance.
Are you using dynamic ports (default) or a static port (e.g. 1433)? The connection code in lazsqlx may (I don't know, haven't looked at that) deal with either situation incorrectly...
1) Installing LazSql.
2) Using MS SQL Studio 2014, ports aren't something I'm required to enter, so I assume dynamic. Currently the SQL server is on the same machine as LazSql. In my attempts to get this to work, I have used port 0 and 1433 as suggested. Neither seems to make any difference.
-
BigChimp may be right, when I switched to sqldb I forgot to handle the Port, but with Zeos was already handled. I guess in connection properties there should be specified the port number since the Sqldb connections don't have that in public properties
I honestly don't know about named instances. If I understand what @Taazz is saying, then you shouldn't have to handle ports with named instances - the named pipes they use handle that. But yeah - I'm unsure.
Default instances are easier. You set TMSSQLConnection.Hostname to hostname:port (so for instance 127.0.0.1:1433 should work to connect to a local server running a default instance)
-
2) Using MS SQL Studio 2014, ports aren't something I'm required to enter, so I assume dynamic. Currently the SQL server is on the same machine as LazSql. In my attempts to get this to work, I have used port 0 and 1433 as suggested. Neither seems to make any difference.
Oh. Here's a question for others. Do we know if the freetds dlls are able to connect to MS SQL Studio 2014? I've only really tested 2008 R2...
-
@Zath: yes, you're probably using dynamic ports.
http://www.freepascal.org/docs-html/fcl/mssqlconn/tmssqlconnection.hostname.html
"TMSSQLConnection specific: you can specify an instance or a port after the host name itself.
Instance should be specified with a backslash e.g.: 127.0.0.0.1\SQLEXPRESS. Port should be specified with a colon, e.g. BIGBADSERVER:1433
See http://www.freetds.org/userguide/portoverride.htm"
So you can either specify an instance or a port, but not both.
(AFAIR, using multiple instances depends on the sql server agent or browser something service which listens on udp 1434 and redirects clients to the appropriate (dynamic or static) port. But I may misremember).
-
This may be irrelevant but
EINOutError/Can not load DB-Lib client library "dblib.dll". Check your installation
Make sure you have all required dlls installed (e.g. dblib.dll, libiconv2.dll)
Make sure you have all required C/C++ runtime libraries installed that dblib.dll
Make sure the bitness (32 or 64 bit) of the dblib library and your compiled program match
What if it has smth to do with c++ runtime libraries (some version, potentially with a windows update, that freetds dblib is not compatible with)?
Zeos (with the ancient ntwdblib.dll) connects but
Sqldb doesn't.
To clear up this instance pipe, static dynamic port thing, just download a version 4.0x that uses Zeos, and see if it connects
-
2) Using MS SQL Studio 2014, ports aren't something I'm required to enter, so I assume dynamic. Currently the SQL server is on the same machine as LazSql. In my attempts to get this to work, I have used port 0 and 1433 as suggested. Neither seems to make any difference.
@Zath: What version of MS SQL Studio 2014 do you have installed?
http://msdn.microsoft.com/en-au/evalcenter/dn434042.aspx
I'm asking so I can find out what configuration tools you have available... Going on what @BigChimp has posted above, you may need to start certain services...
To clear up this instance pipe, static dynamic port thing, just download a version 4.0x that uses Zeos, and see if it connects
@Zath has already reported an earlier version connects OK, but yeah - I'm not sure which version...
Side note: I'm thinking that LazSQLx is getting to need it's own sub-forum :)
-
Well, ok, if this thread is getting out of shape or violating forum rules, we can do something about it, lock, remove etc i don't mind
-
I don't think it's violating any forum rules (do we have any?). What's going on here is similar to LazPaint and some other apps. I'm also finding this topic fascinating, so would hate for it be locked.
Just thinking that future people trying to search the forum for resolution connection issues are going to get lost in this topic. Perhaps you could have an "[Announcement] LazSQLx" style thread that you use when you make new releases, and we should move this conversation over to something like "LazSQLx SQLDB MS SQL Connection Issue".
Not sure though, I've never been involved in such a long thread before...
-
Well, ok, if this thread is getting out of shape or violating forum rules, we can do something about it, lock, remove etc i don't mind
I don't think it needs its own forum, but the threads should focus on specific issues and be titled accordingly
-
flameron, don't let my inability to connect to MSSQL detract from the main thrust of the program.
Later releases might resolve the issue anyway.
For the record, I'm using Express with Advanced Services (SQLEXPRADV).
-
Zath, I gave LazSqlX to some friends/colleagues to play with it. Yesterday one of them reported the same problem as you did. I went to his PC to see if I can find something unusual. Windows(7) updates were waiting to be installed (notification bubble). So, I asked him and he agreed to restart his PC, after that I tried again LazSqlx and it could connect to any MsSQL Server we have here. I'm not saying this your case too, but certainly one of 'those' cases. So I still don't know what to do about it.
-
version 4.3.1 (https://sourceforge.net/projects/lazsqlx/files/Latest/)
Changes:
- Select dbengine on connect (choose between SqlDb and Zeos - except for MySql which runs with Zeos only, for now)
Things i've noticed:
Zeos with sqlite: no descriptive errors;
Zeos with mssql: no unicode support;
Zeos with dbs that support guid fields: doesn't seem to handle it properly;
-
Good news on the release :-)
I was on the zeos forum the other day, and I note you were mentioned there. Zeos are under the impression that in fact it's sqldb that doesn't handle GUIDs correctly (note: I have no knowledge of this issue)
http://zeoslib.sourceforge.net/viewtopic.php?f=40&t=18581&sid=193cd18004db8d6b18281b7a3dd2e305#p34328
Also - looks like you're still using the ODBC icon for MS SQL. There's a kind of OK icon for this in the TMSSQLConnection component (though lord knows how you'd retrieve the original :-) )
-
Find attached an MSSQL specific 16x16 icon taken from my code Librarian (http://sourceforge.net/projects/codelibrarian/)
-
Find attached an MSSQL specific 16x16 icon taken from my code Librarian (http://sourceforge.net/projects/codelibrarian/)
Swiped for my own nefarious uses :-) Many thanks :-)
-
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
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;
-
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
-
v4.3.1.1365 (https://sourceforge.net/projects/lazsqlx/files/Latest/)
- 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
-
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
-
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
-
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.
-
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?
-
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 :)
-
this is the message I get when using Zeos on Mssql
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
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...
-
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.
-
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 (https://sourceforge.net/projects/lazsqlx/files/Latest/LazSqlX_Setup.exe/download)
edit: Link fix
-
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 (http://=https://sourceforge.net/projects/lazsqlx/files/Latest/LazSqlX_Setup.exe/download)
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.
-
Sorry for broken link
-
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...
-
Any news on this flamer ?
-
Small bug seems to be present in connection dialog for Firebird: the tedit for database server does not appear so you cannot specify a server (only a database and port)
Additionally, you could remove all .ppu, .o, backup files from the repository (git delete or something) as they are automatically generated by the compiler anyway...
This will cut down on diffs etc.
-
(Just wanted to vent - solutions welcome of course)
Been having huge problems debugging lazsqlx.
First used laz trunk/fpc trunk; decided to move to laz trunk/fpc 2.6.4 to avoid potential issues with temporarily bad code.
First changed project options manifest permission level from As Administrator to As Invoker otherwise gdb cannot attach to process and/or lazsqlx gui does not show
Then set breakpoints and tried to run. GDB complained about "cannot insert breakpoint" => found an earlier post and workaround by Martin: http://forum.lazarus.freepascal.org/index.php/topic,20066.msg115300.html#msg115300 => use external linker instead of internal.
Did that, then started. Now I get this error @?#$??@
LazSqlX.exe - Entry Point Not Found
The procedure entry point SwapBuffers could not be located in the dynamic link library opengl32.dll
Why (and where) is LazSQLX messing with opengl?
Edit: searching a bit seems to indicate it's actually Windows gdi32 that calls opengl swapbuffers...
-
Unfortunately I have no clue. I don't remember I ever needed to use it in Lazsqlx. I scanned the import segment in exe and there doesn't seem to import opengl32, only gdi (at least statically). Could it be that [Enabled DPI Awareness for Vista+] in project options has something to do with this?
Edit: I searched the sources for any accidental use of gl,glu,glut,glext (I don't know if any other unit loads "OpenGL32.dll") but nothing found in LazSqlX sources.
-
One would expect GDI to be directx based.
-
@flamer0n: thanks; disabling dpi awareness does not change anything.
One would expect GDI to be directx based.
It apparently isn't here if I understand e.g. this
http://stackoverflow.com/questions/20645706/why-are-functions-duplicated-between-opengl32-dll-and-gdi32-dll
correctly.
-
It apparently isn't here if I understand e.g. this
http://stackoverflow.com/questions/20645706/why-are-functions-duplicated-between-opengl32-dll-and-gdi32-dll
correctly.
[/quote]
That is for OpenGL and GDI interoperation, IOW to be able to render opengl on GDI handles. (read anything but full screen). IOW that is opengl -> GDI not GDI -> opengl.
-
Sigh.
Search in Lazarus sources on SwapBuffers gives only opengl related units (and fpvectorial, customdrawn android, OSX carbon).
FPC sources: opengl related units, ptc, sdl some OSX stuff and also jwawingdi.pas - but that apparently isn't called from Lazarus anyway (see above)... and
windows func.inc
function SwapBuffers(DC:HDC):WINBOOL; external 'gdi32' name 'SwapBuffers';
... but as the Lazarus search above doesn't give any relevant results this isn't called either I suppose...
Testing on Win XP virtual machine doesn't give this error but this instead:
LazSqlX - Entry Point Not Found
The procedure entry point ConvertThreadToFiberEx could not be located in the dynamic link library kernel32.dll
Edit: MSDN indicates this function is Vista+ so not surprising
Ran depends.exe on XP on the image which did show an opengl dependency IIUC... IIUC, swapbuffers is needed but cannot be found either...
See https://bitbucket.org/reiniero/fpc_laz_patch_playground/downloads/lazsqlx_depends.txt
-
That is for OpenGL and GDI interoperation, IOW to be able to render opengl on GDI handles. (read anything but full screen). IOW that is opengl -> GDI not GDI -> opengl.
OK thanks
-
... and the only place in Laz or FPC where ConvertThreadToFiberEx occurs is in FPC's jwawinbase.pas...
Strange?!?
-
Wierdliness. On the surface, none of this makes sense.
In an earlier post you mentioned .o and. ppus were in the project. Hate to ask the bleeding obvious, but did you try a clean directory first?
-
Dunno. At some point yes. But can't remember if I did that before or after enabling the external linker.
-
@BigChimp: I'm not seeing any issues at all. Well none that I wasn't expecting...
I downloaded the code from https://github.com/flakron-shkodra/LazSqlX.git (chose Clone in desktop)
I already had Zeos installed (Zeos Trunk, whatever version that is). Run - Run (wanted to see what happened out of the box) (Note: I did nothing with Project Options)
Two exceptions, both related to the fact that I didn't have my compile folder populated with the required files.
First was an exception in TAnimatedGIF. Application handled the exception and allowed me to proceed (fair enough, a missing animated GIF shouldn't be a showstopper, but I bet this was your graphics link...), so I went to connect to a database. The second exception I was anticipating and was raised relating to missing ms sql dll.
Exited the Application. Put a break point in MainFormU FormCreate. Run - run. Breakpoint correctly reached.
I note that the project is being actively worked on by @Flameron. Maybe your copy was stale? Try getting latest, see if that does the trick...
UPDATE: A thought occurred relating to the .o/.ppus shipped with the code. I've now cleaned directories, and built all from scratch. Still no issues and breakpoints working fine...
Alternatively, it's the build environment somehow. I did my testing with Laz Trunk/fpc Trunk. I don't have Laz Trunk/fpc 2.6.4 configured anywhere. If you get latest and that still doesn't work, I'll use that fantastic tool fpcup and get me a Trunk/2.6.4 setup and see what happens :-)
-
Yes, things may well be corrupted here. But why (as in: it shouldn't happen). I'm first going to have a quick look at whether I can see what libraries the linker wants to link in to see if there's anything odd there.
Could you try testing setting the linker to the external linker by setting -Xe in project options/other and see if debugging/running is ok?
-
Bingo: with the external linker (-Xe), passing --verbose to the linker, I get this output:
...
attempt to open C:\development\fpc264\units\i386-win32\winunits-jedi\jwawinuser.o succeeded
C:\development\fpc264\units\i386-win32\winunits-jedi\jwawinuser.o
attempt to open C:\development\fpc264\units\i386-win32\winunits-jedi\jwawinbase.o succeeded
C:\development\fpc264\units\i386-win32\winunits-jedi\jwawinbase.o
attempt to open C:\development\fpc264\units\i386-win32\winunits-jedi\jwawingdi.o succeeded
C:\development\fpc264\units\i386-win32\winunits-jedi\jwawingdi.o
attempt to open C:\development\fpc264\units\i386-win32\winunits-jedi\jwawinnt.o succeeded
C:\development\fpc264\units\i386-win32\winunits-jedi\jwawinnt.o
attempt to open C:\development\fpc264\units\i386-win32\winunits-jedi\jwawintype.o succeeded
C:\development\fpc264\units\i386-win32\winunits-jedi\jwawintype.o
attempt to open C:\development\fpc264\units\i386-win32\winunits-jedi\jwantstatus.o succeeded
C:\development\fpc264\units\i386-win32\winunits-jedi\jwantstatus.o
...
So it looks like those jedi units get included somehow... and called?!?
I'll copy my local changes, pull lazsqlx from git, and copy back my local changes... see what happens then.
-
Yes, things may well be corrupted here. But why (as in: it shouldn't happen). I'm first going to have a quick look at whether I can see what libraries the linker wants to link in to see if there's anything odd there.
Could you try testing setting the linker to the external linker by setting -Xe in project options/other and see if debugging/running is ok?
I get the same as you.
This is the first time I've ever tried running with an external linker. Are you sure this functionality is working generally?
LazSqlX.exe - Entry Point Not Found
---------------------------
The procedure entry point SwapBuffers could not be located in the dynamic link library opengl32.dll.
During application load, LazSQLx tries to display an animated GIF (called Loading.gif). (Have a look in AnimatedGIF.pas). At first I thought the exception was due to the GIF not being in my compile folder, but on closer look, it's a resource shipped with the exe, the file exists, but the header isn't recognised by TGraphic which is why we've never seen that GIF before... The exception is handled... Bet you that's the source of the error.
It's a shame that animated GIF isn't working, there's some fairly thorough and extensive code in Animated GIF, including a complete loader...
(And while LazSQLx itself doesn't directly call jwawinuser, bet it's got something to do with fpc and it registers a filetype with TGraphic... (Random Guess))
-
Could you try testing setting the linker to the external linker by setting -Xe in project options/other and see if debugging/running is ok?
Before there was an internal linker, an external linker was used. On other platforms, it is still used (see thread in fpc-devel from me on that subject).
So it had been working fine at some time at least.
-
Fair enough. I don't see why it isn't working then.
I've found how jwawinuser is linked into the app though. Through MouseAndKeyInput, which uses JwaWinUser which in turn uses jwawinuser. (Idiot last part of sentence, please ignore :-) )
-
OK, I've got External Linker working.
Remove LazMouseAndKeyInput from Project Dependencies
Hit Compile. Work your way through the errors. 99% of them are simply Uses that look like they can be removed.
When you get to LazSQLXCtrls.pas, comment out the following code.
//case key of
//VK_OEM_PERIOD:
// begin
// s:='';
//
// KeyInput.Apply([ssCtrl]);
// try
// KeyInput.Press(VK_SPACE);
// finally
// KeyInput.Unapply([ssCtrl]);
// end;
//
// if Assigned(FOnLastWordChanged) then
// FOnLastWordChanged(s);
//
// end;
// VK_OEM_COMMA: KeyInput.Press(VK_SPACE);
//end;
After that, the app at least builds and runs and debug etc works.
What damage I did getting it this far... :-)
My instincts is that the Query Designer used to use JEDI MouseAndKeyInput, so perhaps only that is the affected bit...
Hopefully you get this working with the internal linker, and you don't need to do the above hack.
-
Yep. Meanwhile, from my end, got latest lazsqlx & compiled with FPC 2.6.4, laz trunk (regular internal linker). Seeing the same animated gif header exception as you.
Running the application stand alone does not give the opengl crash anymore...
Re keycode: seems its trying to replace . with Ctrl-Space - for variable completion I suppose - e.g. in Table.FieldName? Just guessing. May be better solved by setting a flag and testing for that flag in the code completion part (if any)?
For now, I'm going to focus on getting my file import code up to shape so I can provide a patch to flamer0n... and let's see what his opinion is regarding this mouse and keyboard stuff. I'd be happy to work on that next.
Thanks for all the help!
-
What IS this? Have I attracted some bad juju or something?
Debugging my data importer form changes, I get a SIGSEGV stepping through this code:
function TDbConnectionInfo.ToZeosConnection
...
if FDbType = dtOracle then
... fdbtype exists and is dtFirebirdd.
... next run the sigsegv is a couple of lines below that in an equally innocuous piece of code.
Argh!
Why on earth can that code create a SIGSEGV?
I think I'm giving up on this for a while and try and clean up my entire Laz/FPC installs, sacrifice a chicken facing South, and drink some coffee...
-
What IS this? Have I attracted some bad juju or something?
Debugging my data importer form changes, I get a SIGSEGV stepping through this code:
function TDbConnectionInfo.ToZeosConnection
...
if FDbType = dtOracle then
... fdbtype exists and is dtFirebirdd.
... next run the sigsegv is a couple of lines below that in an equally innocuous piece of code.
Argh!
Why on earth can that code create a SIGSEGV?
I think I'm giving up on this for a while and try and clean up my entire Laz/FPC installs, sacrifice a chicken facing South, and drink some coffee...
I'm betting that the external linker (or debug information) is the one to blame try to ignore what ever the IDE shows you and open the call stack window (ctrl+alt+S) and go from there try to find the first line of code inside SQLX application in the stack and see what you can surmise from that.
PS.
You never make any sacrifices facing south, you get the best results facing east or west depending on your religion (Christians prefer east), that might be your problem try again after you have sacrficed something better than a chicken facing east (Christians prefer lambs).
-
I'm betting that the external linker (or debug information) is the one to blame
No, I'm not using the external linker. See post above my last one.
try to ignore what ever the IDE shows you and open the call stack window (ctrl+alt+S) and go from there try to find the first line of code inside SQLX application in the stack and see what you can surmise from that.
That shows basically nothing (some line with the infamous question marks).
You never make any sacrifices facing south, you get the best results facing east or west depending on your religion (Christians prefer east), that might be your problem try again after you have sacrficed something better than a chicken facing east (Christians prefer lambs).
Good advice! I'll see what I can do ;)
Edit: how many pigeons equal one lamb?
-
You never make any sacrifices facing south, you get the best results facing east or west depending on your religion (Christians prefer east), that might be your problem try again after you have sacrficed something better than a chicken facing east (Christians prefer lambs).
At uni nothing worked until we'd sacrificed a chicken sandwich. As I've grown older, I see now this was stupid childish wish fulfillment.
Widdershins is the real truth! You need to turn widdershins 4 times, or it's all to naught... (Or call one of the Elder Programmers over to see why some code doesn't work. It ALWAYS works when they're around...)
-
Widdershins is the real truth! You need to turn widdershins 4 times, or it's all to naught... (Or call one of the Elder Programmers over to see why some code doesn't work. It ALWAYS works when they're around...)
Mmm. I get seasick, so let's try the other way.
Have set debugger project options to -g -godwarfsets2; could also be -gw2 for dwarf (default is -g, stabs)
Using zeos testing
Attached form .pas & lfm to replace existing; fileimport.pas goes into UtilClasses.
Tried on laz trunk+FPC trunk; now get better working stack trace - perhaps the problem is in Zeos as that is the last line hit.. Pfff.. Would appreciate a look from one of you Elder Programmers, thanks ;)
Edit: Mike caught an error of mine: add
if not(assigned(FDestQuery)) then
FDestQuery := TZQuery.Create(nil);
assert(assigned(FDestQuery));
before
FDestQuery.Connection := FConn;
... blush ....
Still crashes though.
-
Would appreciate a look from one of you Elder Programmers, thanks ;)
Sorry - we investigated virtualising an Elder Programmer several ways over several years. Nothing worked consistently. The Elder Programmer first has to mumble about does he really need to come over, then he actually has to grumble his way over and stare pointedly at you. And of course, at this point the code works - no matter how badly it was AV'ing prior to the call.
Oddly enough. You don't always need an Elder Programmer. Turns out, Gavin will do nicely. We only had the one Gavin though, so were unsure if the phenomena was specific to him, or Gavin's in general...
Would appreciate a look from one of you Elder Programmers, thanks ;)
What? Oh that again. Right, mumbling and grumbling's out of the way now, let's have a look... I'll get back to you...
-
Hah. Your post worked - just invoking Gavin or The Elder Programmer gave the inspiration:
... Edit: nah, that was Zeos ignorance speaking I think...
Come on over, you grumbling bearded one!
-
try to ignore what ever the IDE shows you and open the call stack window (ctrl+alt+S) and go from there try to find the first line of code inside SQLX application in the stack and see what you can surmise from that.
That shows basically nothing (some line with the infamous question marks).
That is the trademark of no debug information which in turn it means that you either did not enable the "create debug information" or that the clean up failed and you are still using non debug units.
when I say the "clean up failed" I do include the chance of double .ppu/.o etc files on different directories and picking up the wrong one when linking.
You never make any sacrifices facing south, you get the best results facing east or west depending on your religion (Christians prefer east), that might be your problem try again after you have sacrficed something better than a chicken facing east (Christians prefer lambs).
Good advice! I'll see what I can do ;)
Edit: how many pigeons equal one lamb?
well if you go by the weight a lamb weights around 80Kg a pigeon weights 200grams or something along those lines add an other 20Kg on the mid weight of the lamb for the innocent difference (lamb being the most innocent aka clean animal) and you have an answer but keep in mind that the innocent difference is just an estimation at this point, I do not know if they will be accepted instead of the lamb and depending on the size of the problem one lamb might not be enough. :P
-
try to ignore what ever the IDE shows you and open the call stack window (ctrl+alt+S) and go from there try to find the first line of code inside SQLX application in the stack and see what you can surmise from that.
That shows basically nothing (some line with the infamous question marks).
That is the trademark of no debug information which in turn it means that you either did not enable the "create debug information" or that the clean up failed and you are still using non debug units.
Or the sigsegv messed up the debug info in memory...
Edit: or an FPC bug that messes up the debug info in case of mixed stabs and dwarf exists (e.g. in a package in Lazarus or LCL). There used to be one, don't know if it's closed already....
Edit2: However, did a clean & build all, set a breakpoint before the crash. Looked at call stack: fine. Continued to crash, looked at call stack
#0 ?? at :0
#1 endthreadex at :0
#2 ?? at :0
#3 ?? at :0
#4 ?? at :0
threading related!?!
Edit3: )(*@#$)(*()@*%*@% using FPC 2.6.4+new Firebird embedded dll to connect to remote db=> gives problems because Firebird devs changed code which used to work. Workaround is in trunk but not 2.6.x. Perhaps that's relevant...=> replacing with old Fbembed.dll version 2.5.0 works!!!!!
Thanks guys... on to the next problem
-
Edit3: )(*@#$)(*()@*%*@% using FPC 2.6.4+new Firebird embedded dll to connect to remote db=> gives problems because Firebird devs changed code which used to work. Workaround is in trunk but not 2.6.x. Perhaps that's relevant...=> replacing with old Fbembed.dll version 2.5.0 works!!!!!
@flameron has already provided all the required lib files in LazSQLx\Windows_Libs. I see fbclient25.dll is in that collection :-)
-
Why on earth can that code create a SIGSEGV?
Any first field reference in a method can crash if the instance is not allocated or corrupt. If you typecast any pointer to a class and then run methods on it, chances are the crash behaviour will look like this. This is no different from Delphi btw.
And keep in mind that assigned() is only a test for zero, not general validity.
-
@flameron has already provided all the required lib files in LazSQLx\Windows_Libs. I see fbclient25.dll is in that collection :-)
Yes but AFAIR fbembed.dll is searched first. I've got a systemwide install in my path... so that's why I copied another fbembed.dll...
-
Why on earth can that code create a SIGSEGV?
Any first field reference in a method can crash if the instance is not allocated or corrupt. If you typecast any pointer to a class and then run methods on it, chances are the crash behaviour will look like this. This is no different from Delphi btw.
And keep in mind that assigned() is only a test for zero, not general validity.
Yes got it thanks.
-
Thanks for all the help everyone.
Improvements/fixes
- Mike.Cornflake fixed memory leaks
- cosmetic/layout
- File import auto mapping of field names; less memory use for large file import
Git patch (hope I did it right) - attached
All source files: https://bitbucket.org/reiniero/fpc_laz_patch_playground/downloads/LazSqlX_memleak_import2014_10_22.zip
-
Wow, so many posts n replies! Thank you guys!
Just pushed the changes to github LazSqlX (https://github.com/flakron-shkodra/LazSqlX)
-
Thanks a lot ;)
Flamer0n, do you mind if I try to remove the Jedi mouse and keyboard dependency in the code?
-
BigChimp no I don't, it's just the autocomplete won't be invoked after pressing "." after a table name or alias, but user must press ctrl+space which is not a big deal. Maybe it was lame simulating ctrl+space to invoke the autocomplete but I didn't know how else to do it
-
Ok. I'll see if I can find another way...
-
This is a really nice project. Good job!
-
Well, after reading through all these latest posts, it's like you're all Elders and Gavins to me but it's good to see things are getting resolved as this is a very useful project for me.
On another matter, what happens if it's mutton dressed as lamb ? How many pigeons would that be equivalent to and are they wood pigeons or town pigeons because wood pigeons are more like chicken in size anyway !
-
On another matter, what happens if it's mutton dressed as lamb ?
:)
Well, I like mutton. It's got a nice, robust flavour. To each his own, of course ;)
Re the pigeons - definitely town pigeons in my case...
-
Ok, with thanks to martin_fr I think I've got the code completion stuff sorted. Now going on fixing my own fileimport code that is skipping records/fields <blush>... as well as some miscellaneous fixes/improvements as I go along.
I'll send an ehm... carrier pigeon when I'm done ;)
-
Ok, done. Turns out it is rather easy to generate a patch set from local commits in git:
git format-patch -M origin/master
A zip with patches that:
* Fix import skipping data (sorry, my fault)
* Improves import GUI while importing
* Removes mouse and keyboard unit dependency for sql editor (thanks Martin_fr)
* Cosmetic fixes
* Unifies debug format to dwarf2 with sets as stabs is very ancient and not very informative
* Small code fixes; please see patch description for details
* Removes binary files from repository that should not be there (e.g. .dcu files)
Download
https://bitbucket.org/reiniero/fpc_laz_patch_playground/downloads/PatchesFixImportRemoveMouseKeyboard.zip
-
thanks to everyone for helping
Just made a minor change on key handling:
*vk_oem_period handling left in OnKeyUp and
*ssCtrl+vk_space handling moved to onKeyDown
reason: "." has to be inserted before autocomplete happens but in case of ctrl+space the autocomplete first should be executed;
git is up to date
-
currently working on new editForm for table data. It will be generated at runtime according to table properties (field types,references to other tables). Made some new dbcontrols for that etc/
-
Thanks a lot! Good luck with the form.
-
Congratulations for the program. I can see it's a lot of work. I've tested in on Oracle and it is simple to connect.
I've noticed a bug: The columns order of a table, shown on the Table Info Form, is not always right (In Oracle).
-
Thank you very much Edson.
The columns are retrieved from Zeos' TZMetadata component (by specifying .MetadataType:=mdColumns). There's a TTableInfo object filled with relevant info (fields,pks,fk etc) so the columns are processed in the same order as TZMetadata gives them. Of course there could be errors in the process but those errors who appear only sometimes are pretty hard to catch...at least for me
Btw LazSqlX has a lot of bugs,waiting to be found yet :-[
Thanks
-
Well I haven't worked with Zeos, but I have worked with Oracle and I see that the order the columns appear is a tipical query to the DB dictionary, without consider the order column. It's a typical error. Maybe a Zeos bug.
Another detail, is that the columns of a Oracle table appear always, like PK. Maybe another Zeos peculiarity.
Oracle is a very special DB. And developing for Oracle is always hard.
I will check your code and see if I can contribute in something. Currently I'm developing some similar but just for Oracle.
-
Now that you mentioned PKs I just checked and saw that I made an exception for oracle only:
if FDBinfo.DatabaseType=dtOracle then
dsMetaData.MetadataType:= mdBestRowIdentifier;
while for other DBs is
dsMetaData.MetadataType:=mdPrimaryKeys;
As far as I can remeber, for Oracle mdPrimaryKeys would return nothing but mdBestRowIdentifier returned PKs (at least for some cases I checked in a DB)
-
Definitely it is not working in Oracle, at least not on my Oracle 10g.
I have a table with no Primary Keys, nor indexes, and all the columns appears as PK. The same for other tables.
I don't know if someone else have the same problem.
-
Well that explains a little why are all columns treated as PKs, because there's not a single pk, and the best identifier for a row is all columns.... Maybe i should get pks another way
-
I use querys to the dictionary for to get the table info. I don't know if it's possible for you to do that.
Maybe it would be better, not to show PK, for Oracle tables, until find a better way.
Another observation (always for Oracle): The columns for the indexes, are not shown on the Table Info Form. A little detail.
-
LazSqlX 4.5.0.1436
-New Feature: Open table as Form (DbInfo\AsDbFormUtils.pas)
-TableInfo is now TOwnedCollection and all items used are of TCollectionItem (removed FGL usage ) (DbInfo\TableInfo.pas)
-Changed TableInfoForm to DesignTableForm (Forms\)
*fixes
-when filling comboBox on CreateIndex dialog (EditIndexForm.pas)
-display message (not grid) when executing query is not of type select (LazSqlXCtrls.pas)
-when using SqlDB, [delete] in dataset wasn't commiting changes to db (LazSqlXCtrls.pas)
-fix an error in autocomplete (IndexOutOfBound when list was empty and enter was pressed)
-fix Unhandled errors were not being shown (MainForm.AppProperties)
source https://github.com/flakron-shkodra/LazSqlX
build https://sourceforge.net/projects/lazsqlx/files/Latest/
-
v4.6.0.1483
GUI:
-Query result printing ability
-AsDbForm printing (with the ability to show/hide grid columns as you want them to appear in lazReport)
-FindReplace dialog
-MainMenu Search item added for Find&Replace dialogs
-RunProcedure dialog now returns text and excecution goes through active tab
-Trigger info can now be viewed in DesignTable
Code:
-A lot of code refactorings all over the project
-Everything should work with either sqldb or zeos depending on main connection
-Metadatas are now retrieved through classes that implement IAsDbMetadata, depending on the database type
-Fix: Find Dialog
-Fix: DataImporter's Import was always true, even if failed
-Other minor fixes
source https://github.com/flakron-shkodra/LazSqlX
build https://sourceforge.net/projects/lazsqlx/files/Latest/
-
Thanks, flamer0n!
-Fix: DataImporter's Import was always true, even if failed
*cough* embarrassed grin ;)
-
BigChimp, it was just not showing the error if any, the import was functioning normally; not a big deal :)
-
Sure, it's just that I don't like loose ends ;)
-
For some reason changes were not committed to git-hub. I just did that again and checked and sources are up-to-date now. Sorry.
-
v.4.6.2.1494
-Added Load/Save Session (Query History)
-Saves queries of tabs when disconnecting from server or closing LazSqlX and reloads them on connect
-Added Clean Session History on main menu under File
*previous
-Fix QueryDesigner: drag&drop from field of one table to a field in another table was causing app to hang
-Fix Find&Replace Dialogs were accessible even after disconnect thus ‘causing access violation when used because of no activetab was available
Binaries (sf doesn't let lazsqlx to be uploaded so temporary here on box. I guess I'll stop using SourceForge in the near future)
https://app.box.com/s/coxb183sxu4um2edb85z
Sources
https://github.com/flakron-shkodra/LazSqlX/
-
v.4.6.3.1515
-Refactorings; One connection used everywhere (hopefully ::))
-Performance tuning
-Bugfixes
Binary
https://sourceforge.net/projects/lazsqlx/files/Version%204.6.3.1515/
Source
https://github.com/flakron-shkodra/LazSqlX
I'll take a break for a while :)
-
v.4.6.3.1519
-Bugfixes: After running a query multiple times repeatedly,it threw an unhandled exception
previous
-BugFix ConnectionForm: When server couln't be found, unhandled exception occured in listing databases
-Printing query result now displays from tablename as report title when possible instead of tab caption
https://sourceforge.net/projects/lazsqlx/files/Version%204.6.3.1519/
-
v4.6.3.1520
-A memory leak fix in TAsTableInfo.Add(-,-): pks list wasn't being freed
-Handle ShowEditForm (which creates a AsDbForm for the selected table) in MainForm in case something goes wrong
-Implementations of IAsDbmetadata tweaked for all dbtypes.
-Fix for SQLDB's TMSSQLConnection "Error 20019 : Attempt to initiate a new Adaptive Server operation with results pending" by setting TAsQuery.FQuery.PacketRecords:=-1
http://sourceforge.net/projects/lazsqlx/files/Version%204.6.3.1520/
-
v4.6.3.1522
-Bugfix: the main dbInfo on mainform was being passed accidentally as reference in RecentConnections.
-Bugfix: MySql list databases on connection form wasn't working properly.
-Bugfix: using sqldb: When writing an sql statement on query tabs (that alters structure or data such as create,drop,alter,insert,update etc.) the transaction wasn't commiting changes to db
-Other bugfixes
https://sourceforge.net/projects/lazsqlx/files/Version%204.6.3.1522/
-
This is getting boring maybe for everyone but ... just when I think I'll take a little break from lazsqlx I find some ugly bugs that I can easily fix them and I want to make sure the latest build won't be very "frustrating" when someone uses it (if there's someone else except myself that uses it :) )
v4.6.3.1523
-Fix: DataImporter was broken after refactorings
-Fix: Preview Image fields on DblClick on queryTab result grid didn't work
-Fix: there was a memory leak in FileTypeDetector (used for Blob field filetype detection and preview)
https://sourceforge.net/projects/lazsqlx/files/Version%204.6.3.1523/
-
This is getting boring maybe for everyone but ... just when I think I'll take a little break from lazsqlx I find some ugly bugs that I can easily fix them and I want to make sure the latest build won't be very "frustrating" when someone uses it (if there's someone else except myself that uses it :) )
v4.6.3.1523
-Fix: DataImporter was broken after refactorings
-Fix: Preview Image fields on DblClick on queryTab result grid didn't work
-Fix: there was a memory leak in FileTypeDetector (used for Blob field filetype detection and preview)
https://sourceforge.net/projects/lazsqlx/files/Version%204.6.3.1523/
Resolving bugs and improving a program is never boring, keep it coming !
-
Ok this is the last one for today
v4.6.3.1524
-Fix: Copy Selected Rows as SQL Insert Script (on context menu of queryTab grid) caused application to crash
https://sourceforge.net/projects/lazsqlx/files/Version%204.6.3.1524/
-
v.4.7.0.1530 (https://sourceforge.net/projects/lazsqlx/files/Version%204.7.0.1530/)
-Fixed column Length not showing in table designer
-In AsDbFormUtils I added new db-aware control for numeric fields: TAsDBSpinEdit
-Fixed lots of memory leaks
-Code refactorings
-
v4.7.1.1531 (https://sourceforge.net/projects/lazsqlx/files/Version%204.7.1.1531/)
-Fix: AsDbSpinEdit didn't work with negative values and with ftBCD types
-
v.4.7.2.1535 (https://sourceforge.net/projects/lazsqlx/files/Version%204.7.2.1535/)
New:
-Help added (basic descriptions of features), accessible through MainMenu->Help
-Row/Col cursor position of active tab displayed in the statusbar
-FormatQuery added (very basic)
-NewConnection for each opened tab (so execution threads won't interfere with other tabs' connections)
-Execution time info and record count in statusBar is updated according to tab's last execution time, when tab is changed
-Ability to stop execution of active tab's query
-TableDesigner shows if a column is autonumber/identity
Fixes:
-Commiting updates when data was being edited through table->RightClick->"Open" into new tab
-Autocomplete items (reading table aliases in query editor) when loading session and generating query
-Database Cloner re-enabled (some testing done with mssql's AdventureWorks sampel db, converting it between different database types)
-
Thanks for keeping LazSqlX updated.
-
You're welcome.
I just uploaded a new setup.exe to SourceForge and this time the main executable is left intact (not compressed with upx) because after compression it seems some unhandled problems occur within threads (ie. when trying to stop execution of a running query). it's 7.7mb vs 2 mb (upx compressed) soI don't think 5mb space are relevant nowadays.
Sources in GitHub are up-to-date so you can compile it yourself
Sorry
again same link https://sourceforge.net/projects/lazsqlx/files/Version%204.7.2.1535/?
-
Version 5.0.0.1570 (https://sourceforge.net/projects/lazsqlx/files/Version%205.0.0.1570/)
-PostgreSQL support
-Bugfixes
-
Using the lazarus 1.4 rc with fpc 3.0.1 as provided in www.getlazarus.org, I managed to build (since it's all out of the box there) a Linux version from windows easily, but I had to make these changes to source code:
the unit MemBitmap that is used for AnimatedGif had to be changed because it failed to compile: {$IFDEF LCLgtk2}
{$DEFINE gtkbugfix}
,gdk2,gtkDef, gtkProc
{$ENDIF}
so basically, gtkProc and gtkDef weren't found (i searched for gtkDef and it seemed like a program not a unit), so I removed gtkProc and replaced gtkDef with gtk2Def
and in FileImport had to change this line
FCSVStream:=TFileStream.Create(FSourceFile,fmOpenRead and fmShareDenyNoneFlags);
removing [fmShareDenyNoneFlags] because it wasn't found.
I'm not sure what I've done here but after this it was built with success and I'll try later to test if it even runs on linux based system (ie Ubuntu)
-
Current Version is 5.0.0.1572 (some fixes on github but no release)
Known issues that irritate me but still can't find a solution are:
- You can't connect on MsSQL server 2014 with SQLDB (since it's using freetds dblib which doesn't seem to support that yet), but you can do that with Zeos (if protocol is set to 'mssql' because ntwdblib still connects to Sql 2014)
- Oracle stored procedures can't be executed neither with sqldb nor with zeos for reasons I still don't know
-
- You can't connect on MsSQL server 2014 with SQLDB (since it's using freetds dblib which doesn't seem to support that yet)
precompiled FreeTDS dblib uses by default TDS protocol version 7.1 (SQL Server 2000), which should be supported also by SQL Server 2014 (I can confirm only SQL Server 2012, that there it works without problems)
btw: does TMSSQLConnection reports any error ?
you can try updated versions of dblib.dll which are using also 7.3 version, at ftp://ftp.freepascal.org/fpc/contrib/windows/dblib_current.zip
(read readme in zip archive)
-
Thanks for help LacaK. I tried the 2000 and 2008 lib but same; the only difference I noticed with 2008 lib is that it takes a bit longer before raising the exception "TMSSQLConnection : Error 20009 :
Unable to connect: Adaptive Server is unavailable or does not exist" though it connects to 2005,2008,2012
-
I have strong suspection, that it is related to SQL Server configuration.
May be, that server requires encryption and rejects connection when not set etc.
I am sure, that it is not related to TDS protocol version or db-library itself.
-
Or open on server "SQL Server Configuration Manager" and check there if TCP/IP protocol is enabled.
It will be usefull also switch-on on client side logging, using freetds.conf, then we will see what is going on.
See: http://www.freetds.org/userguide/freetdsconf.htm
-
thank you very much LacaK, I'll try what you suggested as soon as I get back to lazsqlx
EDIT:
Yes you were right! TCP/IP protocol was not enabled by default. After enabling it, I restarted the service and it could connect to mssql server 2014 right away :) . Thank you!
-
v.5.1.0.1577 (https://sourceforge.net/projects/lazsqlx/files/Version%205.1.0.1577/)
GUI:
-TableList in UI changed to Treeview with expandable table items
-Changed some colors
-Changed MainIcon (and some others)
SQLite improvements:
-Sqlite foreign key extraction from ddl [AsSqliteMetadata] (kind of..)
-Better field type mapping when cloning to Sqlite from other database types [sqlite]
-New data types added for Sqlite3: varchar,datetime[sqlite]
-Fix field length [AsSqliteMetadata]
DatabaseCloner
-Improvements in cloning to Sqlite (creates constraints,better data type mappings)
-Added option to create or not the foreign key constraints
-Added option to copy data (experimental)
Note: except for Sqlite, constraints will be created after copying data. When you have
constraints in your source db when cloning to sqlite, expect failure in copy data.
Firebird
-Firebird embedded libraries included
...and bugfixes
Compiled with Lazarus 1.4RC2
-
I downloaded the latest precmpiled version, as well as compiling the latest version from source, and when I connect to a PostgreSQL version, the list of tables does not appear. The connection appears to succeed though.
Any ideas of what it might be?
Does it have some preferences that can be added at runtime to help with debugging?
For instance Zeos can log the output so you can see the exact commands and responses passed to the server. If it can be activate at runtime that wold be a great help.
-
I tried this : v.5.1.0.1577 with Firebird3.0 without success(Sqldb and Zeos).
In my opinion a good solution is to add protocol-options(for zeos) and option to save path for a client lib which can be used to load_library(Sqldb) or path in ZConnection.
I suppose that there is no problem if you have environment_variable-settings-path.
p.s. looks nice!
-
Hi,
Congratulations for LazSqlX. That's a nice tool!
I would like to suggest you a small correction. With Firebird Embedded's files, deployed with LazSqlX, it would be nice also to deploy these files:
int/fbintl.conf
int/fbintl.dll
Without them, any query might answer:
: Fetch :
-CHARACTER SET XXXXX is not installed
if your tables use some Character Set for collation control.
Best,
Marcelo.
-
Hi, I was working on porting and running MacOS lazsqlx also function as a client for SQLServer.
Finally it succeeds in compiling libraries freetds 32bit architecture (such as binary generated FPC). And make some changes in fpc sources because i use sqldb.
I leave a screenshot, and if anyone is interested, I can see leaving binaries.
regards
Build freetds for use in 32bits in osx
cd
wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-patched.tar.gz
tar -xvzf ./freetds-patched.tar.gz
cd freetds-0.95.0
./configure --with-tdsver=7.3 CFLAGS="-arch i386"
make
sudo make install
Changes in FPC source:
/lazarus/components/sqldb/registersqldb.pas:
Line:49-> Change to: {$IF DEFINED(BEOS) OR DEFINED(HAIKU) OR DEFINED(LINUX) OR DEFINED(FREEBSD) OR DEFINED (NETBSD) OR DEFINED(OPENBSD) OR DEFINED(WIN32) OR DEFINED(WIN64) OR DEFINED(DARWIN) }
/fpc/packages/fcl-db/fpmake.pp:
Line:16-> Change to: MSSQLOSes = [beos,haiku,linux,freebsd,netbsd,openbsd,solaris,win32,win64,android,dragonfly,darwin];
And i add (manually in the sqldblaz.lpk include library to mssqlconn.pp directory)
<SearchPaths>
<OtherUnitFiles Value="../../../fpc/packages/fcl-db/src/sqldb/mssql/;../../../fpc/packages/dblib/src"/>
-
I downloaded 5.1.2.1591 (beta) and use it with SQLDB/MySQL, works OK.
It's a bit slow for some features (example, table properties), but all in all it's good.
Also liked the visual query designer.
-
I have a problem connecting to Oracle on WinXP SP3. Main web page says LazSqlX works on Windows, but I get an error message which seam to indicate that Vista and up is requested according to this MS document:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms741669%28v=vs.85%29.aspx
Can anyone confirm this? Is this global or my local problem?
I can connect from Typhon, Toad and EMS SQL Manager on that pc.
-
Hello
I have question.
Under what license is LazSqlX released?
I see that there is no licensing info in installation nor in code tree.
Thanks
-
Hi again
I found https://twitter.com/lazsqlx
with information like this
LazSQLX
@LazSQLX
Free open source mini SqlManager for SqlServer,Oracle,MySql,Firebird,Postgres,Sqlite
So what exactly is LazSQLX license and where it is stated? BSD, MIT, MPL, GPL, LGPL, AGPL, Public Domain?
For example FPC/Lazarus licensing is LGPL with linking exception - FPC modified LGPL.
http://wiki.lazarus.freepascal.org/licensing
Twitter is not legal document. In reality LazSQLX license can be - Proprietary commercial software. Maybe all of LazSQLX users are now using software, that costs e.g. USD 3000.
Any thoughts? Under what licensing terms users are using this software? In many countries software users can get in big trouble if using unlicensed software.
http://www.allbusiness.com/software-licensing-what-you-dont-know-can-hurt-you-15636003-1.html (http://www.allbusiness.com/software-licensing-what-you-dont-know-can-hurt-you-15636003-1.html)
-
Flameron doesn't appear to be active on this forum right now.
Try here
https://github.com/flakron-shkodra/LazSqlX
Last commit appears to be only a month ago, so the project is still active.
And I sincerely doubt flameron has uploaded code just to ensare his users with a USD3000 bill. But sure, if you feel that's possible, don't use it.
-
BEWARE!!!
The libmySQL.dll file which comes bundled with LazSqlX is detected as a virus / trojan by a significant number of security vendors. Including the latest MSI marking it as a trojan and deleting it automatically. VirusTotal reports 11 / 63 (https://www.virustotal.com/#/file/dbf6907fd3d00a2924b497f91833e185daaf8de0817b2bfcc003301dce959785/detection).
Also reported here:
https://github.com/flakron-shkodra/LazSqlX/issues/3