Also trying to get how many records are in the database but it also only returns "1".
Code: Select all
bind pub - !size size
proc size {nick uhost handle chan arg} {
global mysql libMySQLTcl
set mysql(handle) [mysqlconnect -host $mysql(host) -user $mysql(user) -password $mysql(pass) -port $mysql(port) -db $mysql(db)]
mysqluse $mysql(handle) $mysql(db)
set test [mysqlsel $mysql(handle) "SELECT SUM((DATA_LENGTH + INDEX_LENGTH - DATA_FREE) / 1024 / 1024) FROM INFORMATION_SCHEMA.tables WHERETABLE_SCHEMA = 'mydatabase' AND TABLE_NAME = 'mytable';"]
putserv "privmsg $chan : $test "
mysqlclose $mysql(handle)
Code: Select all
bind pub - !records records
proc records {nick uhost handle chan arg} {
global mysql libMySQLTcl
set mysql(handle) [mysqlconnect -host $mysql(host) -user $mysql(user) -password $mysql(pass) -port $mysql(port) -db $mysql(db)]
mysqluse $mysql(handle) $mysql(db)
set test [mysqlsel $mysql(handle) "SELECT SUM(Auto_increment) FROM INFORMATION_SCHEMA.tables WHERE TABLE_SCHEMA = 'mydatabase' AND TABLE_NAME ='mytable';"]
putserv "privmsg $chan :$test"
mysqlclose $mysql(handle)
}
Code: Select all
set test [mysql::fetch $mysql(handle)]
Code: Select all
bind pub - !size size
proc size {nick uhost handle chan arg} {
global mysql libMySQLTcl
set mysql(handle) [mysqlconnect -host $mysql(host) -user $mysql(user) -password $mysql(pass) -port $mysql(port) -db $mysql(db)]
mysqluse $mysql(handle) $mysql(db)
set test [mysqlsel $mysql(handle) "SELECT SUM((DATA_LENGTH + INDEX_LENGTH - DATA_FREE) / 1024 / 1024) FROM INFORMATION_SCHEMA.tables WHERETABLE_SCHEMA = 'mydatabase' AND TABLE_NAME = 'mytable';"]
set test [mysql::fetch $mysql(handle)]
putserv "privmsg $chan : $test "
mysqlclose $mysql(handle)
Code: Select all
bind pub - !records records
proc records {nick uhost handle chan arg} {
global mysql libMySQLTcl
set mysql(handle) [mysqlconnect -host $mysql(host) -user $mysql(user) -password $mysql(pass) -port $mysql(port) -db $mysql(db)]
mysqluse $mysql(handle) $mysql(db)
set test [mysqlsel $mysql(handle) "select count(*) from db.table;"]
set test [mysql::fetch $mysql(handle)]
putserv "privmsg $chan :$test"
mysqlclose $mysql(handle)
}