Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
PHP-MySQLi-Database-Class
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
PHP-MySQLi-Database-Class
Commits
a8b8c8db
Commit
a8b8c8db
authored
Jul 24, 2015
by
Alexander Butenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow prefix configuration out of constructor
parent
ea35ad41
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
7 deletions
+6
-7
MysqliDb.php
MysqliDb.php
+3
-2
mysqliDbTests.php
tests/mysqliDbTests.php
+3
-5
No files found.
MysqliDb.php
View file @
a8b8c8db
...
...
@@ -24,7 +24,7 @@ class MysqliDb
*
* @var string
*/
public
static
$prefix
;
public
static
$prefix
=
''
;
/**
* MySQLi instance
*
...
...
@@ -167,7 +167,8 @@ class MysqliDb
$this
->
isSubQuery
=
true
;
return
;
}
$this
->
setPrefix
();
if
(
isset
(
$prefix
))
$this
->
setPrefix
(
$prefix
);
self
::
$_instance
=
$this
;
}
...
...
tests/mysqliDbTests.php
View file @
a8b8c8db
...
...
@@ -2,6 +2,7 @@
require_once
(
"../MysqliDb.php"
);
error_reporting
(
E_ALL
);
$prefix
=
't_'
;
$db
=
new
Mysqlidb
(
'localhost'
,
'root'
,
''
,
'testdb'
);
if
(
!
$db
)
die
(
"Database error"
);
...
...
@@ -12,13 +13,11 @@ $db = new Mysqlidb(Array (
'host'
=>
'localhost'
,
'username'
=>
'root'
,
'password'
=>
''
,
'db'
=>
'testdb'
,
'db'
=>
'testdb'
,
'prefix'
=>
$prefix
,
'charset'
=>
null
));
if
(
!
$db
)
die
(
"Database error"
);
$prefix
=
't_'
;
$db
->
setPrefix
(
$prefix
);
$db
->
setTrace
(
true
);
$tables
=
Array
(
...
...
@@ -117,7 +116,6 @@ if (!$db->ping()) {
exit
;
}
$str
=
$db
->
escape
(
"te'st"
);
// insert test with autoincrement
foreach
(
$data
as
$name
=>
$datas
)
{
foreach
(
$datas
as
$d
)
{
...
...
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