Giter Site home page Giter Site logo

redbean's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

redbean's Issues

SQLite typing issue

With the MySQL query writer, when creating columns, no type is associated:

public function addColumn( $table, $column, $type ) {
    $column = $this->check($column);
    $table = $this->check($table);
    $sql = "ALTER TABLE `$table` ADD `$column` "; // <== See this
    $this->adapter->exec( $sql );
}

This may result in wrong order when sorting columns that should be otherwise sorted numerically:

SELECT some_order_number FROM foo by some_order_number
results:
1
11
12
13
[...]
19
2
20
21
etc.

Specifying type solves the issue:

create table foo('id' INTEGER PRIMARY KEY, some_order_number INTEGER)

SELECT some_order_number FROM some_table order by some_order_number
results:
1
2
3
4
5
etc.

Mysql table definition statements should be compatible with SQLite (see "Affinity Name Examples" here: http://www.sqlite.org/datatype3.html ) so you could probably use the same type inference that you use for mysql query writer.

[typo]

This one prevents __autoloader to work.

Setup.php, line 73:
$pdo = new Redbean_Driver_PDO( $dsn,$username,$password );

Should be:
$pdo = new RedBean_Driver_PDO( $dsn,$username,$password );
(uppercase B)

Ripping out / dropping / deleting properties...

It would be nice to have a way to remove a column/property from all the beans of a certain type.

Something like

$redbean->narkProperty("article", "byline");

which would rip the column "byline" from the "article" table/bean.

vague error message if no connection

setFullName("M. Rizky Ramadhan"); $member->setGender('m'); $member->setRegDate(time()); $member->save(); ?>

Expected:

  • Error: no database object found, please use kickstart first (or something like that)

Got:

  • Fatal error: Call to a member function escape() on a non-object

Japanese characters not properly stored

Failing test:
$txt = file_get_contents("utf8.txt")
$bean->message=$txt;
RedBean_OODB::set($bean);
$bean2 = RedBean_OODB::getById("note", $id); //Using same ID!
asrt($bean2->message,file_get_contents("utf8.txt"));

Possible connection failure using EmbDriver on Wampp

Actually more of an investigation right now, have no clue what is going on...

RedBean_Setup::kickstartDev("Page,Blog,Comment",
"embmysql:host=localhost;dbname=oodb","root","",false,"innodb",true);

the output is

Warning: Invalid argument supplied for foreach() in
C:\wamp\www\redbean06\oodb.php on line 2202

Warning: Invalid argument supplied for foreach() in
C:\wamp\www\redbean06\oodb.php on line 2202

Warning: Invalid argument supplied for foreach() in
C:\wamp\www\redbean06\oodb.php on line 2202

Gold SQL

Gold SQL is an extension for SQL. In Gold SQL you can prefix columnnames with a @-symbol. If one of these columns does not exist, the database adapter with Gold SQL support will replace this column with NULL. This way you will not notice non-existing columns.

Cache doesn't check adding of new properties

It seems that the cache-extension doesn't check if a bean is cached and a new property is added to the bean. When I try to save the bean with the new property the cache doesn't mark the bean as "dirty", so it doesn't get saved.

$redbean = new RedBean_Plugin_Cache($redbean, $toolbox);
$bean = $redbean->dispense('cache_test_bean');
$bean->name = 'beane maier';
$redbean->store($bean);
//Now the bean is cached
$bean->color = 'yellow';
$redbean->store($bean);
//"name" hasn't changed so the bean isn't marked as dirty and doesn't get saved.

Some Exceptions are not compatible with older PHP versions

Some Exceptions (for instance in the PDO driver) make use of PHP 5.3 Exception Linking; while this is not a bug (it is intended), a side-effect is that users need to upgrade 5.3, it would be nicer if this was not necessary. Maybe a PHP version check? Or a separate distribution?

Failed test "Test RedBean OODB: Insert Record" on windows with mysql in strict mode

Versions: windows 7 64bit, php 5.2.11 (latest 5.2.x version currently), mysql 5.1 (latest production version downloaded from dev.mysql.com). All separately installed by downloading from respective sites (ie. not using easyphp, wamp etc.).

Data truncation occurs during insertion into the dtyp table. When mysql is in strict mode, it does not (silently) truncate the data for transactional table types (by default on windows). In that case redbean fails on inserting records into the dtyp table (for later checking of the field's data type by the looks of it).

Quick solution is to re-configure mysql to not run in strict sql mode, and restart it.

A better solution might be (not sure how much work it would be, and some of the existing tests would have to be re-written for sure) to re-work the way booleans are handled - tinyint(1) instead of set('1') perhaps?

Some more details on the google group: http://groups.google.com/group/redbeanorm/browse_thread/thread/3abb2f025425da00

Date field

You can use the Optimizer as well, but I think it's not necessary...
Just change the column afterwards.
The reason why RedBean does not use a date-time column is that this
may cause odd behavior when RB tries to scale a column down (causes
loss of data).
I could change this behaviour; for instance if you put a date in a
column RB could just turn it into a date-field and mark it as
unchangeable; would you like such a feature?

  • Show quoted text -

    Reply Reply to author Forward

Voahar
View profile
More options Aug 4, 11:53 am
Hello,
I will be interested with that feature if you can provide it.
Thanks Gabor, your work is great.
Regards
Voahar
On 9 juil, 20:56, gabor de mooij [email protected] wrote:

Tagging System

System to tag beans (read/unread books)
Qualify relations

keywords MySQL Querywriter

In a project on which I'm currently working, we were trying to use a
bean called "group". However, this was returning an error whenever we
tried to associate() a "group" bean to something else:

Fatal error: Uncaught [42000] - SQLSTATE[42000]: Syntax error or
access violation: 1064 You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near 'group SET groupname = 'bees' , password =
'ffffff' , admin = 'john' , `g' at line 1 thrown in C:\xampp\htdocs
\contest\RedBean\Driver\PDO.php on line 212

The dump of the query string is:

DROP TABLE IF EXISTS dtyp CREATE TABLE IF NOT EXISTS dtyp ( id
int(11) unsigned NOT NULL auto_increment, booleanset set('1'),
tinyintus tinyint(3) unsigned NOT NULL, intus int(11) unsigned NOT
NULL, doubles double NOT NULL, varchar255 varchar(255) NOT NULL,
text text NOT NULL, PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT
CHARSET=utf8 COLLATE=utf8_unicode_ci CREATE TABLE IF NOT EXISTS
__log ( id INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY , tbl
VARCHAR( 255 ) NOT NULL , action TINYINT( 2 ) NOT NULL , itemid INT
( 11 ) NOT NULL ) ENGINE = MYISAM ; DELETE FROM __log WHERE id < - 200
truncate table dtypinsert into dtyp VALUES
(null,"john","john","john","john","john","john" )truncate table
dtypinsert into dtyp VALUES
(null,"ffffff","ffffff","ffffff","ffffff","ffffff","ffffff" )truncate
table dtypinsert into dtyp VALUES
(null,"john","john","john","john","john","john" )INSERT INTO user
( id, username,password,userid ) VALUES ( NULL, ? , ? , ? )
truncate table dtypinsert into dtyp VALUES
(null,"bees","bees","bees","bees","bees","bees" )truncate table
dtypinsert into dtyp VALUES
(null,"ffffff","ffffff","ffffff","ffffff","ffffff","ffffff" )truncate
table dtypinsert into dtyp VALUES
(null,"john","john","john","john","john","john" )truncate table
dtypinsert into dtyp VALUES
(null,"bees","bees","bees","bees","bees","bees" )INSERT INTO group
( id, groupname,password,admin,groupid ) VALUES
( NULL, ? , ? , ? , ? )truncate table dtypinsert into dtyp VALUES
(null,"john","john","john","john","john","john" )truncate table
dtypinsert into dtyp VALUES
(null,"ffffff","ffffff","ffffff","ffffff","ffffff","ffffff" )truncate
table dtypinsert into dtyp VALUES
(null,"john","john","john","john","john","john" )UPDATE user SET
username = ? , password = ? , userid = ? WHERE id = 1truncate
table dtypinsert into dtyp VALUES
(null,"bees","bees","bees","bees","bees","bees" )truncate table
dtypinsert into dtyp VALUES
(null,"ffffff","ffffff","ffffff","ffffff","ffffff","ffffff" )truncate
table dtypinsert into dtyp VALUES
(null,"john","john","john","john","john","john" )truncate table
dtypinsert into dtyp VALUES
(null,"bees","bees","bees","bees","bees","bees" )UPDATE group SET
groupname = ? , password = ? , admin = ? , groupid = ? WHERE
id = 1

For the time being, we've fixed this by changing the name to
"usergroup", but I figured I'd let you know because I would imagine
you'd probably want to put in some kind of fix for if someone tries to
create a bean using a reserved word.

Naming conventions

RedBean/Adapter/DBAdapter.php should be at RedBean/DBAdapter.php (or else you have to rename the class)

Finder doesn't compatible with multiple OODB instance

Finder use Setup::getToolBox(), which only return last toolbox. If I kickStart more than single OODB (like one to MySQL for permanent data and other to SQLite Memory for tempory), the Finder will only use the last. Probably optional parameter for Toolbox?

R::keepInShape(true) deletes relations

It seems that in redbean 0.6 (downloaded on 23.09.2009 from github) keepInShape(true) deletes all relations between beans. The relation-tables are created as expected, but get deleted afterwards, although there are existing relations in them. Whilst in keepInShape(false) keeps them.

Naming issues break autoloader

in latest master:

class RedBean_QueryWriter_SQLite extends RedBean_AQueryWriter implements RedBean_QueryWriter

should be:

class RedBean_QueryWriter_SQLite extends RedBean_QueryWriter_AQueryWriter implements RedBean_QueryWriter

also:

abstract class RedBean_AQueryWriter

should be: abstract class RedBean_QueryWriter_AQueryWriter

narkProperty

Option to dynamically delete a property from all objects at once (drop column)

Possible issue in RedBean 1.0

Prepare statement seems to raise an exception if an assoc table does not exist yet.

If I run this code for two object classes that have no established
associations yet, I get an exception:
$testA = $rb->dispense( 'testA' );
$testB = $rb->dispense( 'testB' );
$a = new RedBean_AssociationManager( $toolbox );
$a->related( $testA, "testB" );
This is the exception:
Fatal error: Uncaught exception 'PDOException' with message
'SQLSTATE[42S02]: Base table or view not found: 1146 Table
'db.testa_testb' doesn't exist' in \RedBean\Driver\PDO.php:105
Stack trace: #0 \RedBean\Driver\PDO.php(105): PDO-

prepare('SELECT `testB_i...') #1 \RedBean\Driver

\PDO.php(143): RedBean_Driver_PDO->GetAll('SELECT `testB_i...', Array)
#2 \RedBean\Adapter\DBAdapter.php(98): RedBean_Driver_PDO-

GetCol('SELECT `testB_i...', Array) #3 \RedBean\QueryWriter

\MySQL.php(414): RedBean_Adapter_DBAdapter->getCol('SELECT
`testB_i...', Array) #4 \RedBean\AssociationManager.php(122):
RedBean_QueryWriter_MySQL->selectByCrit('testB_id', 'testA_testB',
'testA_id', 0) #5 \index.php(21): RedBean_AssociationManager-

related(Object(RedBean_OODBBean), 'testB') #6 {main} thrown in

\RedBean\Driver\PDO.php on line 105
If you first associate two records of the given type with each other,
then it works just fine. But if you first check for existing
associations, and then want to associate something, it crashes.

Make bean serializable

Because the driver contains a PDO instance (which is not serializable due to db resource), a bean is not serializable.
Adding this method to RedBean_Driver_PDO solves the issue:

public function __sleep()
{
    $this->isConnected = false;
    $this->pdo = null;
    return array('dsn', 'connectInfo', 'isConnected', 'debug', 'affected_rows', 'rs', 'exc');
}

Another solution would be to implement PHP SPL's Serializable interface, but I'm not sure of the benefits.

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.