Skip to content

oph is a hack to use out parameters in MySQL stored procedures with Go sql drivers

License

Notifications You must be signed in to change notification settings

qpliu/out-parameter-hack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

oph is a hack to use out parameters in MySQL stored procedures with Go sql drivers.

GoDoc Build Status

Example

	db, err := sql.Open("mymysql", "DBNAME/USER/PASSWD")
	if err != nil {
		panic(err)
	}
	defer db.Close()

	// CALL EXAMPLE('example',1,NULL,@outString)
	var outString sql.NullString
	if err := oph.Call(db, func(resultSetIndex int, rows *sql.Rows) error {
		for rows.Next() {
			var id int64
			var name sql.NullString
			rows.Scan(&id, &name)
		}
		return rows.Err()
	}, "EXAMPLE", "example", 1, nil, &outString); err != nil {
		panic(err)
	}

About

oph is a hack to use out parameters in MySQL stored procedures with Go sql drivers

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages