mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
make sqlite.DB public; make string.left/right private
This commit is contained in:
parent
84a6c019e8
commit
e1132156f5
@ -470,7 +470,7 @@ pub fn (s string) split_into_lines() []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 'hello'.left(2) => 'he'
|
// 'hello'.left(2) => 'he'
|
||||||
pub fn (s string) left(n int) string {
|
fn (s string) left(n int) string {
|
||||||
if n >= s.len {
|
if n >= s.len {
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
@ -478,7 +478,7 @@ pub fn (s string) left(n int) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 'hello'.right(2) => 'llo'
|
// 'hello'.right(2) => 'llo'
|
||||||
pub fn (s string) right(n int) string {
|
fn (s string) right(n int) string {
|
||||||
if n >= s.len {
|
if n >= s.len {
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
|
@ -669,7 +669,7 @@ fn (p mut Parser) check_unused_and_mut_vars() {
|
|||||||
p.production_error_with_token_index('`$var.name` declared and not used', var.token_idx)
|
p.production_error_with_token_index('`$var.name` declared and not used', var.token_idx)
|
||||||
}
|
}
|
||||||
if !var.is_changed && var.is_mut && !p.pref.is_repl && !p.pref.translated && var.typ != 'T*' && p.mod != 'ui' && var.typ != 'App*' {
|
if !var.is_changed && var.is_mut && !p.pref.is_repl && !p.pref.translated && var.typ != 'T*' && p.mod != 'ui' && var.typ != 'App*' {
|
||||||
//p.warn_or_error('`$var.name` is declared as mutable, but it was never changed')
|
p.warn_or_error('`$var.name` is declared as mutable, but it was never changed')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,12 +8,12 @@ module sqlite
|
|||||||
struct C.sqlite3
|
struct C.sqlite3
|
||||||
struct C.sqlite3_stmt
|
struct C.sqlite3_stmt
|
||||||
|
|
||||||
struct DB {
|
pub struct DB {
|
||||||
mut:
|
mut:
|
||||||
conn &C.sqlite3
|
conn &C.sqlite3
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Row {
|
pub struct Row {
|
||||||
pub mut:
|
pub mut:
|
||||||
vals []string
|
vals []string
|
||||||
}
|
}
|
||||||
@ -39,6 +39,7 @@ fn C.sqlite3_open()
|
|||||||
fn C.sqlite3_step() int
|
fn C.sqlite3_step() int
|
||||||
fn C.sqlite3_prepare_v2()
|
fn C.sqlite3_prepare_v2()
|
||||||
fn C.sqlite3_finalize()
|
fn C.sqlite3_finalize()
|
||||||
|
fn C.sqlite3_column_count(voidptr) int
|
||||||
|
|
||||||
pub fn (db DB) q_string(query string) string {
|
pub fn (db DB) q_string(query string) string {
|
||||||
stmt := &C.sqlite3_stmt(0)
|
stmt := &C.sqlite3_stmt(0)
|
||||||
@ -49,7 +50,6 @@ pub fn (db DB) q_string(query string) string {
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
fn C.sqlite3_column_count(voidptr) int
|
|
||||||
|
|
||||||
pub fn (db DB) exec(query string) []Row {
|
pub fn (db DB) exec(query string) []Row {
|
||||||
stmt := &C.sqlite3_stmt(0)
|
stmt := &C.sqlite3_stmt(0)
|
||||||
|
Loading…
Reference in New Issue
Block a user