nticompass / codeigniter-subqueries Goto Github PK
View Code? Open in Web Editor NEWAn active record subquery library for CodeIgniter. Also contains useful db helper functions.
Home Page: https://generic.computers.pictures
License: MIT License
An active record subquery library for CodeIgniter. Also contains useful db helper functions.
Home Page: https://generic.computers.pictures
License: MIT License
I just put the library subquery.php in application/libraries directory and try to test it but i had this error, i was reading but nothing can help me.
I did somethin wrong or its a really issue
$this->subquery->start_subquery('where');
$this->subquery->end_subquery('table.field');
This doesn't work. Please update end_subquery
to parse out table names.
Hello,
After i upgraded to latest CI i get this problem.
PHP Fatal error: Call to protected method CI_DB_active_record::_compile_select() from context 'Subquery' in /var/www/website/application/libraries/Subquery.php on line 84
Greetings
ws
Fatal error: Call to undefined method CI_DB_mysqli_driver::set_dbprefix() in /data/www/paomi.com/user/libraries/Subquery.php on line 57
I found that set_dbprefix is really not in the source of CI 1.7.2.
Pardon for my beginner in object oriented PHP Codeigniter. I am confused about using $this->subquery->defaultDB() ?
$db2 = $this->load->database('db2', TRUE);
$this->load->library('Subquery');
$this->subquery->defaultDB($db2)
$sub = $this->subquery->start_subquery('select');
$sub->select('number')->from('numbers')->where('numberID', 2);
$this->subquery->end_subquery('number');
$query = $db2->get('mytable');
but the subquery still use the default database not db2. Thank you.
I'm doing some left joins involving "count", and when results are displayed zeros become null.
The current version
/**
* start_union - Creates a new database object to be used for unions
*
* @return A new database object to use for a union query
*/
function start_union(){
$this->unions++;
return $this->start_subquery('');
}
Causes
Because the A
from "A new database..." is the first argument here.
Instead the first word should be the returned type:
/**
* @return CI_Loader A new database object to use for a union query
*/
Hello. Can I use your library for construction "where exists(subquery)"?
The Union example is shown like this
$sub1 = $this->subquery->start_union();
$sub1->select('field1')->from('table1');
$sub2 = $this->subquery->start_union();
$sub2->select('field2')->from('table2');
$sub3 = $this->subquery->start_union();
$sub3->select('field3')->from('table3');
$this->subquery->end_union();
$this->db->order_by('field1', 'DESC');
But, isn't subquery a method of active record, like this?
$sub1 = $this->db->subquery->start_union();
$sub1->select('field1')->from('table1');
$sub2 = $this->db->subquery->start_union();
$sub2->select('field2')->from('table2');
$sub3 = $this->db->subquery->start_union();
$sub3->select('field3')->from('table3');
$this->subquery->end_union();
$this->db->order_by('field1', 'DESC');
$sub1 = $this->subquery->start_union();
$sub1->select('fm.challan_id as id,lc.challan_no as challan_no')
->from('freightmemo fm')->join('lorrychallan lc','fm.challan_id=lc.id')
->where('fm.id',$this->input->post('bindto'));
$sub2 = $this->subquery->start_union();
$sub2->select('ch.id as id,ch.challan_no as challan_no')
->from('lorrychallan ch')->join('freightmemo fm','fm.challan_id=ch.id','LEFT OUTER')
->where('fm.challan_id IS NULL',NULL,FALSE);
$this->subquery->end_union();
Now how can i get the result in return just like other query
$this->db->get()->result_array();
this is not working with above query
PHP Fatal error: Call to undefined method CI_DB_mysql_driver::get_compiled_select() in /var/www/ids/application/libraries/Subquery.php on line 88
Hey, I could ask if you could licence this as MIT?
Hi try to load the library in my project and get this error (just set in autoload.php nothing else):
** Subquery library cannot run. Missing get_compiled_select. Please use the dev version of CodeIgniter.
I change to develop and get 505 Internal error, any help?
show error queries when contain 2 or more group_by inside subqueries. example
$this->db->select('field1');
$sub = $this->subquery->start_subquery('from');
$sub->select('field1');
$sub->from($table_1);
$sub->where('field2', $con1)
->where('DATE(field3) >=', $con2)
->where('DATE(field3) <=', $tgcon3_to);
$sub->group_by('field4')
->group_by('field5');
$this->subquery->end_subquery('test');
$total = $this->db->count_all_results();
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.