Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
qfq
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
typo3
qfq
Commits
de5ca086
Commit
de5ca086
authored
9 years ago
by
Carsten Rose
Browse files
Options
Downloads
Patches
Plain Diff
Database.php: changed getTableDefinition() from PDO to sql
parent
3ac5ffb6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
qfq/Database.php
+8
-9
8 additions, 9 deletions
qfq/Database.php
sql/testtables.sql
+6
-6
6 additions, 6 deletions
sql/testtables.sql
tests/phpunit/DatabaseTest.php
+2
-2
2 additions, 2 deletions
tests/phpunit/DatabaseTest.php
with
16 additions
and
17 deletions
qfq/Database.php
+
8
−
9
View file @
de5ca086
...
...
@@ -162,15 +162,7 @@ class Database {
* @return array column definition of table as returned by SHOW FIELDS FROM as associative array.
*/
public
function
getTableDefinition
(
$table
)
{
$statement
=
$this
->
pdo
->
query
(
"SHOW FIELDS FROM `
$table
`"
);
return
$statement
->
fetchAll
(
\PDO
::
FETCH_ASSOC
);
}
/**
* @return mixed
*/
public
function
getLastInsertId
()
{
return
$this
->
pdo
->
lastInsertId
();
return
$this
->
sql
(
"SHOW FIELDS FROM `
$table
`"
);
}
/**
...
...
@@ -293,4 +285,11 @@ class Database {
return
$this
->
stmt
->
fetch
(
\PDO
::
FETCH_ASSOC
);
}
/**
* @return mixed
*/
public
function
getLastInsertId
()
{
return
$this
->
pdo
->
lastInsertId
();
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
sql/testtables.sql
+
6
−
6
View file @
de5ca086
DROP
TABLE
IF
EXISTS
Person
;
CREATE
TABLE
p
erson
(
CREATE
TABLE
P
erson
(
id
BIGINT
AUTO_INCREMENT
PRIMARY
KEY
,
name
VARCHAR
(
128
),
firstname
VARCHAR
(
128
),
gender
ENUM
(
''
,
'male'
,
'female'
)
NOT
NULL
DEFAULT
''
,
gender
ENUM
(
''
,
'male'
,
'female'
)
NOT
NULL
DEFAULT
'
male
'
,
groups
SET
(
''
,
'a'
,
'b'
,
'c'
)
NOT
NULL
DEFAULT
''
);
...
...
@@ -14,8 +14,8 @@ INSERT INTO Person (id, name, firstname, gender, groups) VALUES
(
NULL
,
'Smith'
,
'Jane'
,
'female'
,
'a,c'
);
DROP
TABLE
IF
EXISTS
a
ddress
;
CREATE
TABLE
a
ddress
(
DROP
TABLE
IF
EXISTS
A
ddress
;
CREATE
TABLE
A
ddress
(
id
BIGINT
AUTO_INCREMENT
PRIMARY
KEY
,
person_id
BIGINT
,
street
VARCHAR
(
128
),
...
...
@@ -24,8 +24,8 @@ CREATE TABLE address (
gr_id_typ
BIGINT
);
DROP
TABLE
IF
EXISTS
g
ruppe
;
CREATE
TABLE
g
ruppe
(
DROP
TABLE
IF
EXISTS
G
ruppe
;
CREATE
TABLE
G
ruppe
(
id
BIGINT
AUTO_INCREMENT
PRIMARY
KEY
,
name
VARCHAR
(
255
),
value
VARCHAR
(
255
),
...
...
This diff is collapsed.
Click to expand it.
tests/phpunit/DatabaseTest.php
+
2
−
2
View file @
de5ca086
...
...
@@ -171,12 +171,12 @@ class DatabaseTest extends AbstractDatabaseTest {
*
*/
public
function
testGetSetValueList
()
{
$valueList
=
$this
->
db
->
getEnumSetValueList
(
'
p
erson'
,
'gender'
);
$valueList
=
$this
->
db
->
getEnumSetValueList
(
'
P
erson'
,
'gender'
);
$expected
=
[
0
=>
''
,
1
=>
'male'
,
2
=>
'female'
];
$this
->
assertEquals
(
$expected
,
$valueList
);
$expected
=
[
0
=>
''
,
1
=>
'a'
,
2
=>
'b'
,
3
=>
'c'
];
$valueList
=
$this
->
db
->
getEnumSetValueList
(
'
p
erson'
,
'groups'
);
$valueList
=
$this
->
db
->
getEnumSetValueList
(
'
P
erson'
,
'groups'
);
$this
->
assertEquals
(
$expected
,
$valueList
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment