kazuyamaa/multi-language-messages-01 huggingface dataset:
Task: Flatten a list
C: #include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct list_t list_t, *list;
struct list_t{
	int is_list, ival; 
	list *lst;
};

list new_list()
{
	list x = malloc(sizeof(list_t));
	x->ival = 0;
	x->is_list = 1;
	x->lst = 0;
	return x;
}

void append(list parent, list child)
{
	parent->lst = realloc(parent->lst, sizeof(list) * (parent->ival + 1));
	parent->lst[parent->ival++] = child;
}

list from_string(char *s, char **e, list parent)
{
	list ret = 0;
	if (!parent) parent = new_list();

	while (*s != '\0') {
		if (*s == ']') {
			if (e) *e = s + 1;
			return parent;
		}
		if (*s == '[') {
			ret = new_list();
			ret->is_list = 1;
			ret->ival = 0;
			append(parent, ret);
			from_string(s + 1, &s, ret);
			continue;
		}
		if (*s >= '0' && *s <= '9') {
			ret = new_list();
			ret->is_list = 0;
			ret->ival = strtol(s, &s, 10);
			append(parent, ret);
			continue;
		}
		s++;
	}

	if (e) *e = s;
	return parent;
}

void show_list(list l)
{
	int i;
	if (!l) return;
	if (!l->is_list) {
		printf("%d", l->ival);
		return;
	}

	printf("[");
	for (i = 0; i < l->ival; i++) {
		show_list(l->lst[i]);
		if (i < l->ival - 1) printf(", ");
	}
	printf("]");
}

list flatten(list from, list to)
{
	int i;
	list t;

	if (!to) to = new_list();
	if (!from->is_list) {
		t = new_list();
		*t = *from;
		append(to, t);
	} else
		for (i = 0; i < from->ival; i++)
			flatten(from->lst[i], to);
	return to;
}

void delete_list(list l)
{
	int i;
	if (!l) return;
	if (l->is_list && l->ival) {
		for (i = 0; i < l->ival; i++)
			delete_list(l->lst[i]);
		free(l->lst);
	}

	free(l);
}

int main()
{
	list l = from_string("[1], 2, [[3,4], 5], [[[]]], [[[6]]], 7, 8, []", 0, 0);

	printf("Nested: ");
	show_list(l);
	printf("\n");

	list flat = flatten(l, 0);
	printf("Flattened: ");
	show_list(flat);

	
	return 0;
}

PHP: 
while (array_filter($lst, 'is_array'))
    $lst = call_user_func_array('array_merge', $lst);
Task: Flatten a list
C#: using System;
using System.Collections;
using System.Linq;

namespace RosettaCodeTasks
{
	static class FlattenList
	{
		public static ArrayList Flatten(this ArrayList List)
		{
			ArrayList NewList = new ArrayList ( );

			NewList.AddRange ( List );

			while ( NewList.OfType<ArrayList> ( ).Count ( ) > 0 )
			{
				int index = NewList.IndexOf ( NewList.OfType<ArrayList> ( ).ElementAt ( 0 ) );
				ArrayList Temp = (ArrayList)NewList[index];
				NewList.RemoveAt ( index );
				NewList.InsertRange ( index, Temp );
			}
			
			return NewList;
		}
	}
}

PHP: 
while (array_filter($lst, 'is_array'))
    $lst = call_user_func_array('array_merge', $lst);
Task: Flatten a list
C++: #include <list>
#include <boost/any.hpp>

typedef std::list<boost::any> anylist;

void flatten(std::list<boost::any>& list)
{
  typedef anylist::iterator iterator;

  iterator current = list.begin();
  while (current != list.end())
  {
    if (current->type() == typeid(anylist))
    {
      iterator next = current;
      ++next;
      list.splice(next, boost::any_cast<anylist&>(*current));
      current = list.erase(current);
    }
    else
      ++current;
  }
}

PHP: 
while (array_filter($lst, 'is_array'))
    $lst = call_user_func_array('array_merge', $lst);
Task: Flatten a list
Go: package main

import "fmt"

func list(s ...interface{}) []interface{} {
    return s
}

func main() {
    s := list(list(1),
        2,
        list(list(3, 4), 5),
        list(list(list())),
        list(list(list(6))),
        7,
        8,
        list(),
    )
    fmt.Println(s)
    fmt.Println(flatten(s))
}

func flatten(s []interface{}) (r []int) {
    for _, e := range s {
        switch i := e.(type) {
        case int:
            r = append(r, i)
        case []interface{}:
            r = append(r, flatten(i)...)
        }
    }
    return
}

PHP: 
while (array_filter($lst, 'is_array'))
    $lst = call_user_func_array('array_merge', $lst);
Task: Flatten a list
Java: import java.util.LinkedList;
import java.util.List;


public final class FlattenUtil {

	public static List<Object> flatten(List<?> list) {
		List<Object> retVal = new LinkedList<Object>();
		flatten(list, retVal);
		return retVal;
	}

	public static void flatten(List<?> fromTreeList, List<Object> toFlatList) {
		for (Object item : fromTreeList) {
			if (item instanceof List<?>) {
				flatten((List<?>) item, toFlatList);
			} else {
				toFlatList.add(item);
			}
		}
	}
}

PHP: 
while (array_filter($lst, 'is_array'))
    $lst = call_user_func_array('array_merge', $lst);
Task: Flatten a list
Python: >>> def flatten(lst):
	return sum( ([x] if not isinstance(x, list) else flatten(x)
		     for x in lst), [] )

>>> lst = [[1], 2, [[3,4], 5], [[[]]], [[[6]]], 7, 8, []]
>>> flatten(lst)
[1, 2, 3, 4, 5, 6, 7, 8]

PHP: 
while (array_filter($lst, 'is_array'))
    $lst = call_user_func_array('array_merge', $lst);
Task: Flatten a list
VB: class flattener
	dim separator 
	
	sub class_initialize
		separator = ","
	end sub
	
	private function makeflat( a )
		dim i
		dim res
		for i = lbound( a ) to ubound( a ) 
			if isarray( a( i ) ) then
				res = res & makeflat( a( i ) )
			else
				res = res & a( i ) & separator
			end if
		next
		makeflat = res
	end function

	public function flatten( a )
		dim res
		res = makeflat( a )
		res = left( res, len( res ) - len(separator))
		res = split( res, separator )
		flatten = res
	end function
	
	public property let itemSeparator( c )
		separator = c
	end property
end class

PHP: 
while (array_filter($lst, 'is_array'))
    $lst = call_user_func_array('array_merge', $lst);
Task: Exceptions
C: #include <setjmp.h>
 
enum { MY_EXCEPTION = 1 }; 
 
jmp_buf env;
 
void foo()
{
  longjmp(env, MY_EXCEPTION); 
}
 
void call_foo()
{
  switch (setjmp(env)) {
  case 0:                     
    foo();
    break;
  case MY_EXCEPTION:          
    
    break;
  default:
    
    
    
    
  }
}

C#: public class MyException : Exception
{
  
};
Task: Exceptions
C: #include <setjmp.h>
 
enum { MY_EXCEPTION = 1 }; 
 
jmp_buf env;
 
void foo()
{
  longjmp(env, MY_EXCEPTION); 
}
 
void call_foo()
{
  switch (setjmp(env)) {
  case 0:                     
    foo();
    break;
  case MY_EXCEPTION:          
    
    break;
  default:
    
    
    
    
  }
}

C++: struct MyException
{
  
};
Task: Exceptions
C: #include <setjmp.h>
 
enum { MY_EXCEPTION = 1 }; 
 
jmp_buf env;
 
void foo()
{
  longjmp(env, MY_EXCEPTION); 
}
 
void call_foo()
{
  switch (setjmp(env)) {
  case 0:                     
    foo();
    break;
  case MY_EXCEPTION:          
    
    break;
  default:
    
    
    
    
  }
}

Go: package main

import "fmt"

func foo() int {
	fmt.Println("let's foo...")
	defer func() {
		if e := recover(); e != nil {
			fmt.Println("Recovered from", e)
		}
	}()
	var a []int
	a[12] = 0
	fmt.Println("there's no point in going on.")
	panic("never reached")
	panic(fmt.Scan) 
}

func main() {
	foo()
	fmt.Println("glad that's over.")
}
Task: Exceptions
C: #include <setjmp.h>
 
enum { MY_EXCEPTION = 1 }; 
 
jmp_buf env;
 
void foo()
{
  longjmp(env, MY_EXCEPTION); 
}
 
