[Gambas-user] Question about Subst() syntax

Ron Onstenk ronstk at ...239...
Sat Mar 1 07:55:31 CET 2008


On Saturday 01 March 2008 02:35, Benoit Minisini wrote:
> Hi,
> 
> I plan to limit the Subst() instruction to nine substitutions, for 
> optimization reasons. Does anyone use Subst with more than nine 
> substitutions?
> 
> I will do that for 3.0, and this will break 2.0 programs that use more than 
> nine substitutions.
> 
> The other proble is that the '&XX' syntax is ambiguous. &1 up to &9 is not, 
> but &10 can mean the 10th subsitution, or the first substitution followed by 
> a zero character. This was a stupid design.
> 
> Maybe the future syntax will be &1 up to &9, and then &(10),&(11),&(12) and so 
> on... Or maybe not, as I find that not really beautiful...
> 
> Beware that the substitution syntax is used by the database methods Edit(), 
> Exec(), Delete(), Find() too. So they are concerned by the syntax change.
> 
> Please tell...
> 

If the &1 till &9 and the are in this order used may be a kind 
of shift (see MS-Dos documention for bat files) can be done.
Just as leadin for next proposal.


The way I think ATM is to use &+ for the sequence
and when used as orginal with numbers and next is valid.

  DB.exec("SELECT &1 FROM &3 WHERE &4 LIKE &2", sField, sIndex, sTable, sArg) 
and
  DB.exec("SELECT &1 FROM &2 WHERE &3 LIKE &4", sField, sTable, sIndex, sArg) 

then change the '&[1-0]' to '&+'
  DB.exec("SELECT &+ FROM &+ WHERE &+ LIKE &+", sField, sTable, sIndex, sArg) 

Here why the order is important.

An other idea based on above 

-----------------------
  DIM aArgs as STRING[]
  DIM Records as RESULT

  aArgs[0] = sField
  aArgs[1] = sTable
  aArgs[2] = sIndex
  aArgs[3] = sArg
  Records  = DB.exec("SELECT &+ FROM &+ WHERE &+ LIKE &+",aArgs) 
----------------------

Just my two France Franks :)

Ron

 




More information about the User mailing list