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
0ef2ee86
Unverified
Commit
0ef2ee86
authored
Sep 06, 2017
by
Armando Lüscher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bind parameter values directly, instead of references.
parent
ef5af09c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
31 deletions
+31
-31
ConversationDB.php
src/ConversationDB.php
+31
-31
No files found.
src/ConversationDB.php
View file @
0ef2ee86
...
...
@@ -43,28 +43,34 @@ class ConversationDB extends DB
}
try
{
$query
=
'SELECT * FROM `'
.
TB_CONVERSATION
.
'` '
;
$query
.=
'WHERE `status` = :status '
;
$query
.=
'AND `chat_id` = :chat_id '
;
$query
.=
'AND `user_id` = :user_id '
;
$sql
=
'
SELECT *
FROM `'
.
TB_CONVERSATION
.
'`
WHERE `status` = :status
AND `chat_id` = :chat_id
AND `user_id` = :user_id
'
;
if
(
$limit
!==
null
)
{
$query
.=
' LIMIT :limit'
;
$sql
.=
' LIMIT :limit'
;
}
$sth
=
self
::
$pdo
->
prepare
(
$sql
);
$sth
->
bindValue
(
':status'
,
'active'
);
$sth
->
bindValue
(
':user_id'
,
$user_id
);
$sth
->
bindValue
(
':chat_id'
,
$chat_id
);
if
(
$limit
!==
null
)
{
$sth
->
bindValue
(
':limit'
,
$limit
,
PDO
::
PARAM_INT
);
}
$sth
=
self
::
$pdo
->
prepare
(
$query
);
$status
=
'active'
;
$sth
->
bindParam
(
':status'
,
$status
);
$sth
->
bindParam
(
':user_id'
,
$user_id
);
$sth
->
bindParam
(
':chat_id'
,
$chat_id
);
$sth
->
bindParam
(
':limit'
,
$limit
,
PDO
::
PARAM_INT
);
$sth
->
execute
();
$results
=
$sth
->
fetchAll
(
PDO
::
FETCH_ASSOC
);
return
$sth
->
fetchAll
(
PDO
::
FETCH_ASSOC
);
}
catch
(
Exception
$e
)
{
throw
new
TelegramException
(
$e
->
getMessage
());
}
return
$results
;
}
/**
...
...
@@ -85,31 +91,25 @@ class ConversationDB extends DB
try
{
$sth
=
self
::
$pdo
->
prepare
(
'INSERT INTO `'
.
TB_CONVERSATION
.
'`
(
`status`, `user_id`, `chat_id`, `command`, `notes`, `created_at`, `updated_at`
)
VALUES (
:status, :user_id, :chat_id, :command, :notes, :created_at, :updated_at
)
(`status`, `user_id`, `chat_id`, `command`, `notes`, `created_at`, `updated_at`)
VALUES
(:status, :user_id, :chat_id, :command, :notes, :created_at, :updated_at)
'
);
$status
=
'active'
;
$notes
=
'[]'
;
$date
=
self
::
getTimestamp
();
$date
=
self
::
getTimestamp
();
$sth
->
bind
Param
(
':status'
,
$status
);
$sth
->
bind
Param
(
':command'
,
$command
);
$sth
->
bind
Param
(
':user_id'
,
$user_id
);
$sth
->
bind
Param
(
':chat_id'
,
$chat_id
);
$sth
->
bind
Param
(
':notes'
,
$notes
);
$sth
->
bind
Param
(
':created_at'
,
$date
);
$sth
->
bind
Param
(
':updated_at'
,
$date
);
$sth
->
bind
Value
(
':status'
,
'active'
);
$sth
->
bind
Value
(
':command'
,
$command
);
$sth
->
bind
Value
(
':user_id'
,
$user_id
);
$sth
->
bind
Value
(
':chat_id'
,
$chat_id
);
$sth
->
bind
Value
(
':notes'
,
'[]'
);
$sth
->
bind
Value
(
':created_at'
,
$date
);
$sth
->
bind
Value
(
':updated_at'
,
$date
);
$status
=
$sth
->
execute
();
return
$sth
->
execute
();
}
catch
(
Exception
$e
)
{
throw
new
TelegramException
(
$e
->
getMessage
());
}
return
$status
;
}
/**
...
...
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