Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
ba0507a1
Commit
ba0507a1
authored
Apr 23, 2007
by
Rob Shearman
Committed by
Alexandre Julliard
Apr 24, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Move table creation to table.c.
parent
3aa9a25c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
105 additions
and
91 deletions
+105
-91
create.c
dlls/msi/create.c
+2
-91
query.h
dlls/msi/query.h
+3
-0
table.c
dlls/msi/table.c
+100
-0
No files found.
dlls/msi/create.c
View file @
ba0507a1
...
...
@@ -59,101 +59,12 @@ static UINT CREATE_fetch_int( struct tagMSIVIEW *view, UINT row, UINT col, UINT
static
UINT
CREATE_execute
(
struct
tagMSIVIEW
*
view
,
MSIRECORD
*
record
)
{
MSICREATEVIEW
*
cv
=
(
MSICREATEVIEW
*
)
view
;
column_info
*
col
;
UINT
r
,
nField
;
static
const
WCHAR
szTables
[]
=
{
'_'
,
'T'
,
'a'
,
'b'
,
'l'
,
'e'
,
's'
,
0
};
static
const
WCHAR
szColumns
[]
=
{
'_'
,
'C'
,
'o'
,
'l'
,
'u'
,
'm'
,
'n'
,
's'
,
0
};
MSIVIEW
*
tv
=
NULL
;
MSIRECORD
*
rec
=
NULL
;
MSITABLE
*
table
;
TRACE
(
"%p Table %s (%s)
\n
"
,
cv
,
debugstr_w
(
cv
->
name
),
cv
->
bIsTemp
?
"temporary"
:
"permanent"
);
/* only add tables that don't exist already */
if
(
TABLE_Exists
(
cv
->
db
,
cv
->
name
)
)
return
ERROR_BAD_QUERY_SYNTAX
;
r
=
TABLE_CreateView
(
cv
->
db
,
szTables
,
&
tv
);
TRACE
(
"CreateView returned %x
\n
"
,
r
);
if
(
r
)
return
r
;
r
=
tv
->
ops
->
execute
(
tv
,
0
);
TRACE
(
"tv execute returned %x
\n
"
,
r
);
if
(
r
)
goto
err
;
rec
=
MSI_CreateRecord
(
1
);
if
(
!
rec
)
goto
err
;
r
=
MSI_RecordSetStringW
(
rec
,
1
,
cv
->
name
);
if
(
r
)
goto
err
;
r
=
tv
->
ops
->
insert_row
(
tv
,
rec
);
TRACE
(
"insert_row returned %x
\n
"
,
r
);
if
(
r
)
goto
err
;
tv
->
ops
->
delete
(
tv
);
tv
=
NULL
;
msiobj_release
(
&
rec
->
hdr
);
/* add each column to the _Columns table */
r
=
TABLE_CreateView
(
cv
->
db
,
szColumns
,
&
tv
);
if
(
r
)
return
r
;
r
=
tv
->
ops
->
execute
(
tv
,
0
);
TRACE
(
"tv execute returned %x
\n
"
,
r
);
if
(
r
)
goto
err
;
rec
=
MSI_CreateRecord
(
4
);
if
(
!
rec
)
goto
err
;
r
=
MSI_RecordSetStringW
(
rec
,
1
,
cv
->
name
);
if
(
r
)
goto
err
;
/*
* need to set the table, column number, col name and type
* for each column we enter in the table
*/
nField
=
1
;
for
(
col
=
cv
->
col_info
;
col
;
col
=
col
->
next
)
{
r
=
MSI_RecordSetInteger
(
rec
,
2
,
nField
);
if
(
r
)
goto
err
;
r
=
MSI_RecordSetStringW
(
rec
,
3
,
col
->
column
);
if
(
r
)
goto
err
;
r
=
MSI_RecordSetInteger
(
rec
,
4
,
col
->
type
);
if
(
r
)
goto
err
;
r
=
tv
->
ops
->
insert_row
(
tv
,
rec
);
if
(
r
)
goto
err
;
nField
++
;
}
if
(
!
col
)
r
=
ERROR_SUCCESS
;
err:
if
(
rec
)
msiobj_release
(
&
rec
->
hdr
);
/* FIXME: remove values from the string table on error */
if
(
tv
)
tv
->
ops
->
delete
(
tv
);
return
r
;
return
msi_create_table
(
cv
->
db
,
cv
->
name
,
cv
->
col_info
,
!
cv
->
bIsTemp
,
&
table
);
}
static
UINT
CREATE_close
(
struct
tagMSIVIEW
*
view
)
...
...
dlls/msi/query.h
View file @
ba0507a1
...
...
@@ -127,4 +127,7 @@ int sqliteGetToken(const WCHAR *z, int *tokenType);
MSIRECORD
*
msi_query_merge_record
(
UINT
fields
,
column_info
*
vl
,
MSIRECORD
*
rec
);
UINT
msi_create_table
(
MSIDATABASE
*
db
,
LPCWSTR
name
,
column_info
*
col_info
,
BOOL
persistent
,
MSITABLE
**
table_ret
);
#endif
/* __WINE_MSI_QUERY_H */
dlls/msi/table.c
View file @
ba0507a1
...
...
@@ -593,6 +593,106 @@ static UINT table_get_column_info( MSIDATABASE *db, LPCWSTR name, MSICOLUMNINFO
return
r
;
}
static
UINT
get_table
(
MSIDATABASE
*
db
,
LPCWSTR
name
,
MSITABLE
**
table_ret
);
UINT
msi_create_table
(
MSIDATABASE
*
db
,
LPCWSTR
name
,
column_info
*
col_info
,
BOOL
persistent
,
MSITABLE
**
table_ret
)
{
UINT
r
,
nField
;
MSIVIEW
*
tv
=
NULL
;
MSIRECORD
*
rec
=
NULL
;
column_info
*
col
;
/* only add tables that don't exist already */
if
(
TABLE_Exists
(
db
,
name
)
)
return
ERROR_BAD_QUERY_SYNTAX
;
r
=
TABLE_CreateView
(
db
,
szTables
,
&
tv
);
TRACE
(
"CreateView returned %x
\n
"
,
r
);
if
(
r
)
return
r
;
r
=
tv
->
ops
->
execute
(
tv
,
0
);
TRACE
(
"tv execute returned %x
\n
"
,
r
);
if
(
r
)
goto
err
;
rec
=
MSI_CreateRecord
(
1
);
if
(
!
rec
)
goto
err
;
r
=
MSI_RecordSetStringW
(
rec
,
1
,
name
);
if
(
r
)
goto
err
;
r
=
tv
->
ops
->
insert_row
(
tv
,
rec
);
TRACE
(
"insert_row returned %x
\n
"
,
r
);
if
(
r
)
goto
err
;
tv
->
ops
->
delete
(
tv
);
tv
=
NULL
;
msiobj_release
(
&
rec
->
hdr
);
/* add each column to the _Columns table */
r
=
TABLE_CreateView
(
db
,
szColumns
,
&
tv
);
if
(
r
)
return
r
;
r
=
tv
->
ops
->
execute
(
tv
,
0
);
TRACE
(
"tv execute returned %x
\n
"
,
r
);
if
(
r
)
goto
err
;
rec
=
MSI_CreateRecord
(
4
);
if
(
!
rec
)
goto
err
;
r
=
MSI_RecordSetStringW
(
rec
,
1
,
name
);
if
(
r
)
goto
err
;
/*
* need to set the table, column number, col name and type
* for each column we enter in the table
*/
nField
=
1
;
for
(
col
=
col_info
;
col
;
col
=
col
->
next
)
{
r
=
MSI_RecordSetInteger
(
rec
,
2
,
nField
);
if
(
r
)
goto
err
;
r
=
MSI_RecordSetStringW
(
rec
,
3
,
col
->
column
);
if
(
r
)
goto
err
;
r
=
MSI_RecordSetInteger
(
rec
,
4
,
col
->
type
);
if
(
r
)
goto
err
;
r
=
tv
->
ops
->
insert_row
(
tv
,
rec
);
if
(
r
)
goto
err
;
nField
++
;
}
if
(
!
col
)
r
=
ERROR_SUCCESS
;
err:
if
(
rec
)
msiobj_release
(
&
rec
->
hdr
);
/* FIXME: remove values from the string table on error */
if
(
tv
)
tv
->
ops
->
delete
(
tv
);
if
(
r
==
ERROR_SUCCESS
)
r
=
get_table
(
db
,
name
,
table_ret
);
return
r
;
}
static
UINT
get_table
(
MSIDATABASE
*
db
,
LPCWSTR
name
,
MSITABLE
**
table_ret
)
{
MSITABLE
*
table
;
...
...
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