本文整理汇总了PHP中sqlite_libencoding函数的典型用法代码示例。如果您正苦于以下问题:PHP sqlite_libencoding函数的具体用法?PHP sqlite_libencoding怎么用?PHP sqlite_libencoding使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sqlite_libencoding函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dl
<?php
if (!extension_loaded("sqlite")) {
dl("sqlite.so");
if (!extension_loaded("sqlite")) {
exit("Please enable SQLite support\n");
}
}
debug_zval_dump(sqlite_libversion());
debug_zval_dump(sqlite_libencoding());
$s = sqlite_open("weztest.sqlite", 0666, $err);
debug_zval_dump($err);
debug_zval_dump($s);
$r = sqlite_query("create table foo (a INTEGER PRIMARY KEY, b INTEGER )", $s);
debug_zval_dump(sqlite_last_error($s));
debug_zval_dump(sqlite_error_string(sqlite_last_error($s)));
$r = sqlite_query("select *, php('md5', sql) as o from sqlite_master", $s);
debug_zval_dump($r);
debug_zval_dump(sqlite_num_rows($r));
debug_zval_dump(sqlite_num_fields($r));
for ($j = 0; $j < sqlite_num_fields($r); $j++) {
echo "Field {$j} is " . sqlite_field_name($r, $j) . "\n";
}
while ($row = sqlite_fetch_array($r, SQLITE_ASSOC)) {
print_r($row);
}
sqlite_close($s);
示例2: ServerInfo
function ServerInfo()
{
$arr['version'] = sqlite_libversion();
$arr['description'] = 'SQLite ';
$arr['encoding'] = sqlite_libencoding();
return $arr;
}
示例3: getAttribute
public function getAttribute($attribute)
{
switch ($attribute) {
case DoLite::ATTR_SERVER_INFO:
return sqlite_libencoding();
break;
case DoLite::ATTR_SERVER_VERSION:
case DoLite::ATTR_CLIENT_VERSION:
return sqlite_libversion();
break;
case DoLite::ATTR_PERSISTENT:
return $this->_persistent;
break;
}
return null;
}
示例4: encoding
/**
* Renvoie le jeu de caractères courant utilisé.
* Si l'argument $encoding est fourni, il est utilisé pour définir
* le nouveau jeu de caractères de la connexion en cours
*
* @param string $encoding
*
* @access public
* @return string
*/
function encoding($encoding = null)
{
if (!is_null($encoding)) {
trigger_error("Setting encoding isn't supported by SQLite", E_USER_WARNING);
}
return sqlite_libencoding();
}
示例5: sqlitem_libencoding
function sqlitem_libencoding()
{
die('sqlitem_libencoding not implemented in PDO');
return sqlite_libencoding();
}
示例6: createSQLiteFunctions
/**
* Adds a number of math functions to SQLite that MSSQL, MySQL and PostgreSQL have by default
*
* @return void
*/
private function createSQLiteFunctions()
{
$function = array();
$functions[] = array('acos', 'acos', 1);
$functions[] = array('asin', 'asin', 1);
$functions[] = array('atan', 'atan', 1);
$functions[] = array('atan2', 'atan2', 2);
$functions[] = array('ceil', 'ceil', 1);
$functions[] = array('ceiling', 'ceil', 1);
$functions[] = array('cos', 'cos', 1);
$functions[] = array('cot', array('fSQLTranslation', 'sqliteCotangent'), 1);
$functions[] = array('degrees', 'rad2deg', 1);
$functions[] = array('exp', 'exp', 1);
$functions[] = array('floor', 'floor', 1);
$functions[] = array('ln', 'log', 1);
$functions[] = array('log', array('fSQLTranslation', 'sqliteLogBaseFirst'), 2);
$functions[] = array('ltrim', 'ltrim', 1);
$functions[] = array('pi', 'pi', 0);
$functions[] = array('power', 'pow', 2);
$functions[] = array('radians', 'deg2rad', 1);
$functions[] = array('rtrim', 'rtrim', 1);
$functions[] = array('sign', array('fSQLTranslation', 'sqliteSign'), 1);
$functions[] = array('sqrt', 'sqrt', 1);
$functions[] = array('sin', 'sin', 1);
$functions[] = array('tan', 'tan', 1);
$functions[] = array('trim', 'trim', 1);
if ($this->database->getExtension() == 'sqlite') {
$functions[] = array('current_date', array('fSQLTranslation', 'sqliteDate'), 0);
$functions[] = array('current_time', array('fSQLTranslation', 'sqliteTime'), 0);
$functions[] = array('current_timestamp', array('fSQLTranslation', 'sqliteTimestamp'), 0);
// If SQLite was compiled with ISO-8859-* string handling, we override as best we can
// with custom functions that return the correct values. We can't fix LIKE and GLOB
// but they don't matter as much since the encoding only affects case transformations.
if (strtolower(sqlite_libencoding()) != 'utf-8') {
$functions[] = array('length', array('fSQLTranslation', 'sqliteLength'), 1);
$functions[] = array('substr', array('fSQLTranslation', 'sqliteSubstr'), 3);
}
}
foreach ($functions as $function) {
if ($this->database->getExtension() == 'pdo') {
$this->database->getConnection()->sqliteCreateFunction($function[0], $function[1], $function[2]);
} else {
sqlite_create_function($this->database->getConnection(), $function[0], $function[1], $function[2]);
}
}
}
示例7: sqlitem_libencoding
function sqlitem_libencoding()
{
return sqlite_libencoding();
}
示例8: getAttribute
/**
* Public method:
* Quotes correctly a string for this database
* this->getAttribute( $attribute:Integer ):Mixed
* @Param Integer a constant [ PDO_ATTR_SERVER_INFO,
* PDO_ATTR_SERVER_VERSION,
* PDO_ATTR_CLIENT_VERSION,
* PDO_ATTR_PERSISTENT ]
* @Return Mixed correct information or null
*/
function getAttribute($attribute)
{
$result = null;
switch ($attribute) {
case PDO_ATTR_SERVER_INFO:
$result = sqlite_libencoding();
break;
case PDO_ATTR_SERVER_VERSION:
case PDO_ATTR_CLIENT_VERSION:
$result = sqlite_libversion();
break;
case PDO_ATTR_PERSISTENT:
$result = $this->__persistent;
break;
}
return $result;
}
示例9: sqlite_libversion
if ($view == "vacuum") {
echo "class='tab_pressed'";
} else {
echo "class='tab'";
}
echo ">Vacuum</a>";
echo "<div style='clear:both;'></div>";
echo "<div id='main'>";
if ($view == "structure") {
echo "<b>Database name</b>: " . $db->getName() . "<br/>";
echo "<b>Path to database</b>: " . $db->getPath() . "<br/>";
echo "<b>Size of database</b>: " . $db->getSize() . "<br/>";
echo "<b>Database last modified</b>: " . $db->getDate() . "<br/>";
if ($db->getType() == "SQLiteDatabase") {
echo "<b>SQLite version</b>: " . sqlite_libversion() . "<br/>";
echo "<b>SQLite encoding</b>: " . sqlite_libencoding() . "<br/>";
}
if ($db->getType() == "SQLite3") {
echo "<b>SQLite version</b>: " . SQLite3::version() . "<br/>";
} else {
echo "<b>SQLite version</b>: " . $db->getVersion() . "<br/>";
}
echo "<b>SQLite extension</b>: " . $db->getType() . "<br/>";
echo "<b>PHP version</b>: " . phpversion() . "<br/><br/>";
$query = "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name";
$result = $db->selectArray($query);
$j = 0;
for ($i = 0; $i < sizeof($result); $i++) {
if (substr($result[$i]['name'], 0, 7) != "sqlite_" && $result[$i]['name'] != "") {
$j++;
}
示例10: libEncoding
/**
* The encoding of library
*
* @access public
* @return string
*/
function libEncoding()
{
return sqlite_libencoding();
}