Re: [Lazarus] Returning value from a Firebird (embedded) generator into Lazarus code

2015-04-25 Thread Michael Van Canneyt



On Sat, 25 Apr 2015, Gabor Boros wrote:


2015.04.25. 16:52 keltezéssel, brian írta:


Retrieve a value generated by a Firebird generator (in other words, an
autoincremented value stored within the database) and get that
incremented value into a Pascal variable. The SQL code to increment
the value in the Firebird database is

SELECT (generator,increment) FROM RDB$DATABASE;

but I'm struggling to find a way to retrieve that incremented value.
Simply attaching a data source to the query returns zero rows when the
SQL is executed. I'm wondering whether I need to use a dummy table and
then use the generator to update a field, then retrieve the data with
a separate query.


Hi,

Use RETURNING clause with INSERT or UPDATE is a better solution.


Correct but this is not a solution if you just need the value, without INSERT 
or UPDATE statement.

Michael.--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] lazbuild to user directory on Windows

2015-04-25 Thread Bernd Berger

Hi,

I'd like to use Lazarus for my pupils in school (Win 7), and our 
sysadmin has installed Lazarus to a read only network directory. After a 
test compile the unit win9xwsmanager was not found, so I tried to 
recompile the lclbase package.


Package rebuild for a read only lazarus installation does not work 
without administrator rights under Windows, as the lazbuild results will 
go directly into the lazarus directory tree. While under Linux, lazbuild 
results will be put into the user's directory under ~/.lazarus/lib, thus 
Package rebuild is possible for normal users under Linux.


Unfortunately, I could not find any settings for Lazarus to make 
lazbuild's results also go under Windows to the user directory (i. e. to 
C:\Users\username\AppData\Local\lazarus\lib). Can anyone tell me how 
to do this?  (Of course, in my case it will be just nice if the complete 
build will be later available from the read only lazarus directory, but 
first I want to test everything, as I am not the administrator user.)


Regards

Bernd

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] ShowMessage not Modal

2015-04-25 Thread Richard Mace
Hi All,
I have a strange problem.
If I use ShowModal (or MessageDlg) in my application, the code is being
executed, but it is not Modal.

e.g.

If I coded

ShowMessage('Hello');
Close;
Exit;

The message would not show (or just flicker) and the application would
close.

What's puzzling is that if I create a new app, and they do the same code,
it works as expected!

Any ideas?

Richard
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] ShowMessage not Modal

2015-04-25 Thread Richard Mace
Sorry, I should have also added...

Lazarus 1.4 Windows 7 fpc 2.6.4

Richard

On 26 April 2015 at 06:56, Richard Mace richard.m...@gmail.com wrote:

 Hi All,
 I have a strange problem.
 If I use ShowModal (or MessageDlg) in my application, the code is being
 executed, but it is not Modal.

 e.g.

 If I coded

 ShowMessage('Hello');
 Close;
 Exit;

 The message would not show (or just flicker) and the application would
 close.

 What's puzzling is that if I create a new app, and they do the same code,
 it works as expected!

 Any ideas?

 Richard

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Lazbuild add package on commandline

2015-04-25 Thread Alfred

Hello to all,

As new member of this list, I would like to ask a question.

I am trying to maintain the fpcup utility made by the late Reinier.

As such, I am running into a problem.

When trying to add a package from the commandline with lazbuild, the 
packagefiles.xml file is not updated due to:
procedure SaveUserLinks(Immediately: boolean = false); inside unit 
PackageLinks


If I change this default value to true, then the packagefiles.xml is 
updated with the package data.

And the package can be installed correctly.

My question / possibilities:
1) could this default be changed to true ?
2) could a command line switch be added to lazbuild for immediate update 
of packagefiles.xml  when used from commandline ?


Thanks in advance.--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Returning value from a Firebird (embedded) generator into Lazarus code

2015-04-25 Thread brian
On Sat, 25 Apr 2015 14:12:44 +, you wrote:

brian wrote:
 Hi folks, 
 
 Can someone please give me a hint with this problem. I'm new to
 Firebird, but I needed a database which could be used in embedded
 fashion, and seemed to have a choice of one under Linux. 
 
 What I need to do is to return a value generated by a Firebird
 generator into my Pascal code. Doing it what seemed to me to be the
 obvious way returns zero rows, do I need to update an interim table
 and then query that table? Or is there some other method which I've
 missed? 

Embedded in what way? I use Firebird on occasion as an alternative to 
PostgreSQL (i.e. in a client-server scenario), but I'd have thought for 
a single-system application SQLite would have been worth a look.


Embedded as in there is no requirement for the user to do anything
except unpack a zip file and run the executable. No installation of
any kind of server on the host system. 

