Giter VIP home page Giter VIP logo

rdbms's Introduction

XP Framework

Build Status on TravisCI BSD Licence Required PHP 5.3+

This is the XP Framework's development checkout for the 5.X-SERIES.

Note: Development now focusses on the 6.X-SERIES, which are maintained in the xp-framework/core repository. Bugfixes may be backported, but new features will usually only go to 6.X

Installation

Clone this repository, e.g. using Git Read-Only:

$ cd [path]
$ git clone git://github.com/xp-framework/xp-framework.git

Directory structure

[path]/xp-framework
`- core
   |- ChangeLog         # Version log
   |- boot.pth          # Bootstrap classpath
   |- tools             # Bootstrapping (lang.base.php, class.php, xar.php, web.php)
   `- src               # Sourcecode, by Maven conventions
      |- main
      |  `- php
      `- test
         |- php
         |- config      # Unittest configuration
         `- resources   # Test resources

Runners

The entry point for software written in the XP Framework is not the PHP interpreter's CLI / web server API but either a command line runner or a specialized web entry point. These runners can be installed by using the following one-liner:

$ cd ~/bin
$ wget 'https://github.com/xp-framework/xp-runners/releases/download/v6.2.0/setup' -O - | php

Using it

To use the the XP Framework development checkout, put the following in your ~/bin/xp.ini file:

use=[path]/xp-framework/core

Enjoy!

Contributing

To contribute, use the GitHub way - fork, hack, and submit a pull request!

rdbms's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

rdbms's Issues

Missing default value for lenth field in MySQLi implementation

The tableAttributeFrom function in rdbms.mysqli.MySQLiDBAdapter enforces the Type of a record to have a length. For example the type text does not have this field, so it fails with

Uncaught exception: Exception lang.IndexOutOfBoundsException (Undefined offset: 3)
  at <main>::__error(8, (0x13)'Undefined offset: 3', (0x69)'/home/idev/dev/temp/codegen/vendor/xp-framework/rdbms/src/main/p', 108, array[2]) [line 108 of MySQLiDBAdapter.class.php]

In the MySQL implementation this is fixed with a default value

  public static function tableAttributeFrom($record) {
    preg_match('#^([a-z]+)(\(([0-9,]+)\))?#', $record['Type'], $regs);
    return new DBTableAttribute(
      $record['Field'],                                         // name
      self::$map[$regs[1]],                                     // type
      false !== strpos($record['Extra'], 'auto_increment'),     // identity
      !(empty($record['Null']) || ('NO' == $record['Null'])),   // nullable
      (int)(isset($regs[3]) ? $regs[3] : 0),                    // length
      0,                                                        // precision
      0                                                         // scale
    );
  }

Fix HHVM

  • Fatal error: Unable to open database: unable to open database file - see https://travis-ci.org/xp-framework/rdbms/jobs/63626399
  • Fatal error: Declaration of rdbms\criterion\SimpleProjection::asSql() must be compatible with that of rdbms\SQLRenderable::asSql() in /home/travis/build/xp-framework/rdbms/src/main/php/rdbms/criterion/SimpleProjection.class.php on line 14 - see https://travis-ci.org/xp-framework/rdbms/jobs/64997716
  • unittest.AssertionFailedError{ expected [lang.types.Bytes(8)@{UAXNPP\O}] but was [lang.types.Bytes(8)@{@@@@@@@@}] using: 'equals' } in rdbms.unittest.mysql.MySqlPasswordTest::protocol40

Close connection when packet no. out of order

The connection should be reset when packet no. out of order as the connection is unusable!

Reproduce

  1. Open connection (e.g. using ISQL)
  2. Restart MariaDB server (using kill will not do the job!)
  3. Wait, then issue a query: *** Exception rdbms.SQLStatementFailedException (errorcode -1: Packet no. out of order, have 0, expecting 1
  4. Issue another query: *** Exception rdbms.SQLStatementFailedException (errorcode -1: Packet no. out of order, have 35, expecting 1)
  5. etcetera...

Integration tests failing on HHVM

See https://travis-ci.org/xp-framework/rdbms/jobs/135264912:

F unittest.TestWarning(test= rdbms.unittest.integration.MySQLIntegrationTest::connectFailedThrowsException, time= 0.134 seconds) {
  [""mysql_connect(): Access denied for user 'wrong-user'@'localhost' (using password: YES)" in mysqli::hh_real_connect() (, line 0, occured once)"]
 }

ร—: 45/104 run (59 skipped), 44 succeeded, 1 failed
Memory used: 2048.00 kB (2048.00 kB peak)
Time taken: 5.856 seconds

Dataset generator doesn't detect PK in postgresql

When creating dataset classes with the framework's generator the primary keys doesn't get detected for postgresql databases. Therefore no getBy() methods are created and after saving a new row the value of the auto increment column remains unset in the object.

Expose mock implementation?

The rdbms.unittest.mock package has been picked by several of our libraries to emulate certain result sets.

With the current location with the mock package being within src/test, a library cannot pick it any more. Should we expose it to src/main, possibly as rdbms.mock package?

No SQLiteDBAdapter available

In commit 1101dca, all of the sqlite package was removed in favor of the sqlite3 package. That package, however, does not have an SQLiteDBAdapter, so we cannot do reflection on these kinds of databases any more.

Furthermore, we're now having an unresolved dependency in xp.codegen.dataset.Generator.

I suggest to extract the removed class from the referenced commit and add it to the sqlite3 package.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.