void call_foo()
{
  switch (setjmp(env)) {
  case 0:                     
    foo();
    break;
  case MY_EXCEPTION:          
    
    break;
  default:
    
    
    
    
  }
}

Python: import exceptions
class SillyError(exceptions.Exception):
    def __init__(self,args=None):
         self.args=args
Task: Exceptions
C: #include <setjmp.h>
 
enum { MY_EXCEPTION = 1 }; 
 
jmp_buf env;
 
void foo()
{
  longjmp(env, MY_EXCEPTION); 
}
 
void call_foo()
{
  switch (setjmp(env)) {
  case 0:                     
    foo();
    break;
  case MY_EXCEPTION:          
    
    break;
  default:
    
    
    
    
  }
}

VB: Sub foo1()
    err.raise(vbObjectError + 1050)
End Sub

Sub foo2()
    Error vbObjectError + 1051
End Sub
Task: Exceptions
C++: struct MyException
{
  
};

Go: package main

import "fmt"

func foo() int {
	fmt.Println("let's foo...")
	defer func() {
		if e := recover(); e != nil {
			fmt.Println("Recovered from", e)
		}
	}()
	var a []int
	a[12] = 0
	fmt.Println("there's no point in going on.")
	panic("never reached")
	panic(fmt.Scan) 
}

func main() {
	foo()
	fmt.Println("glad that's over.")
}
Task: Exceptions
C++: struct MyException
{
  
};

Python: import exceptions
class SillyError(exceptions.Exception):
    def __init__(self,args=None):
         self.args=args
Task: Exceptions
C++: struct MyException
{
  
};

VB: Sub foo1()
    err.raise(vbObjectError + 1050)
End Sub

Sub foo2()
    Error vbObjectError + 1051
End Sub
Task: Exceptions
C#: public class MyException : Exception
{
  
};

Go: package main

import "fmt"

func foo() int {
	fmt.Println("let's foo...")
	defer func() {
		if e := recover(); e != nil {
			fmt.Println("Recovered from", e)
		}
	}()
	var a []int
	a[12] = 0
	fmt.Println("there's no point in going on.")
	panic("never reached")
	panic(fmt.Scan) 
}

func main() {
	foo()
	fmt.Println("glad that's over.")
}
Task: Exceptions
C#: public class MyException : Exception
{
  
};

Python: import exceptions
class SillyError(exceptions.Exception):
    def __init__(self,args=None):
         self.args=args
Task: Exceptions
C#: public class MyException : Exception
{
  
};

VB: Sub foo1()
    err.raise(vbObjectError + 1050)
End Sub

Sub foo2()
    Error vbObjectError + 1051
End Sub
Task: Exceptions
Go: package main

import "fmt"

func foo() int {
	fmt.Println("let's foo...")
	defer func() {
		if e := recover(); e != nil {
			fmt.Println("Recovered from", e)
		}
	}()
	var a []int
	a[12] = 0
	fmt.Println("there's no point in going on.")
	panic("never reached")
	panic(fmt.Scan) 
}

func main() {
	foo()
	fmt.Println("glad that's over.")
}

Java: 
public class MyException extends Exception {
   
}


public class MyRuntimeException extends RuntimeException {}
Task: Exceptions
Go: package main

import "fmt"

func foo() int {
	fmt.Println("let's foo...")
	defer func() {
		if e := recover(); e != nil {
			fmt.Println("Recovered from", e)
		}
	}()
	var a []int
	a[12] = 0
	fmt.Println("there's no point in going on.")
	panic("never reached")
	panic(fmt.Scan) 
}

func main() {
	foo()
	fmt.Println("glad that's over.")
}

Python: import exceptions
class SillyError(exceptions.Exception):
    def __init__(self,args=None):
         self.args=args
Task: Exceptions
Java: 
public class MyException extends Exception {
   
}


public class MyRuntimeException extends RuntimeException {}

Python: import exceptions
class SillyError(exceptions.Exception):
    def __init__(self,args=None):
         self.args=args
Task: Exceptions
Go: package main

import "fmt"

func foo() int {
	fmt.Println("let's foo...")
	defer func() {
		if e := recover(); e != nil {
			fmt.Println("Recovered from", e)
		}
	}()
	var a []int
	a[12] = 0
	fmt.Println("there's no point in going on.")
	panic("never reached")
	panic(fmt.Scan) 
}

