| 47 | } |
| 48 | |
| 49 | func ConnectAll() { |
| 50 | var err error |
| 51 | |
| 52 | pgdsn := os.Getenv("SQLX_POSTGRES_DSN") |
| 53 | mydsn := os.Getenv("SQLX_MYSQL_DSN") |
| 54 | sqdsn := os.Getenv("SQLX_SQLITE_DSN") |
| 55 | |
| 56 | TestPostgres = pgdsn != "skip" |
| 57 | TestMysql = mydsn != "skip" |
| 58 | TestSqlite = sqdsn != "skip" |
| 59 | |
| 60 | if !strings.Contains(mydsn, "parseTime=true") { |
| 61 | mydsn += "?parseTime=true" |
| 62 | } |
| 63 | |
| 64 | if TestPostgres { |
| 65 | pgdb, err = Connect("postgres", pgdsn) |
| 66 | if err != nil { |
| 67 | fmt.Printf("Disabling PG tests:\n %v\n", err) |
| 68 | TestPostgres = false |
| 69 | } |
| 70 | } else { |
| 71 | fmt.Println("Disabling Postgres tests.") |
| 72 | } |
| 73 | |
| 74 | if TestMysql { |
| 75 | mysqldb, err = Connect("mysql", mydsn) |
| 76 | if err != nil { |
| 77 | fmt.Printf("Disabling MySQL tests:\n %v", err) |
| 78 | TestMysql = false |
| 79 | } |
| 80 | } else { |
| 81 | fmt.Println("Disabling MySQL tests.") |
| 82 | } |
| 83 | |
| 84 | if TestSqlite { |
| 85 | sldb, err = Connect("sqlite3", sqdsn) |
| 86 | if err != nil { |
| 87 | fmt.Printf("Disabling SQLite:\n %v", err) |
| 88 | TestSqlite = false |
| 89 | } |
| 90 | } else { |
| 91 | fmt.Println("Disabling SQLite tests.") |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | type Schema struct { |
| 96 | create string |