您好我在尝试在数据库webhostc_MyRadContactForm
当我尝试在phpMyAdmin中执行以下语句时,我收到此错误
CREATE TABLE Contacts (
-> ContactID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
-> ContactName VARCHAR(100),
-> ContactEmail VARCHAR(100),
-> ContactLeastFavoriteColor VARCHAR(10)
-> ContactDateCreated DATETIME
-> );
#1064 - 您的SQL语法出错;检查与您的MariaDB服务器版本对应的手册,以便在' - >附近使用正确的语法。 ContactID INT NOT NULL AUTO_INCREMENT PRIMARY KEY, - >第2行的ContactName VARCHA'
另外phpMyAdmin标记这些行:
我的服务器正在运行:10.0.22-MariaDB
答案 0 :(得分:1)
您在ContactLeastFavoriteColor VARCHAR(10)
之后错过了一个逗号,并且那些箭头->
不应该在那里。以下是创建表的正确语法:
CREATE TABLE Contacts (
ContactID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
ContactName VARCHAR(100),
ContactEmail VARCHAR(100),
ContactLeastFavoriteColor VARCHAR(10),
ContactDateCreated DATETIME
);
祝你好运!!
答案 1 :(得分:1)
有两个问题:
这些public class RecordHelper {
private MediaRecorder mMediaRecorder;
private MediaProjection mMediaProjection;
private VirtualDisplay mVirtualDisplay;
private MediaProjectionManager mProjectionManager;
private Context mContext;
private Toast mToastText;
public RecordHelper(Context mContext){
this.mContext=mContext;
mProjectionManager = (MediaProjectionManager) mContext.getSystemService(Context.MEDIA_PROJECTION_SERVICE);
mMediaRecorder = new MediaRecorder();
}
public void StartRecord(RecordArg mRecordArg, int resultCode, Intent data){
initRecorder(mRecordArg);
prepareRecorder();
mMediaProjection = mProjectionManager.getMediaProjection(resultCode, data);
MediaProjectionCallback mMediaProjectionCallback = new MediaProjectionCallback();
//This will cause error
//mMediaProjection.registerCallback(mMediaProjectionCallback, null);
mVirtualDisplay=createVirtualDisplay(mRecordArg);
DelayStartRecord(mRecordArg);
}
public void StopRecord(){
try {
mMediaRecorder.stop();
mMediaRecorder.reset();
mVirtualDisplay.release();
mMediaRecorder.release();
mMediaProjection.stop();
mMediaProjection = null;
}catch (Exception e){
Utility.LogError("StopRecord Error " + e.getMessage() + " " + e.toString());
}
}
private void DelayStartRecord(RecordArg mRecordArg){
mMediaRecorder.start();
}
private void initRecorder(RecordArg mRecordArg) {
mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.SURFACE);
mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);
mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
mMediaRecorder.setVideoEncodingBitRate(512 * 1000);
mMediaRecorder.setVideoFrameRate(30);
mMediaRecorder.setVideoSize(mRecordArg.screenWidth, mRecordArg.screenHeight);
mMediaRecorder.setOutputFile(mRecordArg.videoFilename);
}
private void prepareRecorder() {
try {
mMediaRecorder.prepare();
} catch (IllegalStateException e) {
e.printStackTrace();
Utility.LogError(e.getMessage());
} catch (IOException e) {
e.printStackTrace();
Utility.LogError(e.getMessage());
}
}
private VirtualDisplay createVirtualDisplay(RecordArg mRecordArg) {
return mMediaProjection.createVirtualDisplay("ScreenRecord",
mRecordArg.screenWidth, mRecordArg.screenHeight, mRecordArg.mScreenDensity,
DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR,
mMediaRecorder.getSurface(), null /*Callbacks*/, null /*Handler*/);
}
//Called when the MediaProjection session is no longer valid.
private class MediaProjectionCallback extends MediaProjection.Callback {
@Override
public void onStop() {
}
}
}
符号不是SQL语法的一部分。当您输入多行查询时,它们会提示->
打印。您无法将它们复制到PhpMyAdmin。
您在MySQL monitor
行末尾缺少逗号。