Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
c07b554e
Commit
c07b554e
authored
Mar 01, 2009
by
James Hawkins
Committed by
Alexandre Julliard
Mar 02, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Order primary keys to be first in the column list when creating a table.
parent
b3c9875c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
10 deletions
+43
-10
sql.y
dlls/msi/sql.y
+43
-10
db.c
dlls/msi/tests/db.c
+0
-0
No files found.
dlls/msi/sql.y
View file @
c07b554e
...
@@ -58,7 +58,7 @@ static LPWSTR parser_add_table( LPWSTR list, LPWSTR table );
...
@@ -58,7 +58,7 @@ static LPWSTR parser_add_table( LPWSTR list, LPWSTR table );
static void *parser_alloc( void *info, unsigned int sz );
static void *parser_alloc( void *info, unsigned int sz );
static column_info *parser_alloc_column( void *info, LPCWSTR table, LPCWSTR column );
static column_info *parser_alloc_column( void *info, LPCWSTR table, LPCWSTR column );
static BOOL SQL_MarkPrimaryKeys( column_info *cols, column_info *keys);
static BOOL SQL_MarkPrimaryKeys( column_info *
*
cols, column_info *keys);
static struct expr * EXPR_complex( void *info, struct expr *l, UINT op, struct expr *r );
static struct expr * EXPR_complex( void *info, struct expr *l, UINT op, struct expr *r );
static struct expr * EXPR_unary( void *info, struct expr *l, UINT op );
static struct expr * EXPR_unary( void *info, struct expr *l, UINT op );
...
@@ -289,7 +289,7 @@ onedrop:
...
@@ -289,7 +289,7 @@ onedrop:
table_def:
table_def:
column_def TK_PRIMARY TK_KEY selcollist
column_def TK_PRIMARY TK_KEY selcollist
{
{
if( SQL_MarkPrimaryKeys( $1, $4 ) )
if( SQL_MarkPrimaryKeys(
&
$1, $4 ) )
$$ = $1;
$$ = $1;
else
else
$$ = NULL;
$$ = NULL;
...
@@ -884,23 +884,56 @@ static struct expr * EXPR_sval( void *info, const struct sql_str *str )
...
@@ -884,23 +884,56 @@ static struct expr * EXPR_sval( void *info, const struct sql_str *str )
return e;
return e;
}
}
static BOOL SQL_MarkPrimaryKeys( column_info *cols,
static void swap_columns( column_info **cols, column_info *A, int idx )
{
column_info *preA = NULL, *preB = NULL, *B, *ptr;
int i = 0;
B = NULL;
ptr = *cols;
while( ptr )
{
if( i++ == idx )
B = ptr;
else if( !B )
preB = ptr;
if( ptr->next == A )
preA = ptr;
ptr = ptr->next;
}
if( preB ) preB->next = A;
if( preA ) preA->next = B;
ptr = A->next;
A->next = B->next;
B->next = ptr;
if( idx == 0 )
*cols = A;
}
static BOOL SQL_MarkPrimaryKeys( column_info **cols,
column_info *keys )
column_info *keys )
{
{
column_info *k;
column_info *k;
BOOL found = TRUE;
BOOL found = TRUE;
int count;
for( k = keys
; k && found; k = k->next
)
for( k = keys
, count = 0; k && found; k = k->next, count++
)
{
{
column_info *c;
column_info *c;
int idx;
found = FALSE;
found = FALSE;
for( c = cols; c && !found; c = c->next )
for( c = *cols, idx = 0; c && !found; c = c->next, idx++ )
{
{
if( lstrcmpW( k->column, c->column ) )
if( lstrcmpW( k->column, c->column ) )
continue;
continue;
c->type |= MSITYPE_KEY;
c->type |= MSITYPE_KEY;
found = TRUE;
found = TRUE;
if (idx != count)
swap_columns( cols, c, count );
}
}
}
}
...
...
dlls/msi/tests/db.c
View file @
c07b554e
This diff is collapsed.
Click to expand it.
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