2 namespace RedUNIT\CUBRID;
3 use RedBeanPHP\Facade as R;
4 use \RedBeanPHP\QueryWriter\CUBRID as CUBRID;
9 * Tests for CUBRID Query Writer.
10 * This test class contains Query Writer specific tests.
11 * Use this class to add tests to test Query Writer specific
12 * behaviours, quirks and issues.
14 * @file RedUNIT/CUBRID/Writer.php
15 * @desc A collection of database specific writer functions.
16 * @author Gabor de Mooij and the RedBeanPHP Community
17 * @license New BSD/GPLv2
19 * (c) G.J.G.T. (Gabor) de Mooij and the RedBeanPHP Community.
20 * This source file is subject to the New BSD/GPLv2 License that is bundled
21 * with this source code in the file license.txt.
23 class Writer extends \RedUNIT\CUBRID
26 * Test scanning and coding of values.
30 public function testScanningAndCoding()
32 $toolbox = R::getToolBox();
33 $adapter = $toolbox->getDatabaseAdapter();
34 $writer = $toolbox->getWriter();
35 $redbean = $toolbox->getRedBean();
36 $pdo = $adapter->getDatabase();
38 $writer->createTable( "testtable" );
40 $writer->addColumn( "testtable", "special", CUBRID::C_DATATYPE_SPECIAL_DATE );
42 $cols = $writer->getColumns( "testtable" );
44 asrt( $writer->code( $cols['special'], TRUE ), CUBRID::C_DATATYPE_SPECIAL_DATE );
46 asrt( $writer->code( $cols['special'], FALSE ), CUBRID::C_DATATYPE_SPECIFIED );
48 $writer->addColumn( "testtable", "special2", CUBRID::C_DATATYPE_SPECIAL_DATETIME );
50 $cols = $writer->getColumns( "testtable" );
52 asrt( $writer->code( $cols['special2'], TRUE ), CUBRID::C_DATATYPE_SPECIAL_DATETIME );
54 asrt( $writer->code( $cols['special'], FALSE ), CUBRID::C_DATATYPE_SPECIFIED );