func (db *DB) InitializeNewTables(schemaName string, schemaSpec string) (err error) {
	// Use the schema
	if _, err = db.DBHandler.Exec("USE " + schemaName + ";"); err != nil {
		err = fmt.Errorf("Could not use %s schema: \n%s", schemaName, err)
		return
	}
	for _, chain := range db.coinList {
		tableQuery := fmt.Sprintf("CREATE OR REPLACE TABLE %s (%s);", chain.Name, schemaSpec)
		if _, err = db.DBHandler.Exec(tableQuery); err != nil {
			err = fmt.Errorf("Could not create table %s: \n%s", chain.Name, err)
			return
		}
		deleteQuery := fmt.Sprintf("DELETE FROM %s;", chain.Name)
		if _, err = db.DBHandler.Exec(deleteQuery); err != nil {
			err = fmt.Errorf("Could not delete stuff from table after creating: \n%s", err)
			return
		}
	}
	return
}
// InitializeNewTables initializes tables based on schema and clears them.
InitializeNewTables initializes tables based on schema and clears them.
// InitializeNewTables initializes tables based on schema and clears them .
func (db *DB) InitializeNewTables(schemaName string, schemaSpec string) (err error) {
	if _, err = db.DBHandler.Exec("USE " + schemaName + ";"); err != nil {
		err = fmt.Errorf("Could not use %s schema: \n%s", schemaName, err)
		return
	}
	for _, chain := range db.coinList {
		tableQuery := fmt.Sprintf("CREATE OR REPLACE TABLE %s (%s);", chain.Name, schemaSpec)
		if _, err = db.DBHandler.Exec(tableQuery); err != nil {
			err = fmt.Errorf("Could not create table %s: \n%s", chain.Name, err)
			return
		}
		deleteQuery := fmt.Sprintf("DELETE FROM %s;", chain.Name)
		if _, err = db.DBHandler.Exec(deleteQuery); err != nil {
			err = fmt.Errorf("Could not delete stuff from table after creating: \n%s", err)
			return
		}
	}
	return
}
func ( db * DB ) InitializeNewTables ( schemaName string , schemaSpec string ) ( err error ) { if _ , err = db . DBHandler . Exec ( " " + schemaName + " " ) ; err != nil { err = fmt . Errorf ( " \n " , schemaName , err ) return } for _ , chain := range db . coinList { tableQuery := fmt . Sprintf ( " " , chain . Name , schemaSpec ) if _ , err = db . DBHandler . Exec ( tableQuery ) ; err != nil { err = fmt . Errorf ( " \n " , chain . Name , err ) return } deleteQuery := fmt . Sprintf ( " " , chain . Name ) if _ , err = db . DBHandler . Exec ( deleteQuery ) ; err != nil { err = fmt . Errorf ( " \n " , err ) return } } return }
InitializeNewTables initializes tables based on schema and clears them.
InitializeNewTables initializes tables based on schema and clears them .
// Use the schema