mysql

URL and link text from database

一世执手 提交于 2021-02-19 08:42:46
问题 I am currently still learning PHP so some things I still struggle with. I have been taking it slowly and reading tutorials which has helped but I can't figure this one out. I have a database table (in mysql) with let's say, 100 urls. There is a column called 'url' and a second column 'text'. I already have the pagination code which works, so will also be using that. What I want to do is echo out the URLs (which are all in folder called blog in the root of my site), but use the text as the

URL and link text from database

戏子无情 提交于 2021-02-19 08:42:05
问题 I am currently still learning PHP so some things I still struggle with. I have been taking it slowly and reading tutorials which has helped but I can't figure this one out. I have a database table (in mysql) with let's say, 100 urls. There is a column called 'url' and a second column 'text'. I already have the pagination code which works, so will also be using that. What I want to do is echo out the URLs (which are all in folder called blog in the root of my site), but use the text as the

Export large CSV file using laravel

我怕爱的太早我们不能终老 提交于 2021-02-19 08:37:27
问题 I have to export 600k database rows with a belongsTo relationship between two tables to a csv file using a queued job in laravel 5.2, it works fine when I do not include the information from the second table, but it reaches memory limit or timeout I guess (there is no error on the output, the job just stops and the file blocks at ~8MB) when I include the second table. Here is my handle function from my job : public function handle() { $request = $this->request; $ts = Carbon::now()->timestamp;

ManyToOne annotation to specific column

£可爱£侵袭症+ 提交于 2021-02-19 08:06:43
问题 I am trying to create the follow structure using Hibernate with annotations: To create a ManyToMany relationship I had created two classes called SessionRiu and SessionRiuId (pk). This way the Session class has two foreign keys (agend_id and user_id) but when I try to create the OneToMany from operation the hibernate does not create the foreign using the id from session: Session FKs: Operation FKs ( empty ): As I am beginner in java and hibernate, I would appreciate any suggest about my code.

Error using perl module DBD::mysql in ActivePerl 5.28 on Windws10 64bits

时光毁灭记忆、已成空白 提交于 2021-02-19 08:01:48
问题 I installed the new ActiveState Perl custom build with Perl 5.28 and I added the module (DBD-mysql v4.50). The DBI module is set by default to the ActivePerl 5.28 compilation. use strict; use warnings; use diagnostics; use DBI; ### INIT DB CONNECTION my $dbh = DBI->connect("DBI:mysql:database=testdb;host=localhost","root", "XXXX",{'RaiseError' => 1,'mysql_auto_reconnect' => 1}); $dbh->{InactiveDestroy} = 1; $dbh->{mysql_auto_reconnect} = 1; then I get the following error: >perl test.pl

How to UPDATE table with SUM() and COUNT() in same table to different columns

孤者浪人 提交于 2021-02-19 07:53:18
问题 I currently dont do this for my webpage for displaying data from the table, and it is now taking longer to load the page as more and more data enters the database making the query time consuming. In my head, I am looking to update a table as follows so that I am just querying the table and not running additional arrhythmic on the contents via SELECT functions. I was planning to run something like this in a while loop to cycle all iterations of the user variable. UPDATE table SET total = SUM

Laravel eloquent withCount() supposed to be slower than just with()

孤街醉人 提交于 2021-02-19 07:51:25
问题 So the reason i ask this is that in my current app withCount() almost triples the response time vs just fetching all the data for the relationship via with() and just getting the length from the frontend (javascript). I thought the point of using withCount() was to speed up the query but maybe i'm wrong? for example: courseSession::where('id', '>=', 1) ->where('id', '<=', 320) ->withCount('enrollments') ->get(); averages around 900ms response (debugbar shows this as a single DB call) but

Oracle MERGE and prepared statement

五迷三道 提交于 2021-02-19 07:48:05
问题 I have a backup utility, workig on restore section. This is my table: CREATE TABLE "SBOOKS"."DEV_CORPUS" ( "CORPUSID" NUMBER(9,0) NOT NULL ENABLE, "CORPUS_NAME" VARCHAR2(768 BYTE) NOT NULL ENABLE, "CORPUSLASTSYNC" DATE, PRIMARY KEY ("CORPUSID") In restore class I would like to look for a primary key in table, if it exists then update the row, if not then insert a row. now the problem is I need to pass the parameters from the class (they do not exist in any table), how can I do this? what is

Entity Framework metadata artifact not embeded when using xbuild and mono

拈花ヽ惹草 提交于 2021-02-19 07:36:40
问题 When I try and use EntityFramework and MySQL on a Linux or Windows environment I run into the following problem: Project 1: Contains EntityFramework edmx and logic to insert update data using the dbcontext class Project 2: References Project 1. When I build the solution using msbuild the EntityFramework metadata files are embeded in Project1.dll When I do a clean build with xbuild in a Linux environment or in a Windows environment the EntityFramework metadata files are missing When you run

Entity Framework metadata artifact not embeded when using xbuild and mono

☆樱花仙子☆ 提交于 2021-02-19 07:36:25
问题 When I try and use EntityFramework and MySQL on a Linux or Windows environment I run into the following problem: Project 1: Contains EntityFramework edmx and logic to insert update data using the dbcontext class Project 2: References Project 1. When I build the solution using msbuild the EntityFramework metadata files are embeded in Project1.dll When I do a clean build with xbuild in a Linux environment or in a Windows environment the EntityFramework metadata files are missing When you run