Whys is my MySQL query returning rows, but no values? - mysql

I'm using this query:
LOAD XML LOCAL INFILE '\\MC_Library_Video.xml' INTO TABLE video ROWS IDENTIFIED BY '<Item>';
On this XML file (abbreviated)
<Item>
<field name="Filename">V:\13 Assassins\13 Assassins.mkv</field>
<field name="Name">13 Assassins</field>
<field name="File Type">mkv</field>
<field name="Genre">Adventure; Drama; Foreign; Martial Arts</field>
<field name="Date">40662</field>
<field name="Bitrate">7501</field>
<field name="Image File">13 Assassins.jpg</field>
<field name="Media Type">Video</field>
<field name="File Size">7041096346</field>
<field name="Duration">7509</field>
<field name="Date Created">1322620528</field>
<field name="Date Modified">1322620528</field>
<field name="Date Imported">1348075046</field>
<field name="Keywords">...</field>
<field name="Description">...</field>
<field name="Media Sub Type">Movie</field>
<field name="Sample Rate">48000</field>
<field name="Channels">6</field>
<field name="Bit Depth">16</field>
<field name="Compression">mkv video (video: AVC1, audio: DTS Audio)</field>
<field name="Width">1280</field>
<field name="Height">528</field>
<field name="MPAA Rating">R</field>
<field name="Director">Takashi Miike</field>
<field name="Actors">...</field>
<field name="Gross Revenue">$17,054,213</field>
<field name="Budget">$6,000,000</field>
<field name="FPS">23.9760400000000012</field>
<field name="Genres">Adventure; Drama; Foreign; Martial Arts</field>
</Item>
And I'm getting this result:
285 row(s) affected Records: 285 Deleted: 0 Skipped: 0 Warnings: 0
But when I look at the data for the table (SELECT * FROM media.video;) I get nothing. There's no data there. Am I missing something? The result makes it appear as if the data was read in, but the table is still blank.

Related

XPATH _ Extract values XML

