Linux vmi284606.contaboserver.net 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64
Apache/2.4.57 (Ubuntu)
: 167.86.127.34 | : 216.73.217.31
Cant Read [ /etc/named.conf ]
7.2.24-0ubuntu0.18.04.17
root
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
README
+ Create Folder
+ Create File
/
usr /
local /
go /
src /
database /
sql /
[ HOME SHELL ]
Name
Size
Permission
Action
driver
[ DIR ]
drwxr-xr-x
convert.go
16.04
KB
-rw-r--r--
convert_test.go
17.13
KB
-rw-r--r--
ctxutil.go
3.49
KB
-rw-r--r--
doc.txt
2.07
KB
-rw-r--r--
example_cli_test.go
2.03
KB
-rw-r--r--
example_service_test.go
3.91
KB
-rw-r--r--
example_test.go
8.48
KB
-rw-r--r--
fakedb_test.go
29.26
KB
-rw-r--r--
sql.go
89.92
KB
-rw-r--r--
sql_test.go
96.33
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : example_cli_test.go
// Copyright 2018 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 sql_test import ( "context" "database/sql" "flag" "log" "os" "os/signal" "time" ) var pool *sql.DB // Database connection pool. func Example_openDBCLI() { id := flag.Int64("id", 0, "person ID to find") dsn := flag.String("dsn", os.Getenv("DSN"), "connection data source name") flag.Parse() if len(*dsn) == 0 { log.Fatal("missing dsn flag") } if *id == 0 { log.Fatal("missing person ID") } var err error // Opening a driver typically will not attempt to connect to the database. pool, err = sql.Open("driver-name", *dsn) if err != nil { // This will not be a connection error, but a DSN parse error or // another initialization error. log.Fatal("unable to use data source name", err) } defer pool.Close() pool.SetConnMaxLifetime(0) pool.SetMaxIdleConns(3) pool.SetMaxOpenConns(3) ctx, stop := context.WithCancel(context.Background()) defer stop() appSignal := make(chan os.Signal, 3) signal.Notify(appSignal, os.Interrupt) go func() { select { case <-appSignal: stop() } }() Ping(ctx) Query(ctx, *id) } // Ping the database to verify DSN provided by the user is valid and the // server accessible. If the ping fails exit the program with an error. func Ping(ctx context.Context) { ctx, cancel := context.WithTimeout(ctx, 1*time.Second) defer cancel() if err := pool.PingContext(ctx); err != nil { log.Fatalf("unable to connect to database: %v", err) } } // Query the database for the information requested and prints the results. // If the query fails exit the program with an error. func Query(ctx context.Context, id int64) { ctx, cancel := context.WithTimeout(ctx, 5*time.Second) defer cancel() var name string err := pool.QueryRowContext(ctx, "select p.name from people as p where p.id = :id;", sql.Named("id", id)).Scan(&name) if err != nil { log.Fatal("unable to execute search query", err) } log.Println("name=", name) }
Close