JeremieGimenez
ben sans vouloir pinailler, s'auto-corriger quand c'est les autres qui corrigent, c'est un peu galvauder :)
MagalieJ
Fonction sql.col :
/* sql.col ( _field )
By Fabrice Nordmann
1-more-thing
@1morethingtweet
formats a FM full field name for a SQL query
to escape reserved words and remain naming independent
sql.col ( ORDER::date ) => "ORDER"."date"
v2 Aug 2014
new feature: declares $sql.col.table so sql.table ( _field ) can use it if the parameter is empty
v1 Apr 2013
*/
Let ([
_f = Case ( Position ( _field ; "::" ; 0 ; 1 ) ;
_field ;
GetFieldName ( _field )
) ;
_result = "\"" & Substitute ( _f ; "::" ; "\".\"" ) & "\"" ;
$sql.col.table = GetValue ( Substitute ( _f ; "::" ; ¶ ) ; 1 )
];
_result
)
et du même coup la fonction sql.table pour obtenir une table :
/* sql.table ( _field )
By Fabrice Nordmann
1-more-thing
@1morethingtweet
formats a FM full field name or a table name for a SQL query (returns only the table name)
to escape reserved words and remain naming independent
sql.table ( ORDER::date ) => "ORDER"
sql.table ( "ORDER" ) => "ORDER"
sql.table ( "" ) => uses $sql.col.table, declared previously by sql.col
v1 Aug 2014
*/
Let ([
_f = Case ( not EvaluationError ( Evaluate ( GetFieldName ( _field ))) ; GetFieldName ( _field ) ; _field ) ;
_f = Case (
IsEmpty ( _field ) ; $sql.col.table ;
Position ( _f ; "::" ; 0 ; 1 ) ; GetValue ( Substitute ( _f ; "::" ; ¶ ) ; 1 ) ;
_field
) ;
_result = "\"" & _f & "\"" ;
$sql.col.table = ""
];
_result
)