You are not logged in.
For this function to work with a Field List, had to make the following change below:
From:
function TSQLModelInfo.SQLSelect(const FieldNames: string): string;
begin
result := 'select '+FieldBitsToFieldNames(FieldNamesToFieldBits(
FieldNames,false))+' from '+Name;
end;
To:
function TSQLModelInfo.SQLSelect(const FieldNames: string): string;
begin
if ((FieldNames = '') or (FieldNames = '*')) then
result := 'select '+FieldBitsToFieldNames(FieldNamesToFieldBits(
FieldNames,false))+' from '+Name
else
result := 'select '+FieldNames+' from '+Name;
end;
You may have a more elegant way to solve this.
Ubaltino Faleiro
www.sistemainteligente.com
Brasil - Goiás - Goiânia
Offline
What is wrong with the current implementation?
Its purpose is to normalize the field names so that the generated SQL would match the declared field order, to enhance caching abilities.
I do not find the mean of your modification.
Offline
Sorry, did not explain why my amendment.
Using SynCrossPlatformREST if I call the declaration:
SQL_Loja_Cadastro := TSQL_Loja_Cadastro.CreateAndFillPrepare(gServidores.ServidorBancoDados, 'ID, Nome_Fantasia, RAZAO_SOCIAL, CPF_CNPJ', 'id_usuario_proprietario = ' + IntToStr(ID_Usuario), []);
Should generate a select so the server
SELECT ID, Nome_Fantasia, RAZAO_SOCIAL, CPF_CNPJ FROM NAME_TABELA
Correct?
But this taking only the first field, select the result is wrong. Like This:
SELECT ID FROM NAME_TABELA
I hope it was clear now.
Ubaltino Faleiro
www.sistemainteligente.com
Brasil - Goiás - Goiânia
Offline
Resolved. Thank.
But maybe you should change your code so others do not go through the same problem.
Ubaltino Faleiro
www.sistemainteligente.com
Brasil - Goiás - Goiânia
Offline
Offline