Forum > General
[Solved] JanSql for lazarus [broken] ?
warcode:
Hi all
i have a project that using JanSQL for lazarus that i have downloaded here
http://matalab.freehostia.com/laz-janSQL.zip (this link is broken)
Now i started a new project and i downloaded JanSQL for lazarus here
http://www.theo.ch/lazarus/janSQLLaz.zip
When i try to complie janSQLTokenizer.pas i got a error
units\JanSQL\janSQLTokenizer.pas(223,21) Error: Incompatible types: got "AnsiString" expected "TTokenOperator"
and this is the definition of TTokenoperator
TTokenOperator=(toNone,toString,toNumber,toVariable,
toComma,toOpen,toClose,toHash,
tosqlCount, tosqlSum, tosqlAvg, tosqlMAX, tosqlMIN, tosqlStdDev,
toEq,toNe,toGt,toGe,toLt,toLe,
toAdd,toSubtract,toMultiply,toDivide,
toAnd,toOr,toNot,toLike,
tosqlALTER,tosqlTABLE,tosqlCOLUMN,
tosqlADD,tosqlDROP,tosqlCOMMIT,tosqlCREATE,
tosqlDELETE,tosqlFROM,tosqlWHERE,
tosqlINSERT,tosqlINTO,tosqlVALUES,
tosqlSELECT,tosqlAS,tosqlORDER,tosqlUPDATE,
tosqlSET,tosqlCONNECT, tosqlASSIGN,
tosqlSAVETABLE, tosqlRELEASETABLE,
tosqlGROUP, tosqlASC, tosqlDESC, tosqlHAVING,
tosqlIN,
toLOWER,toUPPER,toTRIM,toSoundex,
toSin, toCos, toSqr, toSqrt,
toAsNumber,toLeft, toRight, toMid,
tosubstr_after, tosubstr_before,
toFormat,
toDateAdd,
toYear, toMonth, toDay, toEaster, toWeekNumber,
toLen, toFix, toCeil, toFloor,
toIsNumeric, toIsDate,
toReplace, tosqlROLLBACK);
I'm sure that this error is due to a fpc update . I'm using lazarus 0.9.29, fpc 2.4.3
Some one can help me compile JanSQL for lazarus
Thanks for support
Christian F
warcode:
No one using JanSQL ? this unit compile whitout trouble 6 mount ago ???
does i need to speciale declare toString ?
Again thanks for any help
The error happen in this function
function TjanSQLTokenizer.GetToken: boolean;
var
bot:char;
function sqldatestring:string;
var
ayear,amonth,aday:word;
begin
decodedate(now,ayear,amonth,aday);
result:=format('%.4d',[ayear])+'-'+format('%.2d',[amonth])+'-'+format('%.2d',[aday])
end;
function sqltimestring:string;
var
ahour,amin,asec,amsec:word;
begin
decodetime(time,ahour,amin,asec,amsec);
result:=format('%.2d',[ahour])+':'+format('%.2d',[amin])+':'+format('%.2d',[asec]);
end;
begin
result:=false;
FToken:='';
while (idx<=SL) and (FSource[idx]=' ') do inc(idx);
if idx>SL then exit;
bot:=FSource[idx]; // begin of token
if bot='''' then begin // string
inc(idx);
while (idx<=SL) and (FSource[idx]<>'''' ) do begin
FToken:=FToken+Fsource[idx];
inc(idx);
end;
if idx>SL then exit;
inc(idx);
FTokenValue:=FToken;
FTokenKind:=tkOperand;
FTokenOperator:=toString; // THE ERROR AnsiString" expected "TTokenOperator"
result:=true;
end
else if bot=',' then begin
FToken:=FToken+Fsource[idx];
inc(idx);
FTokenValue:=FToken;
FTokenKind:=tkComma;
FTokenOperator:=toComma;
result:=true;
end
else if bot='#' then begin
FToken:=FToken+Fsource[idx];
inc(idx);
FTokenValue:=FToken;
FTokenKind:=tkHash;
FTokenOperator:=toHash;
result:=true;
end
else if bot in ['A'..'Z','a'..'z'] then begin // identifier
while (idx<=SL) and (FSource[idx] in identchars) do begin
FToken:=FToken+Fsource[idx];
inc(idx);
end;
if isKeyword(Ftoken) then begin
result:=true;
end
else if lowercase(FToken)='or' then begin
FTokenKind:=tkOperator;
FTokenLevel:=0;
FTokenOperator:=toOr;
end
else if lowercase(FToken)='and' then begin
FTokenKind:=tkOperator;
FTokenLevel:=0;
FTokenOperator:=toAnd;
end
else if lowercase(FToken)='pi' then begin
FTokenKind:=tkOperand;
FTokenValue:=pi;
FTokenOperator:=toNumber;
end
else if lowercase(FToken)='date' then begin
FTokenKind:=tkOperand;
FTokenValue:=sqldatestring;
FTokenOperator:=tostring;
end
else if lowercase(FToken)='time' then begin
FTokenKind:=tkOperand;
FTokenValue:=sqltimestring;
FTokenOperator:=tostring;
end
else if ISFunction(lowercase(FToken)) then begin
end
else begin
FTokenKind:=tkOperand;
FTokenOperator:=toVariable;
end;
result:=true;
end
else if bot in ['0'..'9'] then begin // number
while (idx<=SL) and (FSource[idx] in numberchars) do begin
FToken:=FToken+Fsource[idx];
inc(idx);
end;
FTokenKind:=tkOperand;
try
FTokenValue:=strtofloat(FToken);
FTokenOperator:=toNumber;
except
exit;
end;
result:=true;
end
else if bot='(' then begin
FToken:='(';
FTokenKind:=tkOpen;
FTokenOperator:=toOpen;
FtokenLevel:=1;
inc(idx);
result:=true;
end
else if bot=')' then begin
FToken:=')';
FTokenKind:=tkClose;
FTokenOperator:=toClose;
FtokenLevel:=1;
inc(idx);
result:=true;
end
else if bot in delimiters then begin
FToken:=FToken+Fsource[idx];
inc(idx);
FTokenKind:=tkOperator;
case bot of
'=': begin FTokenOperator:=toEq;;FTokenLevel:=3;end;
'+': begin FTokenOperator:=toAdd;FTokenLevel:=4;end;
'-': begin FTokenOperator:=toSubtract;FTokenLevel:=3;end;
'*': begin FTokenOperator:=toMultiply;FTokenLevel:=6;end;
'/': begin FTokenOperator:=toDivide; FtokenLevel:=5;end;
'>': begin
if idx>SL then exit;
FTokenLevel:=3;
if FSource[idx]='=' then begin
FToken:=FToken+Fsource[idx];
inc(idx);
FTokenOperator:=toGe;
end
else
FTokenOperator:=toGt
end;
'<': begin
if idx>SL then exit;
FTokenLevel:=3;
if FSource[idx]='=' then begin
FToken:=FToken+Fsource[idx];
inc(idx);
FTokenOperator:=toLe;
end
else if FSource[idx]='>' then begin
FToken:=FToken+Fsource[idx];
inc(idx);
FTokenOperator:=toNe;
end
else
FTokenOperator:=toLt;
end;
end;
result:=true;
end
else
exit;
end;
davesimplewear:
I have used JanSql in Linux and fpc 2.5.1 and lazarus 0.9.29 with no problems
Laksen:
Try TTokenOperator.toString
The newest fpc rtl introduced some TObject functions (ToString) that returns a string. In this case there for some reason was a name collision
warcode:
Thanks for tpis i try TTokenOperator.toString; but i get a Error: Illegal qualifier. i will try to update to fpc 2.5.1
i will give you feed back after
Again thanks for help
Navigation
[0] Message Index
[#] Next page