Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
acf-db
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ACF
acf-db
Commits
ae609210
Commit
ae609210
authored
Sep 19, 2015
by
Ted Trask
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use db.getcolumndata to determine column type as previous version did not work for sqlite
parent
76e4acf1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
lib/dbmodelfunctions.lua
lib/dbmodelfunctions.lua
+8
-7
No files found.
lib/dbmodelfunctions.lua
View file @
ae609210
...
...
@@ -126,14 +126,15 @@ function mymodule.list_table_entries(dbase, self, clientdata)
if
t
==
retval
.
value
.
table
.
value
then
retval
.
value
.
table
.
errtxt
=
nil
retval
.
errtxt
=
nil
-- FIXME - in the future, we should be able to do next these three things in one function call to db
retval
.
value
.
fields
.
value
=
db
.
listcolumns
(
t
)
or
{}
retval
.
value
.
keyfields
.
value
=
db
.
listkeycolumns
(
t
)
or
{}
-- this will not work for sqlite and the results are database-specific
local
sql
=
"SELECT data_type FROM information_schema.columns WHERE table_name = '"
..
db
.
escape
(
t
)
..
"' ORDER BY ordinal_position"
local
types
=
db
.
getselectresponse
(
sql
)
local
fieldtypes
=
{}
for
i
,
f
in
ipairs
(
types
)
do
fieldtypes
[
retval
.
value
.
fields
.
value
[
i
]]
=
f
.
data_type
end
local
columndata
=
db
.
getcolumndata
(
t
)
for
i
,
c
in
ipairs
(
columndata
)
do
retval
.
value
.
fields
.
value
[
#
retval
.
value
.
fields
.
value
+
1
]
=
c
.
name
if
c
.
key
then
retval
.
value
.
keyfields
.
value
[
#
retval
.
value
.
keyfields
.
value
+
1
]
=
c
.
name
end
fieldtypes
[
c
.
name
]
=
c
.
type
end
local
orderby
=
{}
local
columns
=
{}
...
...
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