mirror of
https://gitea.invidious.io/iv-org/shard-crystal-sqlite3.git
synced 2024-08-15 00:53:26 +00:00
add insert/select per type specs
add last_insert_id add Driver.quote
This commit is contained in:
parent
add75d86bf
commit
2e6e6ed7e5
3 changed files with 67 additions and 9 deletions
|
@ -13,6 +13,10 @@ class SQLite3::Connection < DB::Connection
|
|||
LibSQLite3.close_v2(self)
|
||||
end
|
||||
|
||||
def last_insert_id : Int64
|
||||
LibSQLite3.last_insert_rowid(self)
|
||||
end
|
||||
|
||||
def to_unsafe
|
||||
@db
|
||||
end
|
||||
|
|
|
@ -2,6 +2,12 @@ class SQLite3::Driver < DB::Driver
|
|||
def build_connection
|
||||
SQLite3::Connection.new(options)
|
||||
end
|
||||
|
||||
# Quotes the given string, making it safe to use in an SQL statement.
|
||||
# It replaces all instances of the single-quote character with two single-quote characters.
|
||||
def self.quote(string)
|
||||
string.gsub('\'', "''")
|
||||
end
|
||||
end
|
||||
|
||||
DB.register_driver "sqlite3", SQLite3::Driver
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue