<commit_before>// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package sqlite

import (
	"fmt"
)

// Check database integrity
// (See http://www.sqlite.org/pragma.html#pragma_integrity_check
// and http://www.sqlite.org/pragma.html#pragma_quick_check)
// TODO Make possible to specify the database-name (PRAGMA %Q.integrity_check(.))
func (c *Conn) IntegrityCheck(max int, quick bool) error {
	var pragma string
	if quick {
		pragma = "quick"
	} else {
		pragma = "integrity"
	}
	var msg string
	err := c.OneValue(fmt.Sprintf("PRAGMA %s_check(%d)", pragma, max), &msg)
	if err != nil {
		return err
	}
	if msg != "ok" {
		return c.specificError("Integrity check failed (%s)", msg)
	}
	return nil
}

// Returns the text encoding used by the main database
// (See http://sqlite.org/pragma.html#pragma_encoding)
// TODO Make possible to specify the database-name (PRAGMA %Q.encoding)
func (c *Conn) Encoding() (string, error) {
	var encoding string
	err := c.OneValue("PRAGMA encoding", &encoding)
	if err != nil {
		return "", err
	}
	return encoding, nil
}

// (See http://sqlite.org/pragma.html#pragma_schema_version)
// TODO Make possible to specify the database-name (PRAGMA %Q.schema_version)
func (c *Conn) SchemaVersion() (int, error) {
	var version int
	err := c.OneValue("PRAGMA schema_version", &version)
	if err != nil {
		return -1, err
	}
	return version, nil
}<commit_msg>Add SetRecursiveTriggers helper.<commit_after>// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package sqlite

import (
	"fmt"
)

// Check database integrity
// (See http://www.sqlite.org/pragma.html#pragma_integrity_check
// and http://www.sqlite.org/pragma.html#pragma_quick_check)
// TODO Make possible to specify the database-name (PRAGMA %Q.integrity_check(.))
func (c *Conn) IntegrityCheck(max int, quick bool) error {
	var pragma string
	if quick {
		pragma = "quick"
	} else {
		pragma = "integrity"
	}
	var msg string
	err := c.OneValue(fmt.Sprintf("PRAGMA %s_check(%d)", pragma, max), &msg)
	if err != nil {
		return err
	}
	if msg != "ok" {
		return c.specificError("Integrity check failed (%s)", msg)
	}
	return nil
}

// Returns the text encoding used by the main database
// (See http://sqlite.org/pragma.html#pragma_encoding)
// TODO Make possible to specify the database-name (PRAGMA %Q.encoding)
func (c *Conn) Encoding() (string, error) {
	var encoding string
	err := c.OneValue("PRAGMA encoding", &encoding)
	if err != nil {
		return "", err
	}
	return encoding, nil
}

// (See http://sqlite.org/pragma.html#pragma_schema_version)
// TODO Make possible to specify the database-name (PRAGMA %Q.schema_version)
func (c *Conn) SchemaVersion() (int, error) {
	var version int
	err := c.OneValue("PRAGMA schema_version", &version)
	if err != nil {
		return -1, err
	}
	return version, nil
}

// (See http://sqlite.org/pragma.html#pragma_recursive_triggers)
// TODO Make possible to specify the database-name (PRAGMA %Q.recursive_triggers=%)
func (c *Conn) SetRecursiveTriggers(on bool) error {
	return c.exec(fmt.Sprintf("PRAGMA recursive_triggers=%t", on))
}
{'fraction_non_alphanumeric': 0.13201219512195123, 'fraction_numerical': 0.003048780487804878, 'mean_word_length': 3.986322188449848, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '279371', 'n_tokens_mistral': 1116, 'n_tokens_neox': 1089, 'n_words': 353}