151 lines
2.2 KiB
Go
151 lines
2.2 KiB
Go
package sqlite
|
|
|
|
// Lookup returns the named statement.
|
|
func Lookup(name string) string {
|
|
return index[name]
|
|
}
|
|
|
|
var index = map[string]string{
|
|
"files-find-build": filesFindBuild,
|
|
"files-find-proc-name": filesFindProcName,
|
|
"files-find-proc-name-data": filesFindProcNameData,
|
|
"files-delete-build": filesDeleteBuild,
|
|
"procs-find-id": procsFindId,
|
|
"procs-find-build": procsFindBuild,
|
|
"procs-find-build-pid": procsFindBuildPid,
|
|
"procs-find-build-ppid": procsFindBuildPpid,
|
|
"procs-delete-build": procsDeleteBuild,
|
|
}
|
|
|
|
var filesFindBuild = `
|
|
SELECT
|
|
file_id
|
|
,file_build_id
|
|
,file_proc_id
|
|
,file_name
|
|
,file_mime
|
|
,file_size
|
|
,file_time
|
|
FROM files
|
|
WHERE file_build_id = ?
|
|
`
|
|
|
|
var filesFindProcName = `
|
|
SELECT
|
|
file_id
|
|
,file_build_id
|
|
,file_proc_id
|
|
,file_name
|
|
,file_mime
|
|
,file_size
|
|
,file_time
|
|
FROM files
|
|
WHERE file_proc_id = ?
|
|
AND file_name = ?
|
|
`
|
|
|
|
var filesFindProcNameData = `
|
|
SELECT
|
|
file_id
|
|
,file_build_id
|
|
,file_proc_id
|
|
,file_name
|
|
,file_mime
|
|
,file_size
|
|
,file_time
|
|
,file_data
|
|
FROM files
|
|
WHERE file_proc_id = ?
|
|
AND file_name = ?
|
|
`
|
|
|
|
var filesDeleteBuild = `
|
|
DELETE FROM files WHERE file_build_id = ?
|
|
`
|
|
|
|
var procsFindId = `
|
|
SELECT
|
|
proc_id
|
|
,proc_build_id
|
|
,proc_pid
|
|
,proc_ppid
|
|
,proc_pgid
|
|
,proc_name
|
|
,proc_state
|
|
,proc_error
|
|
,proc_exit_code
|
|
,proc_started
|
|
,proc_stopped
|
|
,proc_machine
|
|
,proc_platform
|
|
,proc_environ
|
|
FROM procs
|
|
WHERE proc_id = ?
|
|
`
|
|
|
|
var procsFindBuild = `
|
|
SELECT
|
|
proc_id
|
|
,proc_build_id
|
|
,proc_pid
|
|
,proc_ppid
|
|
,proc_pgid
|
|
,proc_name
|
|
,proc_state
|
|
,proc_error
|
|
,proc_exit_code
|
|
,proc_started
|
|
,proc_stopped
|
|
,proc_machine
|
|
,proc_platform
|
|
,proc_environ
|
|
FROM procs
|
|
WHERE proc_build_id = ?
|
|
`
|
|
|
|
var procsFindBuildPid = `
|
|
SELECT
|
|
proc_id
|
|
,proc_build_id
|
|
,proc_pid
|
|
,proc_ppid
|
|
,proc_pgid
|
|
,proc_name
|
|
,proc_state
|
|
,proc_error
|
|
,proc_exit_code
|
|
,proc_started
|
|
,proc_stopped
|
|
,proc_machine
|
|
,proc_platform
|
|
,proc_environ
|
|
FROM procs
|
|
WHERE proc_build_id = ?
|
|
AND proc_pid = ?
|
|
`
|
|
|
|
var procsFindBuildPpid = `
|
|
SELECT
|
|
proc_id
|
|
,proc_build_id
|
|
,proc_pid
|
|
,proc_ppid
|
|
,proc_pgid
|
|
,proc_name
|
|
,proc_state
|
|
,proc_error
|
|
,proc_exit_code
|
|
,proc_started
|
|
,proc_stopped
|
|
,proc_machine
|
|
,proc_platform
|
|
,proc_environ
|
|
FROM procs
|
|
WHERE proc_build_id = ?
|
|
AND proc_ppid = ?
|
|
AND proc_name = ?
|
|
`
|
|
|
|
var procsDeleteBuild = `
|
|
DELETE FROM procs WHERE proc_build_id = ?
|
|
`
|