func main() {
	foo()
	fmt.Println("glad that's over.")
}

VB: Sub foo1()
    err.raise(vbObjectError + 1050)
End Sub

Sub foo2()
    Error vbObjectError + 1051
End Sub
Task: Exceptions
Python: import exceptions
class SillyError(exceptions.Exception):
    def __init__(self,args=None):
         self.args=args

VB: Sub foo1()
    err.raise(vbObjectError + 1050)
End Sub

Sub foo2()
    Error vbObjectError + 1051
End Sub
Task: Exceptions
C: #include <setjmp.h>
 
enum { MY_EXCEPTION = 1 }; 
 
jmp_buf env;
 
void foo()
{
  longjmp(env, MY_EXCEPTION); 
}
 
void call_foo()
{
  switch (setjmp(env)) {
  case 0:                     
    foo();
    break;
  case MY_EXCEPTION:          
    
    break;
  default:
    
    
    
    
  }
}

Java: 
public class MyException extends Exception {
   
}


public class MyRuntimeException extends RuntimeException {}
Task: Exceptions
Java: 
public class MyException extends Exception {
   
}


public class MyRuntimeException extends RuntimeException {}

VB: Sub foo1()
    err.raise(vbObjectError + 1050)
End Sub

Sub foo2()
    Error vbObjectError + 1051
End Sub
Task: Exceptions
C: #include <setjmp.h>
 
enum { MY_EXCEPTION = 1 }; 
 
jmp_buf env;
 
void foo()
{
  longjmp(env, MY_EXCEPTION); 
}
 
void call_foo()
{
  switch (setjmp(env)) {
  case 0:                     
    foo();
    break;
  case MY_EXCEPTION:          
    
    break;
  default:
    
    
    
    
  }
}

PHP: class MyException extends Exception
{

}
Task: Exceptions
Go: package main

import "fmt"

func foo() int {
	fmt.Println("let's foo...")
	defer func() {
		if e := recover(); e != nil {
			fmt.Println("Recovered from", e)
		}
	}()
	var a []int
	a[12] = 0
	fmt.Println("there's no point in going on.")
	panic("never reached")
	panic(fmt.Scan) 
}

func main() {
	foo()
	fmt.Println("glad that's over.")
}

PHP: class MyException extends Exception
{

}
Task: Exceptions
Python: import exceptions
class SillyError(exceptions.Exception):
    def __init__(self,args=None):
         self.args=args

PHP: class MyException extends Exception
{

}
Task: Exceptions
VB: Sub foo1()
    err.raise(vbObjectError + 1050)
End Sub

Sub foo2()
    Error vbObjectError + 1051
End Sub

PHP: class MyException extends Exception
{

}
Task: Parameterized SQL statement
C#: using System.Data.Sql;
using System.Data.SqlClient;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            using var tConn = new SqlConnection("ConnectionString");

            using var tCommand = tConn.CreateCommand();
            tCommand.CommandText = "UPDATE players SET name = @name, score = @score, active = @active WHERE jerseyNum = @jerseyNum";

            tCommand.Parameters.Add(new SqlParameter("@name", System.Data.SqlDbType.VarChar).Value = "Smith, Steve");
            tCommand.Parameters.Add(new SqlParameter("@score", System.Data.SqlDbType.Int).Value = "42");
            tCommand.Parameters.Add(new SqlParameter("@active", System.Data.SqlDbType.Bit).Value = true);
            tCommand.Parameters.Add(new SqlParameter("@jerseyNum", System.Data.SqlDbType.Int).Value = "99");

            tCommand.ExecuteNonQuery();
        }
    }
}

C++: #include <QtSql>
#include <iostream>




int main(int argc, char *argv[]) {
    if (argc != 4) {
        std::cerr << "Usage: " << argv[0] << " data-source user password\n";
        return 1;
    }
    QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
    db.setDatabaseName(argv[1]);
    if (!db.open(argv[2], argv[3])) {
        auto error = db.lastError();
        std::cerr << "Cannot connect to data source: " << error.text().toStdString() << '\n';
    } else {
        std::cout << "Connected to data source.\n";
        QSqlQuery query(db);
        query.prepare("UPDATE players SET name = ?, score = ?, active = ? WHERE jerseyNum = ?");
        query.bindValue(0, "Smith, Steve");
        query.bindValue(1, 42);
        query.bindValue(2, true);
        query.bindValue(3, 99);
        if (!query.exec()) {
            auto error = db.lastError();
            std::cerr << "Cannot update database: " << error.text().toStdString() << '\n';
        } else {
            std::cout << "Update succeeded.\n";
        }
    }
    return 0;
}
Task: Parameterized SQL statement
C++: #include <QtSql>
#include <iostream>




