* Alessandro Manotti <[EMAIL PROTECTED]> [060510 05:12]:
 
  Hi Alessandro:

  Since you're gathering information, here's a general method that I use
  for processing data returned from a dialect block.  In my case, it is
  a mysql query, but can be used in other venues: 
  
  I construct a block of words:
  Example:
    cols: [first_name middle_name last_name]

  then submit 'cols using a helper function called 'quotes which
  produces a string representation of col, delimited by commas

  >> replace/all form cols " " ","
  == "first_name,middle_name,last_name
  So our DSL query looks like this:

  db[select (quotes cols) from remote_clients]

  for process the data returned from the query:
  code internal to DSL parsing "interweaves" the 'cols block with
  the data from the query.

  Then our processing loops can look like this:

  while [rec: db[get]][
         foreach col cols[do-something-to rec/:col]
         ]

  or for one record:
  rec: db[get]
  rec/first_name
  rec/last_name 
  ... etc.

  Maybe this provides some other ideas for you.
  regards
  tim

> Yes! I will save your suggestions!
> 
> (In this phase I'm gathering information)
> 
> Thank you  ;-)
> 
> 
> 
> 
> 
> 
> On 5/10/06, Volker Nitsch <[EMAIL PROTECTED]> wrote:
> >
> > On 5/10/06, Alessandro Manotti <[EMAIL PROTECTED]> wrote:
> > >
> > > Ok, in this way I preserve the original code, but the problem is I
> > > need to implement a new dialect to to be used in batch (like in a
> > > program) but I need to use it in "live", from command console.
> > >
> > > It means if I create a standard dialect it could become really annoing
> > > use it. E.g.:
> > >
> > > >> mydialect [ myCommand ]
> > >
> > > You can see I need to type many things. Since I'm creating something
> > > like a dos-shell, I need to creating fast typing commands.
> > >
> > > Look at another example:
> > >
> > > DOS SHELL:
> > > >> copy file1 file2
> > >
> > > MY FUTURE SHELL:
> > > >> mydialect [ copy file1 file2 ]
> > >
> > > I typed too many things!
> > > Another way could be creating new commands with a prefix (but I don't
> > > like this solution):
> > >
> > > >>jcopy file1 file2
> > >
> >
> > Since the context for the console and the context for rebols internals
> > is the same, overriding is tricky.
> >
> > Some ideas:
> >
> > - Implement an own console. That is basically
> > dos: func[][
> >   forever[set/any 'res do bind (load/all ask ">>") my-overrides
> > attempt[probe res]]
> > ]
> > Disadvantage: The real console can deal with multi-line-input, this
> > simple version not.
> > Cyphre has a quite complete console written for view, IIRC it can do that=
> .
> >
> > - Use both a short and a long name, keep the middle ones for rebol.
> >  cp: copy-file: func["cp copy-file: copies a file" .. ][..]
> > both are unlikely to clash, the long name is easier to find with 'help
> > and then you see the short version. And you can use the long name in
> > files, where precision is more important than keysaving.
> > Add a function 'help-dos, then you can type "help hel", that gives
> > 'help, 'help-dos etc.
> >
> > ..snip..
> >
> > --=3D20
> > -Volker
> >
> > "Any problem in computer science can be solved with another layer of
> > indirection. But that usually will create another problem." David
> > Wheeler
> > --
> > To unsubscribe from the list, just send an email to
> > lists at rebol.com with unsubscribe as the subject.
> >
> >
> -- 
> To unsubscribe from the list, just send an email to 
> lists at rebol.com with unsubscribe as the subject.

-- 
Tim Johnson <[EMAIL PROTECTED]>
      http://www.alaska-internet-solutions.com
-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to