ShellBanner
System:Linux MiraNet 3.0.0-14-generic-pae #23-Ubuntu SMP Mon Nov 21 22:07:10 UTC 2011 i686
Software:Apache. PHP/5.3.6-13ubuntu3.10
ID:uid=65534(nobody) gid=65534(nogroup) groups=65534(nogroup)
Safe Mode:OFF
Open_Basedir:OFF
Freespace:24.02 GB of 70.42 GB (34.11%)
MySQL: ON MSSQL: OFF Oracle: OFF PostgreSQL: OFF Curl: OFF Sockets: ON Fetch: OFF Wget: ON Perl: ON
Disabled Functions: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,

/ usr/ share/ doc/ libinnodb-dev/ examples/ - drwxr-xr-x

Directory:
Viewing file:     ib_compressed.c (2.95 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
/***********************************************************************
Copyright (c) 2009 Innobase Oy. All rights reserved.
Copyright (c) 2009 Oracle. All rights reserved.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

************************************************************************/

/* Simple test that creates a few compressed tables and checks
for valid page_size */

#include <stdio.h>
#include <stdlib.h>

#include "innodb.h"

#include "test0aux.h"

/* use a common database name "test" so it can be cleaned up by
"make test-clean" if we exit abnormally */
#ifdef DBNAME
#undef DBNAME
#endif /* DBNAME */
#define DBNAME    "test"

/* use a name that is not going to collide with names from other tests */
#define TABLENAME    DBNAME "/t_compressed"

int
main(int argc, char* argv[])
{
    ib_tbl_sch_t    ib_tbl_sch = NULL;
    ib_id_t        table_id;
    int        valid_page_sizes[] = {0, 1, 2, 4, 8, 16};
    int        invalid_page_sizes[] = {3, 5, 6, 14, 17, 32, 128, 301};
    int        i;

    OK(ib_init());

    test_configure();

    OK(ib_startup("barracuda"));

    OK(ib_cfg_set("file_per_table", IB_TRUE));

    OK(ib_database_create(DBNAME));

    for (i = 0;
         i < sizeof(valid_page_sizes) / sizeof(valid_page_sizes[0]);
         i++) {

        ib_trx_t    ib_trx;

        OK(ib_table_schema_create(TABLENAME, &ib_tbl_sch,
                      IB_TBL_COMPRESSED,
                      valid_page_sizes[i]));

        OK(ib_table_schema_add_col(ib_tbl_sch, "c1", IB_INT,
                       IB_COL_UNSIGNED, 0 /* ignored */,
                       sizeof(int)));

        ib_trx = ib_trx_begin(IB_TRX_REPEATABLE_READ);

        OK(ib_schema_lock_exclusive(ib_trx));

        OK(ib_table_create(ib_trx, ib_tbl_sch, &table_id));

        OK(ib_trx_commit(ib_trx));

        ib_table_schema_delete(ib_tbl_sch);

        ib_trx = ib_trx_begin(IB_TRX_REPEATABLE_READ);

        OK(ib_schema_lock_exclusive(ib_trx));

        OK(ib_table_drop(ib_trx, TABLENAME));

        OK(ib_trx_commit(ib_trx));
    }

    for (i = 0;
         i < sizeof(invalid_page_sizes) / sizeof(invalid_page_sizes[0]);
         i++) {

        ib_err_t    ib_err;

        ib_err = ib_table_schema_create(TABLENAME, &ib_tbl_sch,
                        IB_TBL_COMPRESSED,
                        invalid_page_sizes[i]);

        if (ib_err == DB_SUCCESS) {
            fprintf(stderr, "Creating a compressed table with "
                "page size %d succeeded but should have "
                "failed", invalid_page_sizes[i]);
            exit(EXIT_FAILURE);
        }

    }

    /* ignore errors as there may be tables left over from other tests */
    OK(ib_database_drop(DBNAME));

    OK(ib_shutdown(IB_SHUTDOWN_NORMAL));

    return(EXIT_SUCCESS);
}
Command:
Quick Commands:
Upload:
[Read-Only] Max size: 100MB
PHP Filesystem: <@ Ú
Search File:
regexp
Create File:
Overwrite [Read-Only]
View File:
Mass Defacement:
[+] Main Directory: [+] Defacement Url:
LmfaoX Shell - Private Build [BETA] - v0.1 -; Generated: 0.2774 seconds