int main(int argc, char *argv[]) {
    if (argc != 4) {
        std::cerr << "Usage: " << argv[0] << " data-source user password\n";
        return 1;
    }
    QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
    db.setDatabaseName(argv[1]);
    if (!db.open(argv[2], argv[3])) {
        auto error = db.lastError();
        std::cerr << "Cannot connect to data source: " << error.text().toStdString() << '\n';
    } else {
        std::cout << "Connected to data source.\n";
        QSqlQuery query(db);
        query.prepare("UPDATE players SET name = ?, score = ?, active = ? WHERE jerseyNum = ?");
        query.bindValue(0, "Smith, Steve");
        query.bindValue(1, 42);
        query.bindValue(2, true);
        query.bindValue(3, 99);
        if (!query.exec()) {
            auto error = db.lastError();
            std::cerr << "Cannot update database: " << error.text().toStdString() << '\n';
        } else {
            std::cout << "Update succeeded.\n";
        }
    }
    return 0;
}

Python: import sqlite3

db = sqlite3.connect(':memory:')


db.execute('create temp table players (name, score, active, jerseyNum)')
db.execute('insert into players values ("name",0,"false",99)')
db.execute('insert into players values ("name",0,"false",100)')




db.execute('update players set name=?, score=?, active=? where jerseyNum=?', ('Smith, Steve', 42, True, 99))


db.execute('update players set name=:name, score=:score, active=:active where jerseyNum=:num',
    {'num': 100,
     'name': 'John Doe',
     'active': False,
     'score': -1}
)


for row in db.execute('select * from players'):
   print(row)
Task: Parameterized SQL statement
C#: using System.Data.Sql;
using System.Data.SqlClient;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            using var tConn = new SqlConnection("ConnectionString");

            using var tCommand = tConn.CreateCommand();
            tCommand.CommandText = "UPDATE players SET name = @name, score = @score, active = @active WHERE jerseyNum = @jerseyNum";

            tCommand.Parameters.Add(new SqlParameter("@name", System.Data.SqlDbType.VarChar).Value = "Smith, Steve");
            tCommand.Parameters.Add(new SqlParameter("@score", System.Data.SqlDbType.Int).Value = "42");
            tCommand.Parameters.Add(new SqlParameter("@active", System.Data.SqlDbType.Bit).Value = true);
            tCommand.Parameters.Add(new SqlParameter("@jerseyNum", System.Data.SqlDbType.Int).Value = "99");

            tCommand.ExecuteNonQuery();
        }
    }
}

Go: package main

import (
    "database/sql"
    "fmt"

    _ "github.com/mattn/go-sqlite3"
)

func main() {
    db, _ := sql.Open("sqlite3", "rc.db")
    defer db.Close()
    db.Exec(`create table players (name, score, active, jerseyNum)`)
    db.Exec(`insert into players values ("",0,0,"99")`)
    db.Exec(`insert into players values ("",0,0,"100")`)

    
    db.Exec(`update players set name=?, score=?, active=? where jerseyNum=?`,
        "Smith, Steve", 42, true, "99")

    rows, _ := db.Query("select * from players")
    var (
        name      string
        score     int
        active    bool
        jerseyNum string
    )
    for rows.Next() {
        rows.Scan(&name, &score, &active, &jerseyNum)
        fmt.Printf("%3s %12s %3d %t\n", jerseyNum, name, score, active)
    }
    rows.Close()
}
Task: Parameterized SQL statement
C#: using System.Data.Sql;
using System.Data.SqlClient;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            using var tConn = new SqlConnection("ConnectionString");

            using var tCommand = tConn.CreateCommand();
            tCommand.CommandText = "UPDATE players SET name = @name, score = @score, active = @active WHERE jerseyNum = @jerseyNum";

            tCommand.Parameters.Add(new SqlParameter("@name", System.Data.SqlDbType.VarChar).Value = "Smith, Steve");
            tCommand.Parameters.Add(new SqlParameter("@score", System.Data.SqlDbType.Int).Value = "42");
            tCommand.Parameters.Add(new SqlParameter("@active", System.Data.SqlDbType.Bit).Value = true);
            tCommand.Parameters.Add(new SqlParameter("@jerseyNum", System.Data.SqlDbType.Int).Value = "99");

            tCommand.ExecuteNonQuery();
        }
    }
}

