I am using Codeigniter. I am trying to integrate FullCalendar with my project. It is working. But, i am not able to save the events in database(mysql) using codeigniter. Is it possible to save selected events to database with date?
yes, It's possible. you can put your AJAX call whenever a event create/updated/deleted with fullcalendar events and you can save the data into database. Checkout the below library which shows basic CRUD operations of FullCalendar with codeigniter.
https://github.com/eboominathan/Basic-Crud-in-Full-Calendar-Using-Codeigniter-3.0.3
It is possible. You need to setup some kind of mysql table which can store the events. From FullCalendar with PHP & CodeIgniter:
CREATE TABLE `calendar_events` (
`ID` int(11) NOT NULL,
`title` varchar(500) COLLATE utf8_unicode_ci NOT NULL,
`start` datetime NOT NULL,
`end` datetime NOT NULL,
`description` varchar(1000) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
Then you can insert events into it using the start and end datetimes provided by the library.
When you need to grab them, use the start and end dates that FC provides.
Related
I have a table that I created using
CREATE TABLE `digiid_callback` ( `nonce` BINARY(8) NOT NULL, `address` BINARY(20), `expire` TIMESTAMP NOT NULL, PRIMARY KEY (`nonce`) )
So it has 3 fields. 1 is a timestamp and the other 2 hold a small binary data filed.
I am new to working with the yii framework and was wondering what the proper way to create an ActiveRecord for this table would be.
Normally if I was trying to select data from a table like this I would use
SELECT * FROM tablename WHERE nonce=UNHEX(?) LIMIT 1;
the yii equivalent seems to be ObjectName::findOne(?); but I don't know how to add the UNHEX which is needed.
First create DB table, then generate ActiveRecord (AR) class for that table using gii tool and then learn AR tutorial.
I am evaluating the loading performance of Singlestore 7.6.10.
I tested two ways of loading both are important to real world practice:
loading to skip duplicated primary keys
load data local infile '/opt/orders.tbl' skip duplicate key errors into table ORDERS fields terminated by '|' lines terminated by '|\n' max_errors 0;
loading to replace duplicated primary keys with latest records
load data local infile '/opt/orders.tbl' replace into table orders_sf1_col columns terminated by '|';
Before running the tests, I guessed both methods should have similar performance in terms of load time because both ways need to scan the primary key to lookup duplicated data. If there is any difference, probably the REPLACE method should take more time because it needs to delete the current record and insert the latest one for replacement.
But to my surprise, loading with SKIP runs extremely slow and finished to load 163MB data file in almost 8 minutes. But the REPLACE loading with same file to same table can be finished in less than 15 seconds.
Both tests are run on same test environment (3 VMs) with same data file and load into the same target table. To simulate the duplicated conflicts, I ran two consecutive loads to an empty table and only measure the last one.
Question is why using skip duplicate key errors performs so slow and if there is a better way to achieve the same effect?
The DDL is here:
CREATE TABLE `orders_sf1_col` (
`O_ORDERKEY` int(11) NOT NULL,
`O_CUSTKEY` int(11) NOT NULL,
`O_ORDERSTATUS` char(1) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`O_TOTALPRICE` decimal(15,2) NOT NULL,
`O_ORDERDATE` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00.000000',
`O_ORDERPRIORITY` varchar(15) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`O_CLERK` varchar(15) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`O_SHIPPRIORITY` int(11) NOT NULL,
`O_COMMENT` varchar(79) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`O_NOP` varchar(79) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
UNIQUE KEY `PRIMARY` (`O_ORDERKEY`) USING HASH,
KEY `ORDERS_FK1` (`O_CUSTKEY`) USING HASH,
KEY `ORDERS_DT_IDX` (`O_ORDERDATE`) USING HASH,
SHARD KEY `__SHARDKEY` (`O_ORDERKEY`) USING CLUSTERED COLUMNSTORE
) AUTOSTATS_CARDINALITY_MODE=INCREMENTAL AUTOSTATS_HISTOGRAM_MODE=CREATE AUTOSTATS_SAMPLING=ON SQL_MODE='STRICT_ALL_TABLES'
Thanks
Skip is more resource intensive function because it utilizes clustered index scan that's why it was taking more time.
On the other hand,
Replace utilizes less resources of the server because it uses clustered index seek
Which reduces the execution time with a noticeable difference.
But Singlestore latest version (7.8) has better results please go thru the official documentation.
I have to be able to rename the default Spring Session table and found the following configuration options in the spring session documentation.
spring.session.jdbc.schema=classpath:org/springframework/session/jdbc/schema-##platform##.sql # Path to the SQL file to use to initialize the database schema.
spring.session.jdbc.table-name=SPRING_SESSION # Name of database table used to store sessions.
Here is what I am trying to set in application.properties:
spring.session.store-type=jdbc
spring.session.jdbc.table-name: APP_SPR_SESSION
spring.session.jdbc.schema: src/main/resources/appSpringSession.sql
Here are the contents of appSpringSession.sql which is a modified/renamed version of schema-oracle.sql
CREATE TABLE app_app.APP_SPR_SESSION (
PRIMARY_ID CHAR(36) NOT NULL,
SESSION_ID CHAR(36) NOT NULL,
CREATION_TIME NUMBER(19,0) NOT NULL,
LAST_ACCESS_TIME NUMBER(19,0) NOT NULL,
MAX_INACTIVE_INTERVAL NUMBER(10,0) NOT NULL,
EXPIRY_TIME NUMBER(19,0) NOT NULL,
PRINCIPAL_NAME VARCHAR2(100 CHAR),
CONSTRAINT APP_SPR_SESSION_PK PRIMARY KEY (PRIMARY_ID)
);
CREATE UNIQUE INDEX APP_SPR_SESSION_IX1 ON APP_SPR_SESSION (SESSION_ID);
CREATE INDEX APP_SPR_SESSION_IX2 ON APP_SPR_SESSION (EXPIRY_TIME);
CREATE INDEX APP_SPR_SESSION_IX3 ON APP_SPR_SESSION (PRINCIPAL_NAME);
CREATE TABLE app_app.APP_SPR_SESSION_ATTRIBUTES (
SESSION_PRIMARY_ID CHAR(36) NOT NULL,
ATTRIBUTE_NAME VARCHAR2(200 CHAR) NOT NULL,
ATTRIBUTE_BYTES BLOB NOT NULL,
CONSTRAINT APP_SPR_SESSION_ATTRIBUTES_PK PRIMARY KEY
(SESSION_PRIMARY_ID,
ATTRIBUTE_NAME),
CONSTRAINT APP_SPR_SESSION_ATTRIBUTES_FK FOREIGN KEY
(SESSION_PRIMARY_ID)
REFERENCES APP_SPR_SESSION(PRIMARY_ID) ON DELETE CASCADE
);
I have manually added the tables using the above ddl into the Oracle database and every time the app starts it's still looking for SPRING_SESSION table.
Seems like specifying these options has no effect. What am I reading wrong here from the docs?
Also I am using Spring Session 2.0.2 Release and Spring Boot 2.0.1.RELEASE
The reason spring.session.* do not work for you is because your are using #EnableJdbcHttpSession. That means that you are configuring Spring Session explicitly, so Spring Boot backs off with its auto-configuration.
You should remove #EnableJdbcHttpSession and ensure Spring Boot is auto-configuring Spring Session. Additionally, you could also leave spring.session.store-type out, since Spring Boot should be able to deduce which session repository implementation are you using as long as you have only only SessionRepository implementation on the classpath (i.e. you depend only on spring-session-jdbc and no other Spring Session modules).
You can also use #EnableJdbcHttpSession(tableName = "APP_SPR_SESSION")
I'm new in using in-memmory database.
I tried to use H2 database for developing project with spring boot, spring data JPA, but i got a problem when initialize application.
Caused by: org.h2.jdbc.JdbcSQLException: Unknown data type: "FK_PERSON__PERSONTYPE_IDX"; SQL statement:
Because this script was exported from MySQL. So i thinked there are some wrong syntax which H2 does not understand
For example, this is a part of script:
CREATE TABLE `person` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`firstname` varchar(255) NOT NULL,
`lastname` varchar(255) DEFAULT NULL,
`type` int(11) NOT NULL,
`address` text,
PRIMARY KEY (`id`),
KEY `fk_person__persontype_idx` (`type`),
CONSTRAINT `fk_person__persontype` FOREIGN KEY (`type`) REFERENCES `persontype` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT=' ';
And i tried some solutions from these:
Convert MySQL script to H2
http://matthewcasperson.blogspot.de/2013/07/exporting-from-mysql-to-h2.html
Replace symbols with double quotes, single quotes,... even not use quote at all but not working.
Please show me why?
Thank you.
I had a similar issue.
Removing the "KEY" line, which in your example corrosponds to:
KEY `fk_person__persontype_idx` (`type`),
worked for me.
I currently have my Rails 3.2 environment connected with an already existing database, with the oracle_enhanced-adapter handling the connection. What I need to do now is take the already existing tables (which probably aren't in ActiveRecord format) and generate models, controllers, and views for them. However, I'm not sure how to go about creating these. Do I need to do it manually?
As an example, here's the device table in my database:
Device_Name, VARCHAR2(32 BYTE), primary key
Device_Desc, VARCHAR2(400 BYTE)
Created_By, VARCHAR2(8 BYTE)
Creation_Date, DATE
Last_Updated_By, VARCHAR2(8 BYTE)
Last_Updated_Date, DATE
How would I get a controller, model, and view for this in rails. Do I need to manually create the model? Or is this all I would need:
class Device < ActiveRecord::Base
self.table_name="Device"
self.primary_key="Device_Name"
end
Thanks for your help!