diff --git a/.travis.yml b/.travis.yml index c363c5cced3b63e91fe6fb6e8a6db4baa23289b6..938db4734b20cda0cd03f3fe94fd182a4864f0ad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,12 +13,12 @@ go: - 1.4.1 - 1.4.2 -env: GOARCH=amd64 TEST_HOST=127.0.0.1 +env: GOARCH=amd64 TEST_HOST=127.0.0.1 UPPERIO_DB_DEBUG=1 install: - - sudo apt-get install bzr - # - go get github.com/cznic/ql/ql # ql command line util. - # - go install github.com/cznic/ql/ql # ql command line util. + - sudo apt-get install -y bzr make + - go get github.com/cznic/ql/ql # ql command line util. + - go install github.com/cznic/ql/ql # ql command line util. - mkdir ../../../upper.io - ln -s $PWD ../../../upper.io/db - go get -t -d @@ -35,11 +35,24 @@ before_script: - mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql - cat mysql/_dumps/setup.sql | mysql -uroot - cat mysql/_dumps/structs.sql | mysql -uupperio -pupperio upperio_tests + - cat postgresql/_dumps/setup.sql | psql -U postgres - cat postgresql/_dumps/structs.sql | PGPASSWORD="upperio" psql -U upperio upperio_tests + - mongo upperio_tests --eval 'db.addUser("upperio", "upperio")' + + - (cd mysql/_dumps && make) + - (cd postgresql/_dumps && make) + - (cd sqlite/_dumps && make) + - (cd ql/_dumps && make) + # - cat ql/_dumps/structs.sql | $GOPATH/bin/ql -db ql/_dumps/test.db script: - go test upper.io/db/util/sqlgen -test.bench=. - - UPPERIO_DB_DEBUG=1 go test -test.v=1 + - go test upper.io/db/postgresql -test.bench=. + - go test upper.io/db/mysql -test.bench=. + - go test upper.io/db/sqlite -test.bench=. + - go test upper.io/db/ql -test.bench=. + - go test upper.io/db/mongo -test.bench=. + - go test -test.v diff --git a/mysql/_dumps/Makefile b/mysql/_dumps/Makefile index 5e9b4f17c51413eec7ced1a74cea64aa3e70e253..fb1b4e28247a353505402c796fec0018420ad638 100644 --- a/mysql/_dumps/Makefile +++ b/mysql/_dumps/Makefile @@ -1,2 +1,4 @@ +TEST_HOST ?= 127.0.0.1 + all: - cat structs.sql | mysql -uupperio -pupperio upperio_tests -htestserver.local + cat structs.sql | mysql -uupperio -pupperio upperio_tests -h$(TEST_HOST) diff --git a/postgresql/_dumps/Makefile b/postgresql/_dumps/Makefile index 675048196a990e22c46df5ac45a4eac2ea0c9818..83de0013912ec7f3ef76d69fd8bb4fd45f5b5a54 100644 --- a/postgresql/_dumps/Makefile +++ b/postgresql/_dumps/Makefile @@ -1,2 +1,4 @@ +TEST_HOST ?= 127.0.0.1 + all: - cat structs.sql | PGPASSWORD="upperio" psql -Uupperio upperio_tests -htestserver.local + cat structs.sql | PGPASSWORD="upperio" psql -Uupperio upperio_tests -h$(TEST_HOST) diff --git a/postgresql/database.go b/postgresql/database.go index f66ad5fc6a4baab675572c254c5eb0367d13af34..cab0a90573cd918a41ae14c546fac61410bef1cf 100644 --- a/postgresql/database.go +++ b/postgresql/database.go @@ -541,7 +541,7 @@ func (d *database) getPrimaryKey(tableName string) ([]string, error) { sqlgen.ColumnWithName(`pg_attribute.attname`), ), Where: sqlgen.WhereConditions( - sqlgen.RawValue(`pg_class.oid = '`+tableName+`'::regclass`), + sqlgen.RawValue(`pg_class.oid = '"`+tableName+`"'::regclass`), sqlgen.RawValue(`indrelid = pg_class.oid`), sqlgen.RawValue(`pg_attribute.attrelid = pg_class.oid`), sqlgen.RawValue(`pg_attribute.attnum = ANY(pg_index.indkey)`), diff --git a/ql/_dumps/Makefile b/ql/_dumps/Makefile index cba56b0150415fb40b311ce885b8d59a497ff8b8..1703af5222b0476e569a542c0cc26cdefd13489d 100644 --- a/ql/_dumps/Makefile +++ b/ql/_dumps/Makefile @@ -1,3 +1,3 @@ all: rm -f test.db - cat structs.sql | ql -db test.db + cat structs.sql | $$GOPATH/bin/ql -db test.db