ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:reference:connection:setcharset

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
v5:reference:connection:setcharset [2018/06/11 10:14] – [Workaround for setting server side character set on MySQL] Use mysql utf8mb4 charset (#426) dregadv5:reference:connection:setcharset [2022/07/13 03:18] (current) mnewnham
Line 2: Line 2:
 ~~NOTOC~~ ~~NOTOC~~
 <WRAP info> <WRAP info>
-Support for this command is limited to MySQL, Oracle, Interbase and Postgres databases. As of ADOdb V5.21, you can use the [[v5:reference:connection:setconnectionparameter|setConnectionParameter()]] parameter with any database that supports character set configuration.+Support for this command is limited to MySQL and Postgres databases, and as of ADOdb V5.21, this method is deprecated for MySQL databases, use [[v5:reference:connection:setconnectionparameter|setConnectionParameter()]] instead. Because Postgres allows the character set to be modified in real-time, it can be used at any point in the script after a connection has been established. 
 </WRAP> </WRAP>
 <WRAP right box> <WRAP right box>
Line 14: Line 15:
 ===== Description ===== ===== Description =====
 The function ''setCharSet()'' set the **client side** character set to the specified set. The function returns true or false based on the success of command execution. The function ''setCharSet()'' set the **client side** character set to the specified set. The function returns true or false based on the success of command execution.
 +
 +See [[v5:reference:connection:getcharset|getCharSet()]].
 +
 ===== Usage ===== ===== Usage =====
 <code php> <code php>
Line 19: Line 23:
 </code> </code>
  
-===== Workaround for setting server side character set on MySQL ===== 
-<code php> 
-$SQL = "SET  
-    character_set_results    = 'utf8mb4', 
-    character_set_client     = 'utf8mb4',  
-    character_set_connection = 'utf8mb4', 
-    character_set_database   = 'utf8mb4',  
-    character_set_server     = 'utf8mb4'"; 
-$db->execute($SQL); 
-</code> 
  
v5/reference/connection/setcharset.1528704879.txt.gz · Last modified: 2018/06/11 10:14 by dregad