Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/use parseddls #65

Merged
merged 2 commits into from
Jul 1, 2021

Conversation

nktks
Copy link
Contributor

@nktks nktks commented Jun 22, 2021

Hi.

I fixed this usecase.

cat test.sql
-- CREATE NULL_FILTERED INDEX test ON test(test);
CREATE TABLE test(
  test          STRING(36) NOT NULL,
) PRIMARY KEY(test);
go run main.go generate --from-ddl test.sql
error: syntax error:test.sql:1:49: expected token: CREATE, <ident>, but: <eof>

  1:  -- CREATE NULL_FILTERED INDEX test ON test(test)
                                                      ^

exit status 1

This error is caused that yo parse multiple ddls in schema string by using strings.Split(string(b), ";") .
If schema string include comment with semicolon such as-- .*; ,
parse will fail.

So I change to use ParseDDLs on memefish.
This can skip comment collectly.
And I fixed some failed test.

I agreed CLA.
https://cla.developers.google.com/

@kazegusuri
Copy link
Collaborator

Ah I see. Looks good!! Sorry for late.

@kazegusuri kazegusuri merged commit 5c127a3 into cloudspannerecosystem:master Jul 1, 2021
@nktks nktks deleted the fix/use-parseddls branch July 1, 2021 08:37
@nktks
Copy link
Contributor Author

nktks commented Jul 1, 2021

thx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants