我有一个有3.72亿行的表,我想删除从第一个开始的旧行而不阻塞数据库.我该怎么做到?
桌子有
id | memberid | type | timeStamp | message |
1 123 10 2014-03-26 13:17:02.000 text
Run Code Online (Sandbox Code Playgroud)
更新:
我在数据库中删除了大约30 GB的空间,但我的DISC仍然是6 GB的空间..有任何建议可以获得这个空闲空间吗?
先感谢您!
我在想是否可以发送shell来执行Client-Server ipconfig.那可能吗?
这是我在本地的代码:
class Comando {
public static void main(String args[]) {
String s = null;
try {
// Determinar en qué SO estamos
String so = System.getProperty("os.name");
String comando;
// Comando para Linux
if (so.equals("Linux"))
comando = "ifconfig";
// Comando para Windows
else
comando = "ipconfig";
// Ejcutamos el comando
Process p = Runtime.getRuntime().exec(comando);
BufferedReader stdInput = new BufferedReader(new InputStreamReader(
p.getInputStream()));
BufferedReader stdError = new BufferedReader(new InputStreamReader(
p.getErrorStream()));
// Leemos la salida del comando
System.out.println("Ésta es la salida standard …Run Code Online (Sandbox Code Playgroud) 我有一个html表单,我将值放入数据库中.但是当我插入它们时,值会出现在数据库中,如"".
这是我插入值的方式:
title, author, description := r.Form("title"), r.FormValue("author"), r.FormValue("description")
fmt.Println(title, author, description)
rows, err := db.Query("INSERT INTO apps (title, author, description) VALUES ($1, $2, $3)",
title, author, description)
PanicIf(err)
defer rows.Close()
http.Redirect(w, r, "/myapps", http.StatusFound)
db.Close()
Run Code Online (Sandbox Code Playgroud)
Html:
<form action="/apps" method="POST">
<div class="form-group">
<label>Name</label>
<input type="text" class="form-control" name="title" />
</div>
<div class="form-group">
<label>Author</label>
<input type="text" class="form-control" name="author" />
</div>
<div class="form-group">
<label>Description</label>
<input type="text" class="form-control" name="description" />
</div>
<input type="submit" value="Create" class="btn btn-success" />
<a href="/myapps">
<input type="button" value="Return" class="btn btn-primary" …Run Code Online (Sandbox Code Playgroud) 当我按下"+"按钮时,我正在尝试创建一个新列.
我遇到的问题是:
我单击按钮,它会在最后一列之后生成一列.我怎么能在之前生成它?
我把桌子放在这里:
<table>
<tr>
<td><input value = "0"/></td>
<td><input value = "0"/></td>
<td><input value = "0"/></td>
<td class="total">0</td>
</tr>
<tr>
<td><input value = "0"/></td>
<td><input value = "0"/></td>
<td><input value = "0"/></td>
<td class="total">0</td>
</tr>
<tr>
<td><input value = "0"/></td>
<td><input value = "0"/></td>
<td><input value = "0"/></td>
<td class="total">0</td>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud)
那是我目前的代码:
非常感谢你!
我试图通过这种方式获取数据库的值。但是当我转到 /myapps 方向时,编译器会抛出一个错误。
结构:
type App struct{
Title string
Author string
Description string
}
Run Code Online (Sandbox Code Playgroud)
功能:
func myappsHandler(w http.ResponseWriter, r *http.Request){
db, err := sql.Open("postgres"," user=postgres dbname=lesson4 host=localhost password=1234 sslmode=disable")
if err != nil{
log.Fatal(err)
}
rows, err := db.Query(`SELECT title, author, description FROM apps
WHERE title ILIKE $1
OR author ILIKE $1
OR description ILIKE $1`)
defer rows.Close()
if err != nil{
log.Fatal(err)
}
apps := []App{}
for rows.Next(){
b := App{}
err := rows.Scan(&b.Title, &b.Author, &b.Description)
if err != …Run Code Online (Sandbox Code Playgroud) 我有一个登录表单,当我点击发送时,我将页面重定向到一个/create.在那里我检查一个GO函数,如果我的登录值是正确的,以访问下一页,但我的功能有问题.
loginCheck:
func loginCheck(w http.ResponseWriter, r* http.Request){
r.ParseForm()
//Call the DB function
db:= SetupDB()
name, password := r.FormValue("user"), r.FormValue("password")
hashedPassword, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
PanicIf(err)
rows, err := db.Query("SELECT name, password from users where name = $1 and password = $2" ,name, hashedPassword)
PanicIf(err)
defer rows.Close()
for rows.Next() {
err := rows.Scan(&name, &hashedPassword)
PanicIf(err)
fmt.Println(name, hashedPassword)
}
db.Close()
}
Run Code Online (Sandbox Code Playgroud)
我试图打印rows.Next()内的值,以查看是否从数据库中读取值,但它是空的.
我在容器中有一个项目,我尝试使用 gd lib 进行图像创建。
我在容器的 bash 中执行此命令:
apt-get install php5-gd
Run Code Online (Sandbox Code Playgroud)
重启并执行后没有任何变化 php -m
我该怎么办?
编辑:
我添加到我的 Dockerfile:
RUN apt-get -qq update && apt-get -qq install libpng-dev
RUN docker-php-ext-install gd
Run Code Online (Sandbox Code Playgroud)
我执行 docker build -t [name]
但是当我执行 bash 并输入: php -m
[PHP Modules]
Core
ctype
curl
date
dom
ereg
fileinfo
filter
ftp
hash
iconv
json
libxml
mbstring
mysql
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
Reflection
session
SimpleXML
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zip
zlib
Run Code Online (Sandbox Code Playgroud) go ×3
html ×3
postgresql ×2
sql ×2
docker ×1
dockerfile ×1
gd ×1
java ×1
jquery ×1
large-data ×1
php ×1
request ×1
return-value ×1
shell ×1
sql-server ×1
templates ×1