Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P142
(An Untitled Masterwork)
Active
Public
Actions
Authored by
stwalkerster
on Jun 14 2017, 11:12 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Tags
None
Referenced Files
F22777:
Jun 14 2017, 11:12 PM
2017-06-14 23:12:37 (UTC+0)
Subscribers
None
<?php
include
'includes/PdoDatabase.php'
;
$db
=
new
\Waca\PdoDatabase
(
'mysql:host=localhost;dbname=stwalkerster_scratch'
,
'stwalkerster'
,
'123'
,
array
(
// PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4',
));
$db2
=
new
\Waca\PdoDatabase
(
'mysql:host=localhost;dbname=stwalkerster_scratch'
,
'stwalkerster'
,
'123'
,
array
(
PDO
::
MYSQL_ATTR_INIT_COMMAND
=>
'SET NAMES utf8mb4'
,
));
$name
=
'小綿羊寶貝'
;
$db
->
exec
(
'TRUNCATE TABLE stwalkerster_scratch.request'
);
$db
->
exec
(
'TRUNCATE TABLE stwalkerster_scratch.request2'
);
$db
->
prepare
(
"INSERT INTO stwalkerster_scratch.request VALUES (:name);"
)->
execute
([
':name'
=>
$name
]);
$db
->
prepare
(
"INSERT INTO stwalkerster_scratch.request2 VALUES (:name);"
)->
execute
([
':name'
=>
$name
]);
$statement
=
$db
->
prepare
(
"SELECT name FROM stwalkerster_scratch.request;"
);
$statement
->
execute
();
$utf
=
$statement
->
fetchColumn
();
$statement
=
$db
->
prepare
(
"SELECT name FROM stwalkerster_scratch.request2;"
);
$statement
->
execute
();
$utfmb
=
$statement
->
fetchColumn
();
var_dump
(
$name
);
var_dump
(
bin2hex
(
$name
));
var_dump
(
$utf
);
var_dump
(
bin2hex
(
$utf
));
var_dump
(
$utfmb
);
var_dump
(
bin2hex
(
$utfmb
));
$db2
->
exec
(
'INSERT INTO acc_notifications.notification SELECT null, null, 2, name FROM stwalkerster_scratch.request'
);
$db2
->
exec
(
'INSERT INTO acc_notifications.notification SELECT null, null, 2, name FROM stwalkerster_scratch.request2'
);
Event Timeline
stwalkerster
created this paste.
Jun 14 2017, 11:12 PM
2017-06-14 23:12:37 (UTC+0)
stwalkerster
created this object with visibility "Public (No Login Required)".
Log In to Comment