Bem-vindo caro visitante, informamos quer o blog FirebirdPT tem um novo endereço:
Windows Vista, erro ao abrir Control Panel após instalação de Firebird
Depois de instalar Firebird, o aacesso ao control panel comea crashar.
Solução:
remover ficheiro: Windows\System32\Firebird2Control.cpl
Control PAnel applet Aplication do Firebird
“firebird2control.cpl is a FB2Control belonging to Firebird Control Panel Applet from IBPhoenix”
Extrair parte de um campo Data (Datepart em Firebird)
Select
Extract(Day From current_date)
, Extract(Month From current_date)
, Extract(Year From current_date)
from rdb$database;
CURRENT_DATE CURRENT_TIMESTAMP
13.01.2009 13.01.2009 19:28
Select
Extract(Day From current_date)
|| ‘-’
|| Extract(Month From current_date)
|| ‘-’
|| Extract(Year From current_date)
from rdb$database;
-> 13-1-2009
How to get the Firebird server date and time?
There are two variables available, CURRENT_DATE which returns the current date and CURRENT_TIMESTAMP which returns date and time. You can use those in SQL statements:
insert into t1 values(10, CURRENT_TIMESTAMP);
To query the current time, use this:
Select current_date, current_timestamp
from rdb$database;
You need to select from something and rdb$database is a convenient one-row table that is present in each database.
You can also assign those variables in PSQL (stored procedure and trigger language):
create procedure p1
as
BEGIN
if (current_timestamp > cast(‘2007-11-03′ as timestamp)) then
exception myerror;
…
END
It should be noted that CURRENT_TIMESTAMP returns the timestamp of transaction start, which means it is constant during the transaction. If you need the exact timestamp of that very moment, use a special value ‘now’. It’s a char(3) string, so you need to cast it to timestamp explicitly.
select cast(‘now’ as timestamp), cast(‘today’ as date)
from rdb$database
As you can see, the same rule applies for CURRENT_DATE, and you can use a special value ‘today’, to get the current value.
The reason behind all this is that transactions should be atomic, so CURRENT_DATE and CURRENT_TIMESTAMP provide consistency. Especially in 24/7 systems it can easily happen that the date changes between transaction start and end.
How to calculate hours, minutes or seconds between two time values?
If you have time values, just subtract them, and you’ll get the interval length in seconds:
select end_time – start_time
from …
If you want to get minutes, divide the result by 60, and if you want hours by 3600.
If you have timestamps instead of times, the difference is in days, so you if you want seconds, you need to multiply the value by 60 * 60 * 24.
Refreshing a SOAP WSDL import file with Delphi
I’m consuming a web service from a Delphi desktop app and both the web service and the desktop app are being developed at the same time. Because the WSDL generated by the web service can change, I need to refresh the service interface code that the Delphi code uses to access the web service. It corresponds to the web references class that a .NET app would use to consume a web service.
WSDLImporter erros de acentuação
Ao consumir em Delphi win32 Webservices escritos em Delphi .Net 1.1(e noutras plataformas também), podem ocorrer erros relacionados com caracteres acentuados e cedilhados.
Por exemplo ao tentar enviar este tipo de caracteres, estes podem não ser interpretados e aparecer no seu lugar outros símbolos (??##). Ocorre porque no SOAP interface criado a partir do WSDLImporter não fica especificado o Encoding correcto e ao ser criado SOAP Envelope este converte os caracteres noutro simbolo.
Para o fazer devemos explicitamente declarar o uso de um encoding no Header do SOAP Envelope. No HTTPRio:
HTTPRIO.HTTPWebNode.UseUTF8InHeader := True ;
Recuperar base de dados corrompida por falha de energia
gFix:
1º – gfix -v -full c:\banco\corrompida.fdb -USER SYSDBA -pass masterkey
2º – gfix -mend c:\banco\corrompida.fdb -USER SYSDBA -pass masterkey
-v :v[erbose]
-full :validate record fragments, o mesmo que
-mend : prepare corrupt database for backup
gBak:
3º – GBAK -backup -V -ignore -garbage -limbo C:\banco\corrompida.fdb C:\banco\corrompida.gBK -USER SYSDBA -pass masterkey
4º – GBAK -c -v -z C:\banco\corrompida.gbk C:\banco\corrompida.fdb -USER SYSDBA -pass masterkey
-backup ou -b: b[ackup_database]. Back up. This switch is optional.
-limbo ou -l : Ignores limbo transactions while backing up
-ignore : -ig[nore] Ignores checksum errors while backing up
-garbage :-g[arbage collect] Does not perform garbage collection (sweeping) during backup
-limbo : -l[imbo] Ignores limbo transactions while backing up
-z :Show GBAK version and server version
-c : c[reate_database]Restore to a new database (the target database file MUST NOT exist)
Links:
http://www.destructor.de/firebird/gbak.htm
http://mail.firebase.com.br/pipermail/lista_firebase.com.br/2005-June/014097.html
InterBase and Firebird recovery guide
NOTICE: This document is the chapter from the book “The InterBase World” which was written by Alexey Kovyazin and Serg Vostrikov.
The chapter from book “The InterBase World” devoted to the database repairing.