Repository: proullon/ramsql (go)

Issue:
Bug(regression): Relation attrIndex keys are in lower case but lookup is not
Started to get this error after upgrading from `v0.0.1` to `v0.1.0`: 
```Go
"attribute not defined"
```

I have this table definition:

```SQL
CREATE TABLE DalgoE2E_E2ETest1 (ID1 VARCHAR(10) PRIMARY KEY, StringProp TEXT, IntegerProp INT);
```

And am trying to query data as:
```SQL
SELECT StringProp, IntegerProp FROM DalgoE2E_E2ETest1
```

Column names comes to the `func (r *Relation) Attribute(name string) (int, Attribute, error)` in original CamelCase but are in lower case in `Relation.attrIndex`.

I believe [this line](https://github.com/proullon/ramsql/blob/e12c9872c05dfd96f12daef316ce7398581defac/engine/agnostic/relation.go#L60) should bring the `name` to lowercase like:

```Go
index, ok := r.attrIndex[strings.ToLower(name)]
```




Pull request:
fix: (close #86) AttributeSelector uses lower case to match attributes

Patch:
diff --git a/engine/agnostic/predicate.go b/engine/agnostic/predicate.go
index 0b24062..807d1ca 100644
--- a/engine/agnostic/predicate.go
+++ b/engine/agnostic/predicate.go
@@ -574,16 +574,18 @@ func (s *AttributeSelector) Select(cols []string, in []*list.Element) (out []*Tu
 	idx := make([]int, len(s.attributes))
 	for attrIdx, attr := range s.attributes {
 		idx[attrIdx] = -1
+		lattr := strings.ToLower(attr)
 		for i, c := range cols {
-			if c == attr {
+			lc := strings.ToLower(c)
+			if lc == lattr {
 				idx[attrIdx] = i
 				break
 			}
-			if c == s.relation+"."+attr {
+			if lc == s.relation+"."+lattr {
 				idx[attrIdx] = i
 				break
 			}
-			if s.alias+"."+c == attr {
+			if s.alias+"."+lc == lattr {
 				idx[attrIdx] = i
 				break
 			}


Test patch:
diff --git a/driver/driver_test.go b/driver/driver_test.go
index 14e425b..43385b2 100644
--- a/driver/driver_test.go
+++ b/driver/driver_test.go
@@ -176,6 +176,29 @@ func TestSelectWhereAttribute(t *testing.T) {
 	}
 }
 
+func TestSelectCamelCase(t *testing.T) {
+	db, err := sql.Open("ramsql", "TestSelectCamelCase")
+	if err != nil {
+		t.Fatalf("sql.Open : Error : %s\n", err)
+	}
+	defer db.Close()
+
+	_, err = db.Exec("CREATE TABLE account (id INT, email_snake TEXT, TestCamelCase TEXT)")
+	if err != nil {
+		t.Fatalf("sql.Exec: Error: %s\n", err)
+	}
+
+	_, err = db.Query(`SELECT email_snake FROM account WHERE "account".id = 1`)
+	if err != nil {
+		t.Fatalf("sql.Query snake_case error : %s", err)
+	}
+
+	_, err = db.Query(`SELECT TestCamelCase FROM account WHERE "account".id = 1`)
+	if err != nil {
+		t.Fatalf("sql.Query CamelCase error : %s", err)
+	}
+}
+
 func TestSelectSimplePredicate(t *testing.T) {
 	db, err := sql.Open("ramsql", "TestSelectSimplePredicate")
 	if err != nil {
@@ -299,7 +322,7 @@ func TestBatch(t *testing.T) {
 		`INSERT INTO user_addresses (address_id, user_id) VALUES (4, 5);`,
 	}
 
-	log.SetLevel(log.InfoLevel)
+	log.SetLevel(log.WarningLevel)
 
 	db, err := sql.Open("ramsql", "TestLoadUserAddresses")
 	if err != nil {
@@ -2140,7 +2163,7 @@ func TestOrderByMultipleStrings(t *testing.T) {
 }
 
 func TestSelectNoOp(t *testing.T) {
-	log.SetLevel(log.InfoLevel)
+	log.SetLevel(log.WarningLevel)
 
 	db, err := sql.Open("ramsql", "TestSelectNoOp")
 	if err != nil {
diff --git a/driver/tx_test.go b/driver/tx_test.go
index 64c8777..0913619 100644
--- a/driver/tx_test.go
+++ b/driver/tx_test.go
@@ -70,7 +70,7 @@ func execTestTransactionQuery(t *testing.T, db *sql.DB, wg *sync.WaitGroup) {
 }
 
 func TestTransactionRollback(t *testing.T) {
-	log.SetLevel(log.InfoLevel)
+	log.SetLevel(log.WarningLevel)
 	defer log.SetLevel(log.ErrorLevel)
 
 	db, err := sql.Open("ramsql", "TestTransactionRollback")
diff --git a/engine/agnostic/transaction_test.go b/engine/agnostic/transaction_test.go
index 87092b4..e67c837 100644
--- a/engine/agnostic/transaction_test.go
+++ b/engine/agnostic/transaction_test.go
@@ -415,7 +415,7 @@ func TestIndexCreation(t *testing.T) {
 
 func TestQuery(t *testing.T) {
 	e := NewEngine()
-	log.SetLevel(log.InfoLevel)
+	log.SetLevel(log.WarningLevel)
 
 	tx, err := e.Begin()
 	if err != nil {
@@ -597,7 +597,7 @@ func TestQuery(t *testing.T) {
 
 func TestCount(t *testing.T) {
 	e := NewEngine()
-	log.SetLevel(log.InfoLevel)
+	log.SetLevel(log.WarningLevel)
 
 	tx, err := e.Begin()
 	if err != nil {
@@ -951,7 +951,7 @@ func TestIndex(t *testing.T) {
 
 func TestUpdate(t *testing.T) {
 	e := NewEngine()
-	log.SetLevel(log.InfoLevel)
+	log.SetLevel(log.WarningLevel)
 
 	tx, err := e.Begin()
 	if err != nil {