2017-02-03 13:52:32 +00:00
|
|
|
package storage
|
|
|
|
|
|
|
|
import (
|
|
|
|
"database/sql"
|
2017-03-27 09:00:28 +00:00
|
|
|
|
|
|
|
"github.com/matrix-org/dendrite/common"
|
2017-02-03 13:52:32 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type statements struct {
|
2017-03-27 09:00:28 +00:00
|
|
|
common.PartitionOffsetStatements
|
2017-02-15 14:43:19 +00:00
|
|
|
eventTypeStatements
|
|
|
|
eventStateKeyStatements
|
|
|
|
roomStatements
|
|
|
|
eventStatements
|
|
|
|
eventJSONStatements
|
|
|
|
stateSnapshotStatements
|
|
|
|
stateBlockStatements
|
2017-02-21 14:50:30 +00:00
|
|
|
previousEventStatements
|
2017-02-03 13:52:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *statements) prepare(db *sql.DB) error {
|
|
|
|
var err error
|
|
|
|
|
2017-03-27 09:00:28 +00:00
|
|
|
if err = s.PartitionOffsetStatements.Prepare(db); err != nil {
|
2017-02-03 13:52:32 +00:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-02-15 14:43:19 +00:00
|
|
|
if err = s.eventTypeStatements.prepare(db); err != nil {
|
2017-02-03 13:52:32 +00:00
|
|
|
return err
|
|
|
|
}
|
2017-02-07 17:20:05 +00:00
|
|
|
|
2017-02-15 14:43:19 +00:00
|
|
|
if err = s.eventStateKeyStatements.prepare(db); err != nil {
|
2017-02-07 17:20:05 +00:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-02-15 14:43:19 +00:00
|
|
|
if err = s.roomStatements.prepare(db); err != nil {
|
2017-02-07 17:20:05 +00:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-02-15 14:43:19 +00:00
|
|
|
if err = s.eventStatements.prepare(db); err != nil {
|
2017-02-03 13:52:32 +00:00
|
|
|
return err
|
|
|
|
}
|
2017-02-07 17:20:05 +00:00
|
|
|
|
2017-02-15 14:43:19 +00:00
|
|
|
if err = s.eventJSONStatements.prepare(db); err != nil {
|
2017-02-07 17:20:05 +00:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-02-15 14:43:19 +00:00
|
|
|
if err = s.stateSnapshotStatements.prepare(db); err != nil {
|
|
|
|
return err
|
2017-02-15 11:05:45 +00:00
|
|
|
}
|
|
|
|
|
2017-02-15 14:43:19 +00:00
|
|
|
if err = s.stateBlockStatements.prepare(db); err != nil {
|
|
|
|
return err
|
2017-02-15 11:05:45 +00:00
|
|
|
}
|
|
|
|
|
2017-02-21 14:50:30 +00:00
|
|
|
if err = s.previousEventStatements.prepare(db); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-02-15 11:05:45 +00:00
|
|
|
return nil
|
|
|
|
}
|