Having said that, apart from Firebird's poor documentation I've had no 
significant problem querying and updating tables. What exactly are you 
trying to do?


Retrieve a value generated by a Firebird generator (in other words, an
autoincremented value stored within the database) and get that
incremented value into a Pascal variable. The SQL code to increment
the value in the Firebird database is 

SELECT (generator,increment) FROM RDB$DATABASE;

but I'm struggling to find a way to retrieve that incremented value.
Simply attaching a data source to the query returns zero rows when the
SQL is executed. I'm wondering whether I need to use a dummy table and
then use the generator to update a field, then retrieve the data with
a separate query. 


Brian. 

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Returning value from a Firebird (embedded) generator into Lazarus code

2015-04-25 Thread brian
On Sat, 25 Apr 2015 16:18:18 +0200 (CEST), you wrote:



On Sat, 25 Apr 2015, brian wrote:


 Hi folks,

 Can someone please give me a hint with this problem. I'm new to
 Firebird, but I needed a database which could be used in embedded
 fashion, and seemed to have a choice of one under Linux.

 What I need to do is to return a value generated by a Firebird
 generator into my Pascal code. Doing it what seemed to me to be the
 obvious way returns zero rows, do I need to update an interim table
 and then query that table? Or is there some other method which I've
 missed?

Do a

SELECT GEN_ID(YOUR_GENERATOR,1) AS THEVALUE FROM RDB$DATABASE

in a TSQLQuery instance. Then call Open and you can get the value.

Something like:

With TSQLQuery.Create(Nil) do
   try
 Database:=MyDatabase;
 SQL.Text:='SELECT GEN_ID(YOUR_GENERATOR,1) AS THEVALUE FROM RDB$DATABASE';
 Open;
 MyGenValue:=Fields[0].AsLargeInt;
   Finally
 Free;
   end;

Michael.


Ahh.. OK, I knew it was something obvious. Thanks, Michael. I guess
I've forgotten more of my (Oracle) SQL than I thought. I see what I've
been doing wrong. 

Brian. 

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Returning value from a Firebird (embedded) generator into Lazarus code

2015-04-25 Thread Mark Morgan Lloyd

brian wrote:
Hi folks, 


Can someone please give me a hint with this problem. I'm new to
Firebird, but I needed a database which could be used in embedded
fashion, and seemed to have a choice of one under Linux. 


What I need to do is to return a value generated by a Firebird
generator into my Pascal code. Doing it what seemed to me to be the
obvious way returns zero rows, do I need to update an interim table
and then query that table? Or is there some other method which I've
missed? 


Embedded in what way? I use Firebird on occasion as an alternative to 
PostgreSQL (i.e. in a client-server scenario), but I'd have thought for 
a single-system application SQLite would have been worth a look.


Having said that, apart from Firebird's poor documentation I've had no 
significant problem querying and updating tables. What exactly are you 
trying to do?


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Returning value from a Firebird (embedded) generator into Lazarus code

2015-04-25 Thread Michael Van Canneyt



On Sat, 25 Apr 2015, brian wrote:



Hi folks,

Can someone please give me a hint with this problem. I'm new to
Firebird, but I needed a database which could be used in embedded
fashion, and seemed to have a choice of one under Linux.

What I need to do is to return a value generated by a Firebird
generator into my Pascal code. Doing it what seemed to me to be the
obvious way returns zero rows, do I need to update an interim table
and then query that table? Or is there some other method which I've
missed?


Do a

SELECT GEN_ID(YOUR_GENERATOR,1) AS THEVALUE FROM RDB$DATABASE

in a TSQLQuery instance. Then call Open and you can get the value.

Something like:

With TSQLQuery.Create(Nil) do
  try
Database:=MyDatabase;
SQL.Text:='SELECT GEN_ID(YOUR_GENERATOR,1) AS THEVALUE FROM RDB$DATABASE';
Open;
MyGenValue:=Fields[0].AsLargeInt;
  Finally
Free;
  end;

Michael.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Returning value from a Firebird (embedded) generator into Lazarus code

2015-04-25 Thread Gabor Boros

2015.04.25. 16:52 keltezéssel, brian írta:


Retrieve a value generated by a Firebird generator (in other words, an
autoincremented value stored within the database) and get that
incremented value into a Pascal variable. The SQL code to increment
the value in the Firebird database is

SELECT (generator,increment) FROM RDB$DATABASE;

but I'm struggling to find a way to retrieve that incremented value.
Simply attaching a data source to the query returns zero rows when the
SQL is executed. I'm wondering whether I need to use a dummy table and
then use the generator to update a field, then retrieve the data with
a separate query.


Hi,

Use RETURNING clause with INSERT or UPDATE is a better solution.

Gabor

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus