Skip to content

Commit

Permalink
Redme updated
Browse files Browse the repository at this point in the history
  • Loading branch information
michalderkacz committed Sep 26, 2012
1 parent 0e05c70 commit 1d94ebe
Showing 1 changed file with 40 additions and 3 deletions.
43 changes: 40 additions & 3 deletions README.md
@@ -1,14 +1,17 @@
Sorry for my poor English. If you can help with improving the English in this Sorry for my poor English. If you can help with improving the English in this
documentation, please contact me. documentation, please contact me.


## MyMySQL v0.4.11 (2012-09-14) ## MyMySQL v1.0 (2012-09-26)


This package contains MySQL client API written entirely in Go. It works with This package contains MySQL client API written entirely in Go. It works with
the MySQL protocol version 4.1 or greater. It definitely works well with MySQL the MySQL protocol version 4.1 or greater. It definitely works well with MySQL
5.0 and 5.1 (I use these versions of MySQL servers for my applications). 5.0 and 5.1 (I use these versions of MySQL servers for my applications).


## Changelog ## Changelog


v1.0: Transactions added to autorc, new Transaction.IsValid method. I think
this library is mature enough to release it as v1.0

v0.4.11: Add Reconnect, Register, SetMaxPktSize, Bind to autorc. v0.4.11: Add Reconnect, Register, SetMaxPktSize, Bind to autorc.


v0.4.10: New *Clone* method for create connection from other connection. v0.4.10: New *Clone* method for create connection from other connection.
Expand Down Expand Up @@ -499,6 +502,41 @@ This is the improved code of the previous example:
} }
} }


### Example 9 - transactions using autorc

import (
"github.com/ziutek/mymysql/autorc"
_ "github.com/ziutek/mymysql/thrsafe" // You may also use the native engine
)

// [...]

db := autorc.New("tcp", "", "127.0.0.1:3306", user, pass, dbname)

var stmt1, stmt2 autorc.Stmt

func updateDb() {
err := db.PrepareOnce(&stmt1, someSQL1)
checkDbErr(err)
err = db.PrepareOnce(&stmt2, someSQL2)
checkDbErr(err)

err = db.Begin(func(tr mysql.Transaction, args ...interface{}) error {
// This function will be called again if returns a recoverable error
s1 := tr.Do(stmt1.Raw)
s2 := tr.Do(stmt2.Raw)
if _, err := s1.Run(); err != nil {
return err
}
if _, err := s2.Run(); err != nil {
return err
}
// You have to commit or rollback before return
return tr.Commit()
})
checkDbErr(err)
}

Additional examples are in *examples* directory. Additional examples are in *examples* directory.


## Type mapping ## Type mapping
Expand Down Expand Up @@ -628,8 +666,7 @@ application befor put it into production. There is example output from siege:


## To do ## To do


1. Transactions in auto reconnect interface. 1. Complete documentation
2. Complete documentation


## Known bugs ## Known bugs


Expand Down

0 comments on commit 1d94ebe

Please sign in to comment.