Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Streda, 14. október 2026

Rozdiely pre phpMyEdit/doc/sgml/configuration.fields.sgml medzi verziami 1.31 a 1.32

verzia 1.31, 2003/08/16 01:41:26 verzia 1.32, 2003/12/08 09:17:30
Riadok 1 
Riadok 1 
 <!-- $Platon: phpMyEdit/doc/sgml/configuration.fields.sgml,v 1.30 2003/07/29 19:50:43 nepto Exp $ -->  <!-- $Platon: phpMyEdit/doc/sgml/configuration.fields.sgml,v 1.31 2003/08/16 01:41:26 nepto Exp $ -->
   
 <!-- Categories:  <!-- Categories:
   
Riadok 240  More information about CSS handling can
Riadok 240  More information about CSS handling can
 linkend="configuration.css" endterm="configuration.css.title"> section.  linkend="configuration.css" endterm="configuration.css.title"> section.
   
 </para>  </para>
 <bridgehead id="configuration.fields.sql">SQL expression</bridgehead>  
 <para>  
   
 There is a possibility to define a SQL expression that should be applied to  
 particular field when selecting data from database. This is very useful when  
 you want to interpret the field's content in different way than it is stored  
 in database. To be more clear, see following examples.  
   
 <example><title>SQL expressions</title>  
 <programlisting><![CDATA[  
 $opts['fdd']['surname']['sql'] = 'CONCAT(surname, ', ', firstname)';  
 $opts['fdd']['title']['sql'] = 'IF(TRIM(title) != "", title, title2)';  
 ]]></programlisting>  
 </example>  
   
 </para>  
 <para>  
   
 First example appends content of <varname>firstname</> field to  
 <varname>surname</> field. Because this is done on the database level, sorting  
 and searching (in table filtering page) on this field will properly work.  
 Similarly in the second example, the <varname>title2</> field will be used if  
 <varname>title</> field is empty. In this manner you can define some special  
 static string, which should be printed in case a field is empty. Just  
 substitute a quoted string in place of <varname>title2</>.  
   
 </para>  
 </sect1>  </sect1>
   
 <sect1 id="configuration.booleans">  <sect1 id="configuration.booleans">
Riadok 760  preceding "http://".
Riadok 733  preceding "http://".
   
 </para>  </para>
 </sect1>  </sect1>
   <sect1 id="configuration.fields.sql">
   <title id="configuration.fields.sql.title">SQL expressions</title>
   <para>
   
   There is a possibility to define a SQL expression that should be applied to
   particular field when reading or writting data from database. This is very
   useful when you want to interpret the field's content in different way than it
   is stored in database. To be more clear, see following examples.
   
   <example><title>Read SQL expressions</title>
   <programlisting><![CDATA[
   $opts['fdd']['surname']['sql'] = 'CONCAT(surname, ', ', firstname)';
   $opts['fdd']['title']['sql'] = 'IF(TRIM(title) != "", title, title2)';
   ]]></programlisting>
   </example>
   
   </para>
   <para>
   
   First example appends content of <varname>firstname</> field to
   <varname>surname</> field. Because this is done on the database level, sorting
   and searching (in table filtering page) on this field will properly work.
   Similarly in the second example, the <varname>title2</> field will be used if
   <varname>title</> field is empty. In this manner you can define some special
   static string, which should be printed in case a field is empty. Just
   substitute a quoted string in place of <varname>title2</>.
   
   </para>
   <para>
   
   Similarly, you can use SQL expression for storing data into database.
   
   <example><title>Write SQL expressions</title>
   <programlisting><![CDATA[
   $opts['fdd']['surname']['sqlw'] = 'UPPER($val_qas)';
   $opts['fdd']['title']['sqlw'] = 'TRIM("$val_as")';
   ]]></programlisting>
   </example>
   
   </para>
   <para>
   
   As a placeholder for the field's content, there are three variables available.
   
   <simplelist type="horiz" columns="2">
   <member> &nbsp; <varname>$val</varname></member>
   <member> -- value of the field</member>
   <member> &nbsp; <varname>$val_as</varname></member>
   <member> -- value with applied <function>addslashes()</function> function</member>
   <member> &nbsp; <varname>$val_qas</varname></member>
   <member> -- same as <varname>$val_as</varname> with quotes around</member>
   </simplelist>
   
   </para>
   <para>
   
   So if the <varname>$val</varname> is <constant>some"nice"thing</constant>,
   than <varname>$val_as</varname> becomes <constant>some\"nice\"thing</constant>
   and <varname>$val_qas</varname> becomes
   <constant>"some\"nice\"thing"</constant>. You have to use these variables
   correctly in your <varname>['sqlw']</varname> expressions, otherwise MySQL
   parsing error could be occured.
   
   </para>
   </sect1>
 <sect1 id="configuration.tabs-feature">  <sect1 id="configuration.tabs-feature">
 <title id="configuration.tabs-feature.title">TABs feature</title>  <title id="configuration.tabs-feature.title">TABs feature</title>
 <para>  <para>

Legend:
Odstranené z verzie1.31  
zmenené riadky
  Pridané vo verzii1.32

Platon Group <platon@platon.sk> http://platon.sk/
Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok