Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
TelegramBot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
TelegramBot
Commits
d9f6e56c
Unverified
Commit
d9f6e56c
authored
Aug 27, 2016
by
Armando Lüscher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tidy up insertUser method.
parent
3b7ddbc8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
27 deletions
+27
-27
DB.php
src/DB.php
+27
-27
No files found.
src/DB.php
View file @
d9f6e56c
...
@@ -320,44 +320,44 @@ class DB
...
@@ -320,44 +320,44 @@ class DB
$last_name
=
$user
->
getLastName
();
$last_name
=
$user
->
getLastName
();
try
{
try
{
$sth1
=
self
::
$pdo
->
prepare
(
'INSERT INTO `'
.
TB_USER
.
'`
$sth
=
self
::
$pdo
->
prepare
(
'
(
INSERT INTO `'
.
TB_USER
.
'`
`id`, `username`, `first_name`, `last_name`, `created_at`, `updated_at`
(`id`, `username`, `first_name`, `last_name`, `created_at`, `updated_at`)
)
VALUES
VALUES (
(:id, :username, :first_name, :last_name, :date, :date)
:id, :username, :first_name, :last_name, :date, :date
ON DUPLICATE KEY UPDATE
)
`username` = :username,
ON DUPLICATE KEY UPDATE `username`=:username, `first_name`=:first_name,
`first_name` = :first_name,
`last_name`=:last_name, `updated_at`=:date
`last_name` = :last_name,
`updated_at` = :date
'
);
'
);
$sth
1
->
bindParam
(
':id'
,
$user_id
,
PDO
::
PARAM_INT
);
$sth
->
bindParam
(
':id'
,
$user_id
,
PDO
::
PARAM_INT
);
$sth
1
->
bindParam
(
':username'
,
$username
,
PDO
::
PARAM_STR
,
255
);
$sth
->
bindParam
(
':username'
,
$username
,
PDO
::
PARAM_STR
,
255
);
$sth
1
->
bindParam
(
':first_name'
,
$first_name
,
PDO
::
PARAM_STR
,
255
);
$sth
->
bindParam
(
':first_name'
,
$first_name
,
PDO
::
PARAM_STR
,
255
);
$sth
1
->
bindParam
(
':last_name'
,
$last_name
,
PDO
::
PARAM_STR
,
255
);
$sth
->
bindParam
(
':last_name'
,
$last_name
,
PDO
::
PARAM_STR
,
255
);
$sth
1
->
bindParam
(
':date'
,
$date
,
PDO
::
PARAM_STR
);
$sth
->
bindParam
(
':date'
,
$date
,
PDO
::
PARAM_STR
);
$status
=
$sth
1
->
execute
();
$status
=
$sth
->
execute
();
}
catch
(
PDOException
$e
)
{
}
catch
(
PDOException
$e
)
{
throw
new
TelegramException
(
$e
->
getMessage
());
throw
new
TelegramException
(
$e
->
getMessage
());
}
}
//insert also the relationship to the chat into user_chat table
//insert also the relationship to the chat into user_chat table
if
(
!
is_null
(
$chat
)
)
{
if
(
$chat
instanceof
Chat
)
{
$chat_id
=
$chat
->
getId
();
$chat_id
=
$chat
->
getId
();
try
{
try
{
$sth3
=
self
::
$pdo
->
prepare
(
'INSERT IGNORE INTO `'
.
TB_USER_CHAT
.
'`
$sth
=
self
::
$pdo
->
prepare
(
'
(
INSERT IGNORE INTO `'
.
TB_USER_CHAT
.
'`
`user_id`, `chat_id`
(`user_id`, `chat_id`)
)
VALUES
VALUES (
(:user_id, :chat_id)
:user_id, :chat_id
'
);
)'
);
$sth
3
->
bindParam
(
':user_id'
,
$user_id
,
PDO
::
PARAM_INT
);
$sth
->
bindParam
(
':user_id'
,
$user_id
,
PDO
::
PARAM_INT
);
$sth
3
->
bindParam
(
':chat_id'
,
$chat_id
,
PDO
::
PARAM_INT
);
$sth
->
bindParam
(
':chat_id'
,
$chat_id
,
PDO
::
PARAM_INT
);
$status
=
$sth
3
->
execute
();
$status
=
$sth
->
execute
();
}
catch
(
PDOException
$e
)
{
}
catch
(
PDOException
$e
)
{
throw
new
TelegramException
(
$e
->
getMessage
());
throw
new
TelegramException
(
$e
->
getMessage
());
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment