Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get table names from select sql
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00901535
Message ID:
00903034
Views:
20
Oh good. So you finally got something that works for you then.

>Hi, thanks for the info
>
>I create the next methods (with some additional funcionality I need)
>
>*-- METHOD CALCULATETABLES
>
>LOCAL lcTablas,lcLF,lcSQL,lcTablas,lnOccur
>lcLF=CHR(13)+CHR(10)
>lcSQL=this.LimpiarSQL(this.cSQL)
>lcTablas=''
>*-- BUSCAR TABLA INICIAL
>lcTabla=STREXTRACT(UPPER(lcsql),' FROM ',' ')
>IF !EMPTY(lcTabla)
> lcTablas=lcTabla+',3'
> *-- BUSCAR TABLAS RELACIONADAS
> lnOccur=1
> lcTabla=STREXTRACT(UPPER(lcsql),' JOIN ',' ',lnOccur)
> DO WHILE !EMPTY(lcTabla)
> lcTablas=lcTablas+lcLF+(lcTabla)+',1'
> lnOccur=lnOccur+1
> lcTabla=STREXTRACT(UPPER(lcsql),' JOIN ',' ',lnOccur)
> ENDDO
>ENDIF
>RETURN lcTablas
>
>*-- METHOD LimpiarSQL
>
>LPARAMETERS tcSQL
>LOCAL lcSQL,lcSQLAnt
>*-- DEJAR TODA LA INSTRUCCION EN UNA SOLA LINEA
>lcSQL=STRTRAN(tcSql,';',' ')
>lcSQL=STRTRAN(lcSql,CHR(13),' ')
>lcSQL=STRTRAN(lcSql,CHR(10),' ')
>lcSQLAnt=''
>*-- DEJAR SOLO UN ESPACIO DE SEPARACION ENTRE INSTRUCCIONES
>DO WHILE !lcSQL==lcSQLAnt
> lcSQLAnt=lcSQL
> lcSql=STRTRAN(lcSQL,' ',' ')
>ENDDO
>RETURN lcSQL
Previous
Reply
Map
View

Click here to load this message in the networking platform