How Can I extract the characteristics values for the following XML code using XPATH?
Example: Extract displayName, firsName, lastName, etc.
This is my XML data:
<directory>
<fieldset>
<field id="displayName">Display name</field>
<field id="firstName">First name</field>
<field id="lastName">Last name</field>
<field id="preferredName">Preferred name</field>
<field id="jobTitle">Job title</field>
<field id="workPhone">Work Phone</field>
<field id="canUploadPhoto">Can Upload Photo</field>
</fieldset>
<employees>
<employee id="229">
<field id="displayName">Susan</field>
<field id="firstName">TestName</field>
<field id="canUploadPhoto">no</field>
</employee>
</employees>
</directory>
You can get actual values along the following XPath expression:
/directory/employees/employee/field[#id="displayName"]/text()

Importing data from CSV, XML or Json files to solr using dataimport

I am trying to import data from files like CSV, XML and Json to solr core, I am new to solr so this might be a straightforward to some but for me I have tried many online suggestions but not getting the desired result.
So I have a json file and I have enabled dataimport by adding the following requestHandler to solrconfig.xml:
<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
<lst name="defaults">
<str name="config">solr-data-config.xml</str>
</lst>
</requestHandler>
And in the solr-data-config.xml:
<dataConfig>
<dataSource name="dfs" type="FileDataSource"/>
<document>
<entity name="sourcefile" processor="FileListEntityProcessor" fileName=".*" rootEntity="false" baseDir="${solr.install.dir}/example/exampledocs">
<entity name="entryline" processor="LineEntityProcessor" url="${sourcefile.fileAbsolutePath}" rootEntity="true" dataSource="fds" separator=","/>
</entity>
</document>
The updated version:
<dataConfig>
<script><![CDATA[
function CategoryPieces(row) {
var pieces = row.get('manu_id_s').split('/');
var arr = new Array();
for (var i=0; i < pieces.length; i++) {
row.put('manu_id_s' + i, pieces[i].trim());
arr[i] = pieces[i].trim();
}
row.put('manu_id_s', (pieces.length - 1).toFixed());
row.put('manu_id_s', arr.join('/'));
row.put('manu_id_s', arr.join('/'));
return row;
}
]]></script>
<dataSource type="FileDataSource" />
<document>
<entity
name="document"
processor="FileListEntityProcessor"
baseDir="${solr.install.dir}/example/exampledocs/khaled"
fileName=".*.xml$"
recursive="false"
rootEntity="false"
dataSource="null">
<entity
name="test"
processor="XPathEntityProcessor"
transformer="script:CategoryPieces"
url="${document.fileAbsolutePath}"
useSolrAddSchema="true"
stream="true">
</entity>
</entity>
</document>
</dataConfig>
And I have added a json, csv and xml files to the path, in the ui of solr when I use the dataimport it says that e.g. Requests: 0 , Fetched: 26 , Skipped: 0 , Processed: 0 and nothing in the logs, can someone advice how to add the data in the file to solr?
Here is my sample data in the xml file:
<add>
<doc>
<field name="id">USD</field>
<field name="name">One Dollar</field>
<field name="manu">Bank of America</field>
<field name="manu_id_s">boa</field>
<field name="cat">currency</field>
<field name="features">Coins and notes</field>
<field name="price_c">1,USD</field>
<field name="inStock">true</field>
</doc>
<doc>
<field name="id">EUR</field>
<field name="name">One Euro</field>
<field name="manu">European Union</field>
<field name="manu_id_s">eu</field>
<field name="cat">currency</field>
<field name="features">Coins and notes</field>
<field name="price_c">1,EUR</field>
<field name="inStock">true</field>
</doc>
<doc>
<field name="id">GBP</field>
<field name="name">One British Pound</field>
<field name="manu">U.K.</field>
<field name="manu_id_s">uk</field>
<field name="cat">currency</field>
<field name="features">Coins and notes</field>
<field name="price_c">1,GBP</field>
<field name="inStock">true</field>
</doc>
<doc>
<field name="id">NOK</field>
<field name="name">One Krone</field>
<field name="manu">Bank of Norway</field>
<field name="manu_id_s">nor</field>
<field name="cat">currency</field>
<field name="features">Coins and notes</field>
<field name="price_c">1,NOK</field>
<field name="inStock">true</field>
</doc>
</add>
Now the data returned from the query looks like:
{
"responseHeader":{
"status":0,
"QTime":0,
"params":{
"q":"*:*",
"_":"1547556805546"}},
"response":{"numFound":4,"start":0,"docs":[
{
"manu_id_s":"boa",
"id":"USD",
"_version_":1622731088078045184},
{
"manu_id_s":"eu",
"id":"EUR",
"_version_":1622731088081190912},
{
"manu_id_s":"uk",
"id":"GBP",
"_version_":1622731088081190913},
{
"manu_id_s":"nor",
"id":"NOK",
"_version_":1622731088082239488}]
}}

Wordpress - add featured post with image using MySQL

I am trying to add featured post with image in Wordpress using MySQL. I want to do it only by MySQL(no php, only SQL). I tried to add post and then I added meta for the post too. Still, I cannot see featured post with image. Please advise where I am wrong? I have generated XML for records, please check and let me know where I am wrong.
Post Data:
<?xml version="1.0" encoding="utf-8"?>
<table_data name="wp_posts">
<row>
<field name="ID">62</field>
<field name="post_author">1</field>
<field name="post_date">2018-04-24 00:00:00</field>
<field name="post_date_gmt">2018-04-24 00:00:00</field>
<field name="post_content"><img class="alignnone size-medium wp-image-26" src="http://test.com/wp-content/uploads/2018/photos/testing2.jpg" alt="test" width="300" height="219"></field>
<field name="post_title">Manual post</field>
<field name="post_excerpt"></field>
<field name="post_status">publish</field>
<field name="comment_status">open</field>
<field name="ping_status">open</field>
<field name="post_password"></field>
<field name="post_name"></field>
<field name="to_ping"></field>
<field name="pinged"></field>
<field name="post_modified">0000-00-00 00:00:00</field>
<field name="post_modified_gmt">0000-00-00 00:00:00</field>
<field name="post_content_filtered"></field>
<field name="post_parent">0</field>
<field name="guid"></field>
<field name="menu_order">0</field>
<field name="post_type">post</field>
<field name="post_mime_type"></field>
<field name="comment_count">0</field>
</row>
<row>
<field name="ID">63</field>
<field name="post_author">1</field>
<field name="post_date">2018-04-24 00:00:00</field>
<field name="post_date_gmt">2018-04-24 00:00:00</field>
<field name="post_content"></field>
<field name="post_title">testing2</field>
<field name="post_excerpt"></field>
<field name="post_status">inherit</field>
<field name="comment_status">closed</field>
<field name="ping_status">open</field>
<field name="post_password"></field>
<field name="post_name">testing2</field>
<field name="to_ping"></field>
<field name="pinged"></field>
<field name="post_modified">0000-00-00 00:00:00</field>
<field name="post_modified_gmt">0000-00-00 00:00:00</field>
<field name="post_content_filtered"></field>
<field name="post_parent">62</field>
<field name="guid">http://test.com/wp-content/uploads/2018/photos/testing2.jpg</field>
<field name="menu_order">0</field>
<field name="post_type">attachment</field>
<field name="post_mime_type">image/jpeg</field>
<field name="comment_count">0</field>
</row>
</table_data>
Meta of Post
<table_data name="wp_postmeta">
<row>
<field name="meta_id">211</field>
<field name="post_id">62</field>
<field name="meta_key">_thumbnail_id</field>
<field name="meta_value">63</field>
</row>
</table_data>
What is missing and how to add using MySQL?
Thanks

error programming when using inherit in oodo9

i am new in oodo9, i have got error when i have try to add a new field into res.partner using inherit, it tell me that the new field does not exist in res.partner, please help me
class testtt(models.Model):
_inherit ='res.partner'
_columns = {
'test_field': fields.char('test field'),
}
testtt()
<record id="testtt" model="ir.ui.view">
<field name="name"> test.form </field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="arch" type="xml">
<field name="name" position="after">
<field name="test_field" />
</field>
</field>
</record>

New FIELDS are not showing in search

I did a basic solr setup, Configured dataImportHandler and create very simple data config file with two fields and indexed it. It all worked fine.. But now I am adding new fields there and doing full import after that but for some reason new fields are just not showing in search result ( using solr interface for search). I have tried restarting solr, running config-reload to no effect.
this is my data config file. Not sure what's wrong here.
<dataConfig>
<dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/msl4" user="root" password=""/>
<document>
<entity name="hub_contents" query="select * from hub_contents" deltaQuery="select * from hub_contents where last_modified > '${dataimporter.last_index_time}'">
<field column="id_original" name="id" />
<field column="title" name="title" />
<field column="parent_id" name="parent_id" />
<field column="item_type" name="item_type" />
<field column="status" name="status" />
<field column="updated_at" name="updated_at" />
</entity>
</document>
</dataConfig>
You can add the below fields in your schema.xml
<field name="id" type="long" indexed="true" stored="true"/>
<field name="title" type="text_general" indexed="true" stored="true"/>
<field name="parent_id" type="long" indexed="true" stored="true"/>
<field name="item_type" type="text_general" indexed="true" stored="true"/>
<field name="status" type="text_general" indexed="true" stored="true" />
<field name="updated_at" type="date" indexed="true" stored="true"/>
It is left to you what type(fieldType) you want to add depending on your requirement.
indexed: true if this field should be indexed (searchable or
sortable)
stored: true if this field should be retrievable
Add the below tag:
<uniqueKey>id</uniqueKey>
This is to use to determine and enforce document uniqueness.