summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryo mama <pepper@scannerjammer.com>2015-03-23 15:57:09 -0700
committeryo mama <pepper@scannerjammer.com>2015-03-23 15:57:09 -0700
commit00c7f6129f87d77788aa92e08dd77b7b473f9a71 (patch)
tree476e7f456fb3138d17927ce0ff3fea7b1a8f0060
parent1cc8609a5976d3f394ac0f36fd1322ee8e6e4eea (diff)
moved things around
-rw-r--r--DBIC_tests.pl2
-rwxr-xr-xDBI_sqlite_alternative.pm59
-rw-r--r--README.md0
-rwxr-xr-xadd_some_data.pl9
-rw-r--r--journals.dbbin2048 -> 0 bytes
-rw-r--r--many_to_many_example.postgres16
-rw-r--r--manytomany_sqlite.sql16
-rw-r--r--mysql_created_with_sql_translator_from_sqlite.sql19
-rw-r--r--schema.sqlite8
-rw-r--r--sphinx.conf51
-rw-r--r--sphinx_commands.sh2
-rw-r--r--sphinxtest.pl10
12 files changed, 5 insertions, 187 deletions
diff --git a/DBIC_tests.pl b/DBIC_tests.pl
index ec532d4..052209e 100644
--- a/DBIC_tests.pl
+++ b/DBIC_tests.pl
@@ -10,7 +10,7 @@ my $entry = {
image_url => "http://myimage.com/new.png",
date => DateTime->now()->epoch,
};
-#our $schema = JournalApp::Schema->connect( 'dbi:SQLite:./journals.db', '', '');
+#our $schema = JournalApp::Schema->connect( 'dbi:SQLite:./database/journals.db', '', '');
our $schema = JournalApp::Schema->connect( 'dbi:mysql:database=journal;host=localhost;port=3306', 'journal_user', 'journal_password', {
quote_names => 1
});
diff --git a/DBI_sqlite_alternative.pm b/DBI_sqlite_alternative.pm
deleted file mode 100755
index 83c9d41..0000000
--- a/DBI_sqlite_alternative.pm
+++ /dev/null
@@ -1,59 +0,0 @@
-package journal_database;
-use DBD::SQLite;
-use DBI;
-use Data::Dumper;
-my $dbh = DBI->connect("dbi:SQLite:dbname=journals.db","","");
-
-
-CREATE TABLE journals(
- id INTEGER PRIMARY KEY NOT NULL, --optional
- date INTEGER NOT NULL,
- fulltext TEXT,
- image_url TEXT
-);
-
-sub remove_from_db{
- my $id_to_remove = shift;
- my $sth = $dbh->prepare(
- "DELETE FROM journals ".
- "WHERE id=$id_to_remove;"
- );
- $sth->execute();
-}
-sub get_entry_by_date {
- my $date_int = shift;
- my $sth = $dbh->prepare(
- "SELECT *".
- "FROM journals ".
- "WHERE `date`=? "
- );
- $sth->execute($date_int);
- return $sth->fetchrow_hashref();
-}
-
-sub add_journal_entry{
- my $entry = shift;
- my $sqlCmd = "insert into journals values (?,?,?,?);" ;
-# ."on duplicate key update ".
-# "id = ?,".
-# "date = ?,".
-# "fulltext = ?,".
-# "image_url = ?,".
-# ";";
- my $sth = $dbh->do($sqlCmd,
- undef,
- $entry->{id},
- $entry->{date} || time(),
- $entry->{fulltext},
- $entry->{image_url}
- );
- }
-
- my $entry = {};
- $entry->{id} = '12';
- $entry->{date} = '123432';
- $entry->{fulltext} = 'this is a test of the fulltext';
- $entry->{image_url} = 'this is a test of the image url';
- add_journal_entry($entry);
- print Dumper get_entry_by_date(123432);
- remove_from_db(12);
diff --git a/README.md b/README.md
deleted file mode 100644
index e69de29..0000000
--- a/README.md
+++ /dev/null
diff --git a/add_some_data.pl b/add_some_data.pl
index 3362d11..01c574b 100755
--- a/add_some_data.pl
+++ b/add_some_data.pl
@@ -23,15 +23,16 @@ my $entry3 = {
date => DateTime->now()->epoch,
};
#our $schema = JournalApp::Schema->connect( 'dbi:SQLite:./journals.db', '', '');
-our $schema = JournalApp::Schema->connect( 'dbi:mysql:database=journal;host=localhost;port=3306', 'journal_user', 'journal_password', {
+our $schema = JournalApp::Schema->connect( 'dbi:mysql:database=journal;host=localhost;port=3306',
+ 'journal_user',
+ 'journal_password', {
quote_names => 1
});
sub test_remove_from_db{
#delete by id
my $journalentry = $schema->resultset('Journal')->find({ id => $entry->{id} });
-
-$journalentry->delete();
+ $journalentry->delete();
}
@@ -59,8 +60,6 @@ sub test_add_journal_entry{
return $journalentry;
}
-#how do I connect?
-
sub main{
test_add_journal_entry $entry1;
test_add_journal_entry $entry2;
diff --git a/journals.db b/journals.db
deleted file mode 100644
index 8f90768..0000000
--- a/journals.db
+++ /dev/null
Binary files differ
diff --git a/many_to_many_example.postgres b/many_to_many_example.postgres
deleted file mode 100644
index 6a4ef56..0000000
--- a/many_to_many_example.postgres
+++ /dev/null
@@ -1,16 +0,0 @@
-CREATE TABLE cds(
-id serial PRIMARY KEY -- implicit primary key constraint,
-title text NOT NULL
-);
-
-CREATE TABLE artists(
-id serial PRIMARY KEY,
-name text NOT NULL
-);
-
-CREATE TABLE cds_and_artists(
-cds_id integer REFERENCES cds (id) ON UPDATE CASCADE ON DELETE CASCADE,
-artists_id integer REFERENCES artisys (id) ON UPDATE CASCADE,
-CONSTRAINT cds_and_artists_pkey PRIMARY KEY (cds_id, artists_id)
-);
-
diff --git a/manytomany_sqlite.sql b/manytomany_sqlite.sql
deleted file mode 100644
index 2546b5f..0000000
--- a/manytomany_sqlite.sql
+++ /dev/null
@@ -1,16 +0,0 @@
-CREATE TABLE cds(
- id INTEGER PRIMARY KEY NOT NULL,
- title TEXT NOT NULL
-);
-CREATE TABLE artists(
- id INTEGER PRIMARY KEY NOT NULL,
- name TEXT NOT NULL
-);
-CREATE TABLE cds_and_artists(
- cds_id INTEGER,
- artists_id INTEGER,
- FOREIGN KEY(cds_id) REFERENCES cds(id) ON DELETE CASCADE,
- FOREIGN KEY(artists_id) REFERENCES artists(id) ON DELETE CASCADE
-);
-CREATE INDEX cdsindex ON cds_and_artists(cds_id);
-CREATE INDEX artistsindex ON cds_and_artists(artists_id);
diff --git a/mysql_created_with_sql_translator_from_sqlite.sql b/mysql_created_with_sql_translator_from_sqlite.sql
deleted file mode 100644
index 9fd0b7f..0000000
--- a/mysql_created_with_sql_translator_from_sqlite.sql
+++ /dev/null
@@ -1,19 +0,0 @@
---
--- Created by SQL::Translator::Producer::MySQL
--- Created on Wed Sep 10 16:34:40 2014
---
-SET foreign_key_checks=0;
-
---
--- Table: `journals`
---
-CREATE TABLE `journals` (
- `id` INTEGER NOT NULL,
- `date` INTEGER NOT NULL comment 'optional',
- `fulltext` text NULL,
- `image_url` text NULL,
- PRIMARY KEY (`id`)
-);
-
-SET foreign_key_checks=1;
-
diff --git a/schema.sqlite b/schema.sqlite
deleted file mode 100644
index 1fe63c0..0000000
--- a/schema.sqlite
+++ /dev/null
@@ -1,8 +0,0 @@
-PRAGMA foreign_keys = ON;
-CREATE TABLE journals(
- id INTEGER PRIMARY KEY NOT NULL, --optional
- date INTEGER NOT NULL,
- fulltext TEXT,
- image_url TEXT
-);
-
diff --git a/sphinx.conf b/sphinx.conf
deleted file mode 100644
index 24d271b..0000000
--- a/sphinx.conf
+++ /dev/null
@@ -1,51 +0,0 @@
-source journal
-{
- type = mysql
- sql_host = localhost
- sql_user = journal_user
- sql_pass = journal_password
- sql_db = journal
-# sql_sock = /var/run/mysqld/mysqld.sock
- sql_port = 3306
-
- # indexer query
- # document_id MUST be the very first field
- # document_id MUST be positive (non-zero, non-negative)
- # document_id MUST fit into 32 bits
- # document_id MUST be unique
- sql_query = \
- SELECT \
- `id`, `fulltext`, `image_url` \
- FROM \
- journals;
-#
-# sql_group_column = assembly
-# sql_group_column = model
-
- # document info query
- # ONLY used by search utility to display document information
- # MUST be able to fetch document info by its id, therefore
- # MUST contain '$id' macro
- #
-
- sql_query_info = SELECT * FROM journals WHERE id=$id
-}
-
-index journal
-{
- source = journal
- path = /home/pepper/sphinx/journal
- morphology = stem_en
-
- min_word_len = 3
- min_prefix_len = 0
- min_infix_len = 3
-}
-
-searchd
-{
- port = 3312
- log = /var/log/searchd/searchd.log
- query_log = /var/log/searchd/query.log
- pid_file = /var/log/searchd/searchd.pid
-}
diff --git a/sphinx_commands.sh b/sphinx_commands.sh
deleted file mode 100644
index d721456..0000000
--- a/sphinx_commands.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-sudo sphinx-indexer journal
-sudo sphinx-searchd
diff --git a/sphinxtest.pl b/sphinxtest.pl
deleted file mode 100644
index 3ec4f14..0000000
--- a/sphinxtest.pl
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/bin/perl
-use Data::Dumper;
-use Sphinx::Search;
-
-$sph = Sphinx::Search->new();
-
-$results = $sph->SetMatchMode(SPH_MATCH_ALL)
- ->SetSortMode(SPH_SORT_RELEVANCE)
- ->Query("dolly");
-print Dumper $results;