Skip to content

Instantly share code, notes, and snippets.

View viniciussanchez's full-sized avatar
:octocat:
Share knowledge

Vinicius Sanchez viniciussanchez

:octocat:
Share knowledge
View GitHub Profile
begin
qryUsuarios.SQL.Clear;
qryUsuarios.SQL.Add('select *');
qryUsuarios.SQL.Add(' from user');
qryUsuarios.SQL.Add(' where login = ' + QuotedStr(edtUsuario.Text));
qryUsuarios.SQL.Add(' and password = ' + edtSenha.Text);
qryUsuarios.Open();
if qryUsuarios.IsEmpty then
ShowMessage('ERRO!!!')
else
@viniciussanchez
viniciussanchez / User.sql
Last active June 6, 2021 14:42
User SQL
CREATE TABLE User (
ID INTEGER PRIMARY KEY NOT NULL,
NAME VARCHAR (100),
LOGIN VARCHAR (20) NOT NULL,
PASSWORD INTEGER NOT NULL
);
type
TVenda = record
Valor: Currency;
QuantidadeItensVendidos: Integer;
class operator Equal(AVenda1, AVenda2: TVenda): Boolean;
end;
var
LVenda1, LVenda2: TVenda;
begin
type
TVenda = record
QuantidadeItensVendidos: Integer;
class operator Inc(AVenda: TVenda): TVenda;
end;
var
LVenda: TVenda;
begin
LVenda.QuantidadeItensVendidos := 10;
@viniciussanchez
viniciussanchez / ClassOperatorImplicit.pas
Last active June 4, 2021 18:03
Class Operator Implicit
type
TVenda = record
Valor: Currency;
class operator Implicit(AValor: string): TVenda;
end;
var
LVenda: TVenda;
begin
LVenda := '300';
@viniciussanchez
viniciussanchez / StrToCurrRecordVenda.pas
Created June 4, 2021 17:55
Atribuição de valor para o record de vendas
var
LVenda: TVenda;
begin
LVenda.Valor := StrToCurr('300');
end;
@viniciussanchez
viniciussanchez / ShowMessageClassOperatorAdd.pas
Created June 4, 2021 17:48
ShowMessage class operator Add
var
LVenda1, LVenda2: TVenda;
begin
LVenda1.Valor := 100;
LVenda2.Valor := 50;
ShowMessage(CurrToStr(LVenda1.Valor + LVenda2.Valor));
end;
type
TVenda = record
Valor: Currency;
end;
@viniciussanchez
viniciussanchez / ClassOperatorsAdd.pas
Last active June 4, 2021 18:03
Class Operator Add
type
TVenda = record
Valor: Currency;
class operator Add(AVenda1, AVenda2: TVenda): Currency;
end;
var
LVenda1, LVenda2: TVenda;
begin
LVenda1.Valor := 100;
@viniciussanchez
viniciussanchez / Solid.DIP.Correcao.pas
Created May 4, 2021 11:39
Correção do princípio DIP do SOLID
unit Solid.DIP.Correcao;
interface
type
IConnection = interface
['{9C68D361-8374-443A-AC99-80EEF63F9BE6}']
procedure Connect;
end;