Jump to content


  • Content Count

  • Joined

  • Last visited


Everything posted by LoPiTaL

  1. LoPiTaL

    array of const

    Since I cannot post the code (always same error: "ERROR: Your reply cannot be created at this time.") I have post it to dropbox: https://www.dropbox.com/s/jbwpdgq6vs3ab24/replySMS.txt Best regards, LoPiTaL
  2. LoPiTaL

    array of const

    Well, I cannot post the code, don't know why. Tomorrow I will try again, and sorry for the spamming messages... Best regards, LoPiTaL
  3. LoPiTaL

    array of const

    Hi Eric! Sorry for my previous posts, I was trying to send any reply and those worked... Thank you for your answer. I am using the latest version ( The complete code is as follows: here the code If the line "LActualSQLWhere:=..." is commented out, then it compiles without problems. If it is not, then the error appears. I tried using directly the variable (as shown in the code) and passing it before to TVariant.AsString like: "TVariant.AsString (BoundsSQLWhere)", and in both cases I got the error. Best regards, LoPiTaL
  4. LoPiTaL

    array of const

    Well, I am gettin an error on the webpage, so now I can't create the reply: ERROR: Your reply cannot be created at this time.
  5. LoPiTaL

    array of const

    Ok, I have found a workaround, that is, using assembler, pass all the const array to an array of variant, and then use the variant instead. Best regards, LoPiTaL
  6. LoPiTaL

    array of const

    Hi all! Is it possible to declare a function with a parameter of type "array of const"? The compiler is throwing an error when I use this kind of parameter (if I don't use it in the function, everything goes fine): [iDE] Internal error. Code-generator threw exception ECodeGenUnknownExpression with message TdwsJSCodeGen: unknown expression class TOpenArrayExpr:SQLFormat [line: 488, column: 126, file: mORMotClient] Is it a bug or am I missing something? Best regards, LoPiTaL
  7. Hi everyone! I have been playing a bit with the 1.1 beta 2 (the lattest version currently available) and I have found that it is not possible to overload some methods. I presume it depends on its parameters,because it is not on all overloaded methods. Here is a sample: constructor CreateAndFillPrepare(ADatabase: TmORMotClient; FormatSQLWhere: string; const BoundsSQLWhere: array of string); overload; constructor CreateAndFillPrepare(ADatabase: TmORMotClient; FormatSQLWhere: string); overload; The compiler always complies with: Syntax Error: Method "Creat
  8. Hi everyone! I want to know if the compiler has any constant defined to identify itself as the Smart Mobile Studio compiler. This is just to be able to share the same unit across Delphi and Smart, just by adding {$IFDEF SMS_COMPILER} {$ENDIF} Best regards, LoPiTaL
  9. Sorry, I have figured it out. I have to declare also the childs as external: JObject=class external 'object' var Common: integer; end; JChild= class external (JObject) Concretion: string; end; Best regards, LoPiTaL
  10. Hi! Thank you both for your answers: > Do you need the record as datatype? No, I don't need the record. I just don't want to use Variants, because they are prone to typos. Using the variants remembers too much to Javascript, that can compile always but not execute, and (from my point of view) using a higher level language like Pascal is to avoid things like that. > LObject:=JMyObject(JSON2Variant(AString)); Ok, now your solution works really fine! Just a thing now: I have inherited from my object, so I can have a base class with some variables and child
  11. Ok, I was just wondering. Thanks for your answer, LoPiTaL
  12. Hi Jørn, thanks for the answer. I tried what you proposed, but I'm still getting the incompatible types error: "Syntax Error: Incompatible types: Cannot assign "Variant" to "JMyObject" [line: 195, column: 15, file: ServerConnector]" Now I have my code like this: function JSON2Variant(AResponse: string): Variant; JMyObject=class external 'object' end; procedure WhereIUseIt; var LObject: JMyObject; begin LObject:=JSON2Variant(AString); //Error appears here end; Can you explain a bit more or put some sample code? Thanks in advance,
  13. Hi everyone! I want to know if there is a unit to work with strings. Right now, I need a function similar to the Delphi's AnsiLeftStr, but knowing where are all of them would be nice. Best regards, LoPiTaL
  14. Hi everyone! I have read that variants and records are stored internally the same way (http://smartmobilestudio.com/2012/02/04/working-with-javascript-structures/). I am using the variant type to decode some received JSON. Now I want to convert this variant to a record representation, in order to avoid typos when writing code (thanks to the compile-time checkings that records have). Of course, the JSON and the record contains the same fields, so the asm direct conversion would work fine, but I don't know how to encapsulate this into a function, in order to avoid the use of
  • Create New...