Java: import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
 
public class DBDemo{
   private String protocol; 
   private String dbName;   
   private String username;
   private String password;

   PreparedStatement query;
 
   public int setUpAndExecPS(){
      try {
         Connection conn = DriverManager.getConnection(protocol + dbName, username, password);

         query = conn.prepareStatement(
            "UPDATE players SET name = ?, score = ?, active = ? WHERE jerseyNum = ?");
 
         query.setString(1, "Smith, Steve");
         query.setInt(2, 42);
         query.setBoolean(3, true);
         query.setInt(4, 99);
         
         return query.executeUpdate();
         
         

      } catch (Exception e) {
         e.printStackTrace();
      }

      return 0;
   }
}
Task: Parameterized SQL statement
Go: package main

import (
    "database/sql"
    "fmt"

    _ "github.com/mattn/go-sqlite3"
)

func main() {
    db, _ := sql.Open("sqlite3", "rc.db")
    defer db.Close()
    db.Exec(`create table players (name, score, active, jerseyNum)`)
    db.Exec(`insert into players values ("",0,0,"99")`)
    db.Exec(`insert into players values ("",0,0,"100")`)

    
    db.Exec(`update players set name=?, score=?, active=? where jerseyNum=?`,
        "Smith, Steve", 42, true, "99")

    rows, _ := db.Query("select * from players")
    var (
        name      string
        score     int
        active    bool
        jerseyNum string
    )
    for rows.Next() {
        rows.Scan(&name, &score, &active, &jerseyNum)
        fmt.Printf("%3s %12s %3d %t\n", jerseyNum, name, score, active)
    }
    rows.Close()
}

Java: import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
 
public class DBDemo{
   private String protocol; 
   private String dbName;   
   private String username;
   private String password;

   PreparedStatement query;
 
   public int setUpAndExecPS(){
      try {
         Connection conn = DriverManager.getConnection(protocol + dbName, username, password);

         query = conn.prepareStatement(
            "UPDATE players SET name = ?, score = ?, active = ? WHERE jerseyNum = ?");
 
         query.setString(1, "Smith, Steve");
         query.setInt(2, 42);
         query.setBoolean(3, true);
         query.setInt(4, 99);
         
         return query.executeUpdate();
         
         

      } catch (Exception e) {
         e.printStackTrace();
      }

      return 0;
   }
}
Task: Parameterized SQL statement
Go: package main

import (
    "database/sql"
    "fmt"

    _ "github.com/mattn/go-sqlite3"
)

func main() {
    db, _ := sql.Open("sqlite3", "rc.db")
    defer db.Close()
    db.Exec(`create table players (name, score, active, jerseyNum)`)
    db.Exec(`insert into players values ("",0,0,"99")`)
    db.Exec(`insert into players values ("",0,0,"100")`)

    
    db.Exec(`update players set name=?, score=?, active=? where jerseyNum=?`,
        "Smith, Steve", 42, true, "99")

    rows, _ := db.Query("select * from players")
    var (
        name      string
        score     int
        active    bool
        jerseyNum string
    )
    for rows.Next() {
        rows.Scan(&name, &score, &active, &jerseyNum)
        fmt.Printf("%3s %12s %3d %t\n", jerseyNum, name, score, active)
    }
    rows.Close()
}

Python: import sqlite3

db = sqlite3.connect(':memory:')


db.execute('create temp table players (name, score, active, jerseyNum)')
db.execute('insert into players values ("name",0,"false",99)')
db.execute('insert into players values ("name",0,"false",100)')




db.execute('update players set name=?, score=?, active=? where jerseyNum=?', ('Smith, Steve', 42, True, 99))


db.execute('update players set name=:name, score=:score, active=:active where jerseyNum=:num',
    {'num': 100,
     'name': 'John Doe',
     'active': False,
     'score': -1}
)


for row in db.execute('select * from players'):
   print(row)