API15

JDatabaseMySQL/getCollation: Difference between revisions

From Joomla! Documentation

m removing red link to edit, no existant pages
m preparing for archive only
 
Line 40: Line 40:


===Examples===
===Examples===
<CodeExamplesForm />
=== Code Examples ===
<dpl>
<dpl>
  noresultsheader=\n
  noresultsheader=\n
  category=getCollation
  category=getCollation
  category=JDatabaseMySQL
  category=JDatabaseMySQL
  category=CodeExample
  namespace=CodeExample
  category=MethodExample
  category=MethodExample
  include=*
  include=*

Latest revision as of 00:27, 25 March 2017

Description

Assumes database collation in use by sampling one text field in one table

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax

getCollation()


Returns

string Collation in use

Defined in

libraries/joomla/database/database/mysql.php

Importing

jimport( 'joomla.database.database.mysql' );

Source Body

function getCollation ()
{
        if ( $this->hasUTF() ) {
                $this->setQuery( 'SHOW FULL COLUMNS FROM #__content' );
                $array = $this->loadAssocList();
                return $array['4']['Collation'];
        } else {
                return "N/A (mySQL < 4.1.2)";
        }
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

Code Examples